Skip to content

Instantly share code, notes, and snippets.

@cereme
Created June 29, 2019 11:49
Show Gist options
  • Save cereme/9129128b0f14ad11d54b03c4f11c8369 to your computer and use it in GitHub Desktop.
Save cereme/9129128b0f14ad11d54b03c4f11c8369 to your computer and use it in GitHub Desktop.
youtube api get assignable categories
const your_api_key = "";
const region_code = "kr";
fetch(`https://www.googleapis.com/youtube/v3/videoCategories?part=snippet&regionCode=${region_code}&key=${your_api_key}`,{method:'get'})
.then(res=>res.json())
.then(res=>res.items.filter(e=>e.snippet.assignable).forEach(e=>console.log(e.id, e.snippet.title)));
/*
1 Film & Animation
2 Autos & Vehicles
10 Music
15 Pets & Animals
17 Sports
19 Travel & Events
20 Gaming
22 People & Blogs
23 Comedy
24 Entertainment
25 News & Politics
26 Howto & Style
27 Education
28 Science & Technology
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment