WEB検索もPythonで
YouTubeの検索は
import requests from bs4 import BeautifulSoup as bs key = input("word:") res = requests.get(f"https://www.youtube.com/results?search_query={key}",timeout=(3.0,7.0)) res=res.text.split('// scraper_data_begin\nvar ytInitialData = ')[1].split('; \n// scraper_data_end')[0]
でいける,けど,どうやったらURLだけとれるのか,まだ...
検索サイトなら,
res = requests.get(f"https://duckduckgo.com/?q={key}",timeout=(3.0,7.0))
res = requests.get(f"https://www.bing.com/search?q={key}",timeout=(3.0,7.0))
でイケルかと.
至極簡単なことです.