0

たとえば、この URL ( https://edition.cnn.com/search/?q=%20news&size=10&from=5540&page=555 )

HTMLファイルでは、このリンク(htmlタグ)を見つけることができます

<div class="cnn-search__result-thumbnail">         
     <a href="https://www.cnn.com/2018/03/27/asia/north-korea-kim-jong-un-china-visit/index.html">
  <img src="./Search CNN - Videos, Pictures, and News - 
    CNN.com_files/180328104116china-xi-kim-story-body.jpg">
 </a>

しかし、このコードでは

    cnn_paper = newspaper.build(url, memoize_articles=False)
     for article in cnn_paper.articles:
          print(article.url) 

ニュースのリンクが見つかりません

https://edition.cnn.com/search/?q=%20news&size=10&from=5540&page=555 https://edition.cnn.com/search/?q=%20news&size=10&from=5550&page=556

同じリンクを取得

4

2 に答える 2