April 4, 2022
How this project came about
I was on a quest for more knowledge in working with Python/Django. I really wanted to see how to incorporate other API's into my project. Also another area I wanted to explore a bit more was AJAX. I played with it a bit before but still did not have a solid grasp on it. This project was just an idea that incorporated those aspects. It is an app for holding your most esteemed youtube videos in a Hall of Fame for various categories.
About the app
This was a solo project I built following along a course. I built it on Python/Django. For authentication of users, I used the Django auth modules. Users would only have editing rights to their content. The YouTube API was used for getting the title of a video, and for searching for youtube videos directly from the app. One cool piece of functionality is when you search for a video it displays results right away without having to press enter. So you start typing and when you pause it does a quick search and displays the results automatically. That was done with AJAX.
Cool experience with this project
The youtube search functionality on this project was a neat new trick I learned. I wanted the search to show suggestions or results almost as soon as you type. To do that I incorporated AJAX. I would send the search text as AJAX to the back-end which would do a search query through the YouTube Data API. It would then send the results of the API call back to the front-end where I would display it.
To keep from maxing out my quota of API query calls to the YouTube Data API, I set a delay timer on the search text. This way it only does an API call only after the delay since the last typed character reaches a certain set delay time.
I eventually still hit the max quota for API calls. This would cause errors on the front end and would not load the page at all. I took care of that on the backend with the forms error handling provided by Django, for when it gets that particular error. This way I can continue using the free quota for the YouTube Data API.
Be the first to comment