l********a 发帖数: 1154 | 3 可以抓任意版面,任意多层(下页)
修改main函数的url和layer即可
#! usr/bin/env python
from urllib import urlopen
from urllib import urlopen
from BeautifulSoup import BeautifulSoup
import re
def fetchPage(page,urlBase):
# get current page
soup = BeautifulSoup(page)
# get all title and links
dicList = {}
for header in soup('strong'):
links = header('a','news1')
if not links: continue
dicList[links[0].string] = links[0]['href']
# display results
for key,value in di |