Create YouTube Video Search Engine with jQuery


This code snippet I found on codepen and found it interesting so sharing it with my readers, It’s a simple jQuery script help you to search videos on YouTube you can search any video on YouTube publicly available. It’s a very simple and easy to configure jQuery snippet let’s make YouTube search engine site with jQuery.


First of all you need to create Google Project to get API Key.

Click here to create project.


Select Project.



Search YouTube data API Service and enable it.



Now Generate API Key.

Finaly we got API Key now move to Coding.

Include some files like jQuery, Bootstrap, FancyBox and some scripts.

HTML Search Form:

Above HTML show search form and results and buttons div.

Now Add JavaScript Main code: ADD_YOUR_API_KEY_HERE replace your API Key with this.

Above JavaScript do all works Request API’s and fetch data from YouTube ADD_YOUR_API_KEY_HERE replace your API Key.

searchYoutube() This function search all videos for given key

nextPage() Show next page of current result

prevPage() Show previous page of current result

getOutput(item) this function generate output data on given values.

getButtons(prevPageToken, nextPageToken) create buttons next and previous

Some CSS styles to make output looks good:

This CSS will add some beautification to results and search form.

That’s all.

I hope you like this tutorial plese share your feedback in comments and if you face any issue please comment below.


Social Media Auto Publish Powered By :