我试图构建一个爬虫,我想打印 我使用Python 3.5Python的类型错误回溯(最近通话最后一个)
在该网页上的所有链接有我的代码
import requests
from bs4 import BeautifulSoup
def crawler(link):
source_code = requests.get(link)
source_code_string = str(source_code)
source_code_soup = BeautifulSoup(source_code_string,'lxml')
for item in source_code_soup.findAll("a"):
title = item.string
print(title)
crawler("https://www.youtube.com/watch?v=pLHejmLB16o")
但我得到这样
TypeError Traceback (most recent call last)
<ipython-input-13-9aa10c5a03ef> in <module>()
----> 1 crawler('http://archive.is/DPG9M')
TypeError: 'module' object is not callable
收到这个错误你尝试过重命名你的'crawler'方法? –
是的,我把“crawler”改成了“cat”,但是还是一样的错误 – Travis