SEO Position Tracker 📡
A simple Python CLI and in-code SEO position tracking tool for Google and 6 other search engines.
This project uses SerpApi
🔎 Current search engines support
- Google Search - first 100 organic results.
- Baidu Search - first 50 organic results.
- Bing Search - first 50 organic results.
- DuckDuckGo Search - up to 30 organic results.
- Yahoo! Search - first 10 organic results.
- Yandex Search - up to 15 organic results.
- Naver Search - first 15 organic results.
⚙️Installation
$ pip install seo-position-tracker
Install from source:
Windows:
$ git clone https://github.com/dimitryzub/seo-position-tracking.git
$ cd seo-position-tracker/
$ python -m venv env
$ env/Scripts/activate
$ pip install poetry
$ poetry install
If you get an error, try:
$ pip install chardet
$ poetry install
🤹♂️Usage
You can envoke script by this two commands.
Examples below will show usage with poetry run seo <command>, but you can use python main.py <command> instead.
$ cd seo_position_tracker # dive inside the module folder
$ python main.py -h
$ poetry run seo -h
Available arugments
SerpApi SEO position tracker [-h] [-q] [-tk [...]] [-tw [...]] [-se [...]] [-ak] [-hl] [-gl] [-loc] [-d] [-st]
A simple Python CLI for SEO position tracking from Google, Baidu, Bing, DuckDuckGo, Yahoo, Yandex and Naver.
optional arguments:
-h, --help show this help message and exit
-q , --query Search query. Default "coffee".
-tk [ ...], --target-keywords [ ...]
Target keywords to track. Default "['coffee']".
-tw [ ...], --target-websites [ ...]
Target websites to track. Default "['starbucks.com']".
-se [ ...], --search-engine [ ...]
Choosing a search engine to track: "google", "baidu", "bing", "duckduckgo", "yahoo", "yandex", "naver". You can select multiple search engines. All search
engines are selected by default.
-ak , --api-key Your SerpApi API key: https://serpapi.com/manage-api-key. Default is a test API key to test CLI.
-hl , --lang Language of the search. Supported only for "google", "baidu", "yahoo" and "yandex" engines. Default "None". Find more by Googling: "SerpApi supported
<engine> languages"
-gl , --country Country of the search. Supported only for "google", "bing" and "yahoo" engines. Default "None". Find more by Googling: "SerpApi supported <engine>
countries"
-loc , --location Location of the search. Supported only for "google", "bing", "duckduckgo" and "yandex" engines. Default "None". Find more by Googling: "SerpApi supported
<engine> locations"
-d , --domain Search engine domain to use. Supported only for "google", "yahoo" and "yandex" engines. Default "None". Find more by Googling: "SerpApi supported <engine>
domains"
-st , --save-to Saves the results in the current directory in the selected format (CSV, JSON, TXT). Default CSV.
Found a bug? Open issue: https://github.com/dimitryzub/seo-position-tracker/issues
🤹♂️Examples
Extracting positions from all search engines for a given query with a target website and a target keyword:
$ poetry run seo --api-key=<your_serpapi_api_key> \
-q "minecraft" \
-tk official \
-tw minecraft.net
[
{
"engine": "google",
"position": 1,
"title": "Welcome to the Minecraft Official Site | Minecraft",
"link": "https://www.minecraft.net/en-us"
},
{
"engine": "bing",
"position": 1,
"title": "Minecraft - Official Site",
"link": "https://minecraft.net/"
},
{
"engine": "bing",
"position": 2,
"title": "Welcome to the Minecraft Official Site | Minecraft",
"link": "https://www.minecraft.net/en-us"
},
{
"engine": "bing",
"position": 10,
"title": "Minecraft Official Site | Minecraft Education",
"link": "https://education.minecraft.net/en-us"
},
{
"engine": "duckduckgo",
"position": 1,
"title": "Minecraft - Official Site",
"link": "https://minecraft.net/"
},
{
"engine": "duckduckgo",
"position": 2,
"title": "Welcome to the Minecraft Official Site | Minecraft",
"link": "https://www.minecraft.net/en-us"
},
{
"engine": "yahoo",
"position": 1,
"title": "Minecraft - Official Site",
"link": "https://minecraft.net/"
},
{
"engine": "yahoo",
"position": 2,
"title": "Welcome to the Minecraft Official Site | Minecraft",
"link": "https://www.minecraft.net/en-us"
},
{
"engine": "yandex",
"position": 2,
"title": "Welcome to the Minecraft Official Site | Minecraft",
"link": "https://www.minecraft.net/"
}
]
Extracting positions from 3 search engines with default arguments and saving to JSON:
$ poetry run seo --api-key=<your_serpapi_api_key> \
-se google bing duckduckgo \
-st JSON
[
{
"engine": "google",
"position": 6,
"title": "Starbucks Coffee Company",
"link": "https://www.starbucks.com/"
},
{
"engine": "bing",
"position": 12,
"title": "The Best Coffee from Starbucks Coffee: Starbucks Coffee Company",
"link": "https://www.starbucks.com/coffee/"
},
{
"engine": "duckduckgo",
"position": 11,
"title": "The Best Coffee from Starbucks Coffee: Starbucks Coffee Company",
"link": "https://www.starbucks.com/coffee/"
}
]
Extracting positions from one engine with all arguments for it:
$ poetry run seo --api-key=<your_serpapi_api_key> \
-q serpapi \
-tk serpapi \
-tw https://serpapi.com/ https://github.com/ \
-se google \
-hl de \
-gl de \
-loc Germany \
-d google.de \
-st TXT
[
{
"engine": "google",
"position": 1,
"title": "SerpApi: Google Search API",
"link": "https://serpapi.com/"
},
{
"engine": "google",
"position": 3,
"title": "SerpApi - GitHub",
"link": "https://github.com/serpapi"
}
]
Extracting positions from all search engines manually (without CLI):
from seo_position_tracker.seo_position_tracker import SeoPositionTracker
import json
tracker = SeoPositionTracker(
query='coffee',
api_key='<your_serpapi_api_key>',
keywords=['coffee', 'starbucks'],
websites=['starbucks.com']
)
position_data = []
google_results = tracker.scrape_google(lang='en', country='us', location='United States', domain='google.com')
position_data.extend(google_results)
baidu_results = tracker.scrape_baidu(lang='1')
position_data.extend(baidu_results)
bing_results = tracker.scrape_bing(country='us', location='United States')
position_data.extend(bing_results)
duckduckgo_results = tracker.scrape_duckduckgo(location='us-en')
position_data.extend(duckduckgo_results)
yahoo_results = tracker.scrape_yahoo(lang='lang_en', country='us', domain='uk')
position_data.extend(yahoo_results)
yandex_results = tracker.scrape_yandex(lang='en', domain='yandex.com')
position_data.extend(yandex_results)
naver_results = tracker.scrape_naver()
position_data.extend(naver_results)
print(json.dumps(position_data, indent=2, ensure_ascii=False))
💡Issues or suggestions
Visit issues page.
📜 Licence
SEO Position Tracker is released under the BSD-3-Clause Licence.
Metadata
Release files for seo-position-tracker 1.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| seo_position_tracker-1.5.1.tar.gz | 10.0 kB | Without provenance | Details for seo_position_tracker-1.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| seo_position_tracker-1.5.1-py3-none-any.whl | Python 3 | none | any | Details for seo_position_tracker-1.5.1-py3-none-any.whl |
Total release size: 19.8 kB
Release files / seo_position_tracker-1.5.1.tar.gz
| Download URL | seo_position_tracker-1.5.1.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3544804f357cb9bcae15b07825c05eace8201aadf89d3f6da74662f216912f4
|
|
BLAKE2b-256 checksum How to use checksums |
e0fc1932a594cfe4e9d3bf27ccb625804a64a26f1ee564cbab9d48cccc987af0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.0 Windows/10
|
Release files / seo_position_tracker-1.5.1-py3-none-any.whl
| Download URL | seo_position_tracker-1.5.1-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
71d73a9e3493546e2995737d98581c47eca7e56d3323e0ee33d0e1ada2f3ed04
|
|
BLAKE2b-256 checksum How to use checksums |
2b4b0745521230f4595c2e4eaa013d2de9377561f9df03b6ce3b40576912d00f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.0 Windows/10
|
Security for seo-position-tracker 1.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.