googleトレンドでpythonの学習をしているのですが、
エラー :approx_traffic' pseudo-class is not implemented at this time
が出てしまいうまくいきません。
調べてみるとコロン:がクラスと判断しているようなのですが、回避方法はありませんでしょうか?
import requests from bs4 import BeautifulSoup import time rss = 'https://trends.google.co.jp/trends/trendingsearches/daily/rss?geo=JP' result = requests.get(rss) soup = BeautifulSoup(result.text, 'xml') search_scores = soup.select('ht:approx_traffic')
以下googleトレンドのサンプル一部コード
<item> <title>日向坂46</title> <ht:approx_traffic>20,000+</ht:approx_traffic> <description/> <link>https://trends.google.co.jp/trends/trendingsearches/daily?geo=JP#%E6%97%A5%E5%90%91%E5%9D%8246</link> <pubDate>Mon, 07 Mar 2022 16:00:00 +0900</pubDate> <ht:picture>https://t3.gstatic.com/images?q=tbn:ANd9GcQvt_DHXpxYd_2AmgVGlbbx7x1KZ6FxUjheob4XvSzG7bCjsgiTNOcDPcryPOfekXNSWCc7ZSFK</ht:picture> <ht:picture_source>Yahoo!ニュース</ht:picture_source> <ht:news_item> <ht:news_item_title>日向坂46、新メンバーオーディション開催「人生は1回しかないです ...</ht:news_item_title> <ht:news_item_snippet>アイドルグループ「日向坂46」が新たなメンバーを募集する、「日向坂46 新メンバーオーディション」の開催を決定したと発表した。新メンバーオーディションを開催する ...</ht:news_item_snippet> <ht:news_item_url>https://news.yahoo.co.jp/articles/c17d8146644ad3191fa09caa5b90fb0679e1e384</ht:news_item_url> <ht:news_item_source>Yahoo!ニュース</ht:news_item_source> </ht:news_item> <ht:news_item> <ht:news_item_title>日向坂46、新メンバーオーディション開催 佐々木久美「待ってい ...</ht:news_item_title> <ht:news_item_snippet>アイドルグループ・日向坂46が、約4年ぶりに新たなメンバーを募集する「日向坂46 新メンバーオーディション」を開催することが決定し、7日から応募受付を開始した。</ht:news_item_snippet> <ht:news_item_url>https://news.mynavi.jp/article/20220307-2287009/</ht:news_item_url> <ht:news_item_source>マイナビニュース</ht:news_item_source> </ht:news_item> </item>
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/03/07 12:47
2022/03/07 12:50