めんどうな作業を自動化するために、試しにSeleniumで
Googleロゴが取得できるか実験してみた。
Googleトレンドでネタ探しできたら便利だしね。

Selenium (ソフトウェア)については下記をご参照ください。
https://ja.wikipedia.org/wiki/Selenium_(%E3%82%BD%E3%83%95%E3%83%88%E3%82%A6%E3%82%A7%E3%82%A2)

Jupyter Notebookで実行

from selenium import webdriver
from time import sleep

browser = webdriver.Chrome('chromedriver.exe')
url = 'https://www.google.co.jp'
browser.get(url)

img_elem = browser.find_element_by_class_name('lnXdpd')
with open(f"out.png", 'wb') as f:
    f.write(img_elem.screenshot_as_png)

画像が取得できた。

twitterもスクレイピングしようとしたが、
サービス利用規約で禁止されていた。

https://twitter.com/ja/tos/previous/version_7

今日は以上です。
ご視聴ありがとうございました。