0
我想抓取本網站上所有論壇帖子的所有主題標題。我不知道如何去做這件事,因爲論壇網站的html格式並不是我所熟悉的。
從urllib.request裏進口的urlopen從BS4進口BeautifulSoup uReq 湯如何使用BeautifulSoup進行網頁掃描
my_url = 'http://thailove.net/bbs/board.php?bo_table=ent'
uClient = uReq(my_url)
page_html = uClient.read()
uClient.close()
page_soup = soup(page_html, "html.parser")
#I don't think this is correct, but not sure on how else to to do this...
containers = page_soup.findAll("td",{"class":"td_subject"})
for container in containers:
subject = container.a.font.font.contents
同樣不知道這是正確的
print("subject: ", subject)
請讓我知道我應該做的。另外請記住,該網站是韓文網站,如果需要可以很容易翻譯成英文。提前致謝。
謝謝你的幫助。這似乎解決了我的問題。如果你不介意,你是否也知道如何能夠在論壇中抓取所有頁面?我嘗試在網上查找,找不到合適的解決方案。 –
你可以嘗試/尋找遍歷'''href「]內容的內容 –