A Python script to fetch the top sites from for a particular country. It uses AWS Alexa Top Sites Service, so you have to register an AWS account before using.
- Python 2 or Python 3
- Needed libraries can be installed by the following command
pip install -r requirements.txt
./ats.py -country US -count 1000 -secret xxx -key xxx [-start 10]
Where:
country
: should be the 2 character ISO_3166-1 stylecount
: the number of top sites to fetchsecret
: secret access key from your AWS accountkey
: access key id from your AWS accountstart
(optional): the website ranking you want to get started, the default is 1
Results will be:
- printed to the screen with format:
Ranking Domain
- saved to a json file (top_alexa.json) with format
{"1": "google.com", ...}
-
Sign up for an Amazon AWS account at https://aws.amazon.com/.
-
Create a Customer Managed Policy
-
Select the JSON tab in the Policy Editor
-
If the following message box appears, you may safely close it.
-
Paste the following in the editor window.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "AlexaTopSites:GET" ], "Resource": [ "*" ] } ] }
-
Click Review Policy. In the Review Policy window, assign a Name to the policy and Click Create Policy.
-
The following warning message can be safely ignored.
-
-
Assign the previous execution policy for the service to the user created above.
-
Get the IAM access keys from the IAM user management console page of the Amazon AWS portal.
[1] https://docs.aws.amazon.com/AlexaTopSites/latest/
[2] https://aws.amazon.com/alexa-top-sites/
[3] https://secaholic.com/a-python-script-get-alexa-top-sites-4652768dfa96