- self.api_key = "key"
- virtualenv venv
- source ./venv/bin/activate
- pip install -r requirements.txt
- python index.py
- post localhost:8090/youtube_data
{
"topics": ["nba"],
"filters":{
"likes": "most"
}
}
- response ex
["https://www.youtube.com/watch?v=KNHh60elNlY"]
- post localhost:8090/youtube_data
{
"topics": ["nba", "nfl"],
"filters":{
"likes": "most"
}
}
- response ex
[
"https://www.youtube.com/watch?v=G8KkSDY0kTk",
"https://www.youtube.com/watch?v=8iEu2UGC9mA"
]
import youtube_data from "location of youtube_data"
youtube_data - Youtube_data();
# get a search url for a topic
url = self.youtube_data.get_search_url({"topic":"nba"})
# more options used ex
url = self.youtube_data.get_search_url({
"topic":"nfl",
"videoDuration": "any",
"order": "relevance",
"maxResults":1})
# get video url from video id
url = self.youtube_data.get_video_info_url("sG4lZU1iPpE")
# get video ids from json search result
ids = self.youtube_data.get_search_ids(info)
# get array of videoids info
info = self.youtube_data.get_videos_info(['sG4lZU1iPpE', 'MVQWfur6-qk'])
# sorting with most likes
rank = self.youtube_data.sort("likes", "most", info);
# look at ./src/test_youtube_data.py