teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

API、RSSについて追記

2019/02/20 01:27

投稿

firedfly
firedfly

スコア1133

answer CHANGED
@@ -17,5 +17,7 @@
17
17
  {"uri":"/2019/02/19/business/japan-companies-uk-economy/index.html","headline":"\u003cstrong>Japan Inc poured billions into Britain. Now it's having regrets\u003c/strong>","thumbnail":"//cdn.cnn.com/cnnnext/dam/assets/181128163340-london-waterloo-bridge-pedestrians-small-11.jpg","duration":"","description":"Japan's top companies are losing patience with the United Kingdom as Brexit fast\u003cstrong> \u003c/strong>approaches. ","layout":""}
18
18
  ```
19
19
 
20
- これでは`soup.find()`で見つからない訳ですね。
20
+ これでは`soup.find()`で見つからない訳ですね。ヒントになれば幸いです。
21
+
22
+ なおCNNは[CNN API](https://newsapi.org/s/cnn-api)や[RSS](http://edition.cnn.com/services/rss/)も公開しています。
21
- ヒンれば幸いです。
23
+ 記事タイルとURLらこちらから取得るのもいいかもしれません

1

補足

2019/02/20 01:27

投稿

firedfly
firedfly

スコア1133

answer CHANGED
@@ -1,6 +1,6 @@
1
1
  こんにちは。
2
2
  下のようなコードで取得したHTMLをテキスト出力してみると、
3
- ニュース部分はJSONで返して、ブラウザ側で動的に生成しているようです。
3
+ ニュース部分はJSONで返して、ブラウザ側で動的にHTMLを生成しているようです。
4
4
 
5
5
  ```Python
6
6
  from bs4 import BeautifulSoup