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()