作者lovex (L O V E X)
看板Python
標題[問題] 新手請教爬蟲
時間Tue Sep 1 17:26:32 2020
新手學習爬蟲中~
請問如以下的學校公告欄
http://www.cshs.kh.edu.tw/post/book.asp
soup = BeautifulSoup(html, 'html.parser')
for link in soup.find_all(href=re.compile("view")):
print(link.get('href'))
這樣可以抓到內文實際的連結,但不知如何抓細節
主要想抓整個table把新的資料寫入sql db, 不知道怎麼抓好呢?
(因為它的table都沒有id 或 class之類的~)
(新增資料--這會搭配Windows每日執行task)
謝謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.192.193.194 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1598952395.A.09E.html
→ panex0845: 整個表格也沒幾行 把網頁抓下來做字串分析就行了 09/01 19:44
→ chickengod: 有 table 的話 用 soup 抓出 table 餵給 pandas 09/01 20:11
→ chickengod: 不過這網頁有 RSS 的話 直接用 feedparser 09/01 20:12
→ chickengod: 就不需要自己處理網頁 09/01 20:12