Skip to content

Instantly share code, notes, and snippets.

@homleen
Created December 2, 2013 10:43
Show Gist options
  • Save homleen/7747787 to your computer and use it in GitHub Desktop.
Save homleen/7747787 to your computer and use it in GitHub Desktop.
豌豆荚 TOP 排行
# encoding=utf8
import urllib2
from bs4 import BeautifulSoup
url = 'http://www.wandoujia.com/top'
opener = urllib2.build_opener()
content = opener.open(url).read()
dom = BeautifulSoup(content)
app_lists = dom.find_all("div", class_='app-rank')
for ndx, list in enumerate(app_lists):
print('----------')
print list.find('h2').string
print('----------')
apps = list.find_all('span', class_='txt')
for app in apps:
print app.string
print ('')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment