Skip to content

Instantly share code, notes, and snippets.

View ptalmeida's full-sized avatar
🆗

Pedro Almeida ptalmeida

🆗
View GitHub Profile
@davidtran0
davidtran0 / alexa-top-sites.py
Created September 23, 2015 05:29
Python script for web-scraping the Alexa.com top-ranked websites by country or globally
# -*- coding: utf-8 -*-
"""
Python script for web-scraping the Alexa.com top-ranked websites
by country or globally
@author: David Tran
"""
import datetime
import urllib2
@masnun
masnun / alexa.py
Created July 24, 2012 16:02
Python One-liner to get your site's Alexa Rank
#!/usr/bin/env python
import urllib, sys, bs4
print bs4.BeautifulSoup(urllib.urlopen("http://data.alexa.com/data?cli=10&dat=s&url="+ sys.argv[1]).read(), "xml").find("REACH")['RANK']