它似乎没有超过第一页。怎么了?此外,如果您要查找的单词在链接中,它不会提供正确的出现,它将显示 5 个输出,其中 5 个作为出现
import requests from bs4 import BeautifulSoup
for i in range (1,5):
url = 'https://www.nairaland.com/search/ipob/0/0/0/{}'.format(i)
the_word = 'is'
r = requests.get(url, allow_redirects=False)
soup = BeautifulSoup(r.content, 'lxml')
words = soup.find(text=lambda text: text and the_word in text)
print(words)
count = len(words)
print('\nUrl: {}\ncontains {} occurrences of word: {}'.format(url, count, the_word))
FFIVE
浮云间
慕莱坞森
侃侃无极
随时随地看视频慕课网APP
相关分类