Skip to content

Instantly share code, notes, and snippets.

@sunwicked
Created July 26, 2020 11:53
Show Gist options
  • Save sunwicked/433be8268abf65cba22febd1f80d1b6c to your computer and use it in GitHub Desktop.
Save sunwicked/433be8268abf65cba22febd1f80d1b6c to your computer and use it in GitHub Desktop.
Scrape Country rank from alexa for a site
import requests
from bs4 import BeautifulSoup
URL = 'https://alexa.com/siteinfo/theayurveda.org'
page = requests.get(URL)
soup = BeautifulSoup(page.content, 'html.parser')
results = soup.find_all('span', class_='pull-right')
for result in results:
if '#' in result.text.strip():
print(result.text.strip())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment