0
def get_data(key, region, *ids):
url = "https://www.googleapis.com/youtube/v3/videos?part=snippet&id={ids}&key={api_key}"
r = requests.get(url.format(ids=",".join(ids), api_key=key))
js = r.json()
items = js["items"]
cat_js = requests.get("https://www.googleapis.com/youtube/v3/videoCategories?part=snippet®ionCode={}&key={}".format(region,
key)).json()
categories = {d['id']: d["snippet"]['title'] for d in cat_js["items"]}
for item in items:
yield item["snippet"]["title"], categories[item["snippet"]["categoryId"]]
위의 기능을 사용하여 YouTube 카테고리 및 비디오 이름을 가져 왔습니다. 팝, 록, 하우스 등 뮤직 비디오의 장르를 얻는 방법이 있습니까? 도와주세요!YouTube에서 장르 가져 오기
답 답해 주셔서 감사합니다. 하지만 YouTube에 장르 필드도 포함되어 있지 않습니까? 내 홈페이지에 장르별로 노래 목록을 보았던 것을 기억합니다. – Blabber
유튜브 API가 제공 할 수 있다면, 그렇게 많이 긁어 모으지 않을 것입니다. – Blabber
[여기] (https://developers.google.com/youtube/2.0/developers_guide_protocol_category_keyword_browsing), [여기] (http://stackoverflow.com/questions/17698040/youtube-api-v3-where-cani-i- find-a-list-of-each-videocategoryid) 및 [here] (http://stackoverflow.com/questions/6453917/get-the-music-genres-in-youtube) Google에서 찾은 내용 - In 어떤 문제가 발생 했습니까? 내 질문에 오해 한 것 같습니다. –