YouTube Search API - Pure JavaScript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

YouTube Search API - Pure JavaScript

I would like to search YouTube videos by entering keywords via input field using pure JavaScript, but I am unable to do that as I have no idea regarding $.get (line 57) and $.each (line 65) alternate in pure JavaScript. Here is my code https://code.sololearn.com/WOyC0Sus4HFn/#html I will appreciate any help in this matter. Thanks

14th May 2018, 12:10 PM
Farhan Farooq
Farhan Farooq - avatar
1 Answer
+ 5
I was able to write it in vanilla JavaScript, I've attached the code with comments 😊 The vanilla JS equivalent of the $.each jQuery method I've used is forEach() And the real equivalent of the $.get method would be XMLHttpRequest(), but I didn't use it because I've followed YouTube's documentation as my guide, where the JavaScript Client Library is used and the Search List API call. Reference: https://developers.google.com/youtube/v3/docs/search/list?hl=es-419 Hope this was what you were looking for 😊 https://code.sololearn.com/Wb6ThOouklVz/?ref=app
19th May 2018, 11:37 AM
Pao
Pao - avatar