1
我正在使用Python 3.5的Web爬虫。使用请求和Beautifulsoup4。我正在尝试获取论坛第一页上所有主题的链接。并将它们添加到列表中。Beautifulsoup4不返回页面上的所有链接
我有2个问题:
1)不知道如何使用beautifulsoup获得链接,我无法获得在链接本身,只是在div 2)看来,Beautifulsoup将返回只有少数主题,而不是全部。
def getTopics():
topics = []
url = 'http://forum.jogos.uol.com.br/pc_f_40'
source_code = requests.get(url)
plain_text = source_code.text
soup = BeautifulSoup(plain_text, 'html.parser')
for link in soup.select('[class="topicos"]'):
a = link.find_all('a href')
print (a)
getTopics()