[問題] 爬新聞html5抓不到內文
想請教版上的專家,有先搜尋資料了,但還是爬不了新聞內文,故想請教
目前想要把新聞內文爬進來
https://reading.udn.com/read/story/122749/6680114
網頁程式如下
https://i.imgur.com/eYufIAY.png
目前程式到這一步卡住,一直抓不到內文,故要請教各位專家該怎麼調整
,謝謝。
for a in soup.select('div.story-list__news div.story-list__text h2 a '):
list_news.append(a['href'])
print (list_news)
for index, link in enumerate(list_news):
res = req.get(link)
soup_ = bs(res.text, "lxml")
print(soup_.select_one('article.article-content
div.article-content__paragraph section.article-content__editor
div.inline-ads ').get_text())
print("=" * 50)
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.169.5.62 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1665843542.A.E60.html
噓
10/15 22:36,
1年前
, 1F
10/15 22:36, 1F
→
10/15 22:36,
1年前
, 2F
10/15 22:36, 2F
※ 編輯: jasonfun44 (118.169.5.62 臺灣), 10/15/2022 22:51:50
→
10/15 22:53,
1年前
, 3F
10/15 22:53, 3F
→
10/16 00:10,
1年前
, 4F
10/16 00:10, 4F
→
10/16 00:21,
1年前
, 5F
10/16 00:21, 5F
→
10/16 00:44,
1年前
, 6F
10/16 00:44, 6F
→
10/16 00:44,
1年前
, 7F
10/16 00:44, 7F
→
10/16 13:13,
1年前
, 8F
10/16 13:13, 8F
Python 近期熱門文章
PTT數位生活區 即時熱門文章
-14
25