Я написал ниже программу на python для очень простого веб-краулера, но когда я запускаю ее, она возвращает мне объект «NoneType», который нельзя вызывать, не могли бы вы мне помочь?
import BeautifulSoup
import urllib2
def union(p,q):
for e in q:
if e not in p:
p.append(e)
def crawler(SeedUrl):
tocrawl=[SeedUrl]
crawled=[]
while tocrawl:
page=tocrawl.pop()
pagesource=urllib2.urlopen(page)
s=pagesource.read()
soup=BeautifulSoup.BeautifulSoup(s)
links=soup('a')
if page not in crawled:
union(tocrawl,links)
crawled.append(page)
return crawled
crawler('http://www.princeton.edu/main/')
None. - person Blckknght   schedule 01.12.2012