楼主:
iftrush (绫绢姊)
2018-07-17 10:11:56小弟爬虫新手
目前正在爬字典(已成功用网页API爬出意思)
假如我想爬apple(不使用API)
从page source里知道意思在下面程式码的content里
<meta name="twitter:description" content=" "/>
我要如何用findall 或是 find 找到这句
然后print出content的" "里的意思?
自己写的程式码
from urllib.request import urlopen
from bs4 import BeautifulSoup
def DictRequest(word):
html = urlopen("https://www.merriam-webster.com/dictionary/"+ word)
bsobj = BeautifulSoup(html.read(), 'html')
meaning = bsobj.findAll('meta', name = 'twitter:description')
TypeError: find_all() got multiple values for argument 'name'