看板 Python 關於我們 聯絡資訊
※ 引述《kakar0to (Poker Face)》之銘言: : 請問有人會爬神秘金字塔的網頁嗎? : 例如下面這個頁面 : https://norway.twsthr.info/StockHolders.aspx?stock=0050 : 我想把這些資訊爬出來 : 20191025 703,000 89,452 7.86 450,780 64.12 75 20 5 5 45 61.57 88.80 : 20191018 753,500 90,255 8.35 498,135 66.11 72 16 5 5 46 64.01 87.95 : ... : 我觀察網頁原始碼, 這些資訊大概在這兩種標籤的<td>裡面. : <tr class='lDS'> 與 <tr class='lLS'> : 不過我用beautifulSoup 去撈<tr class='lDS'>這個tag, : 似乎也會撈到<tr class='lLS'>這個tag裡面的<td>的資訊 : code如下, : soup = BeautifulSoup(respStr,'html.parser') : tr_list = soup.find_all('tr') : for idx,tr in enumerate(tr_list): : if tr.get('class') == ['lDS']: : td_list = tr.find_all('td') : for idx2,td in enumerate(td_list): : print(td.text) : 想問是不是有可能beautifulSoup有機會parse錯誤? : 如果是的話 有大大知道怎麼解決這個問題嗎? : 或者給我個建議 可以用什麼其他的方式把這些資訊爬出來? : 感謝. 其實不用去金字塔爬,有現成的 SQLite 可以抓 或是自己養爬蟲到集保抓也可以 到 GitHub 看 twnews 可以得到一些資訊 程式碼 https://github.com/virus-warnning/twnews 資料載點 http://tacosync.com/archive/ ----- Sent from JPTT on my Motorola one. -- 世界越快 心則慢 網路越慢 心則快 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.163.160.168 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1572370799.A.B59.html ※ 編輯: tacovirus (61.222.33.34 臺灣), 10/30/2019 08:40:36