Skip to content Skip to sidebar Skip to footer

Most Popular Youtube Videos From Youtube API

I am trying to get popular YouTube videos data using python. While I can successfully download the data, I cannot store it or save it in csv format. Here is the code I used: # -*-

Solution 1:

NameError means that the variable response isn't in the context where you are running it. I don't know where you put that line in the code, but you call the videos_list_most_popular function which will not return any data.

The videos_list_most_popular returns the result of the print_response function. But since that function only prints the response, and not actually returns anything it will return None and then down below where you execute videos_list_most_popular the result will be None.

And it will also dissappear because you don't assign the result of that function to anything (which would look like: response = videos_list_most_popular(...)).

You will need to change videos_list_most_popular so it returns response and then assign that return value like I did above. Then you can execute the line you wrote.


Post a Comment for "Most Popular Youtube Videos From Youtube API"