Created
June 21, 2021 10:41
-
-
Save dimitryzub/ae33c615906c4d3650e72c4682b87173 to your computer and use it in GitHub Desktop.
youtube_serpapi_get_category_results
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from serpapi import GoogleSearch | |
def get_category_results(): | |
params = { | |
"api_key": "YOR_API_KEY", | |
"engine": "youtube", | |
"search_query": "mojang" | |
} | |
search = GoogleSearch(params) | |
results = search.get_dict() | |
for result in results['latest_from_minecraft']: | |
title = result['title'] | |
link = result['link'] | |
channel = result['channel'] | |
published_date = result['published_date'] | |
views = result['views'] | |
extensions = result['extensions'] | |
print(f'{title}\n{link}\n{channel}\n{published_date}\n{views}\n{extensions}\n') | |
get_category_results() | |
# part of the output: | |
''' | |
Ask Mojang #18: More Mobs! | |
https://www.youtube.com/watch?v=miKrxo3uaXU | |
{'name': 'Minecraft', 'link': 'https://www.youtube.com/user/TeamMojang', 'verified': True, 'thumbnail': 'https://yt3.ggpht.com/KYt9rfP_fcswzs2RzvossPvKHOcP7W2gWFylRpAskW7IadpfgUgUrhttiYGtLs-P-LufgXpuc9E=s68-c-k-c0x00ffffff-no-rj'} | |
2 days ago | |
574573 | |
['New', 'CC'] | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment