A quick client to use Auhtoritas SERPs API in Python.
Have a look here: https://www.authoritas.com/keyword-ranking-api/.
These scripts have been tested with Python 3.7.0
I recommend using pyenv or any other virtual environment manager.
To install dependencies, simply run:
pip install -r requirements.txt
Two steps:
- send queries to the API
- ask for results
Using the send_queries.py
script, you'll be able to send your list of queries to Authoritas SERPs API quite simply.
Put your queries into a simple text file (one query per line) and use this command:
python send_queries.py --input your_queries.txt
Each query will be sent to the API and the corresponding job id will be saved into a CSV file.
The script offers multiple options:
-i
or--input
: the mandatory input file (one query per line)-o
or--output
: a basename to create your output file (default:queries
)--sep
: output CSV separator (default is ";")-n
or--nb_res
: number of results to fetch (default: 10)-s
or--search_engine
the search engine to use (choose betweengoogle
,bing
,yahoo
,yandex
andbaidu
, default isgoogle
)-r
or--region
: the search engine region (choose betweenglobal
,fr
,gb
,us
ores
, default isglobal
)-l
or--language
: the search engine language (choose betweenen
,fr
ores
, default isen
)-u
or--user_agent
: the type of device to use (choose betweenpc
,mac
,tablet
,ipad
,iphone
andmobile
, default ispc
)--no_cache
: to force the API not to use cached results (default: False)-d
or--delay
: the delay in seconds between requests (default: 2)
Use the get_results.py
script to fetch results from jobs:
python get_results.py --input job_ids.csv
The script will fetch results for each jid
and save SEO results to a CSV file, containing for each result in a SERP:
- the query,
- the job id,
- the job status,
- the result position,
- the page,
- the url,
- the result title.
Other data is available through the API, check the docs for more details.
Here is a list of available script options:
-i
or--input
: a CSV file containing aquery
and ajid
columns (usingsend_queries.py
output is easiest)--input_sep
: specify an input CSV separator (default is ";")-o
or--output
: a basename to create your output file (default isresults
)--sep
: output CSV separator (default is ";")-d
or--delay
the delay in seconds between requests (default: 2)
If you wish to contribute to this repository or to report an issue, please do this on GitLab.