How can I get results from my list?
Closed this issue · 1 comments
Jsgithubchannel commented
Hello, I'm trying to get a dictionary from my list.
I have a list like this:
data = ['cats', 'rabbits', 'dogs', ...]
I want to get Youtube results for each element (such as a video about cats, rabbits, and dogs).
However, my code only returns videos of the last element.
for elem in data:
videosSearch = YoutubeSearch(elem).to_dict()
Jsgithubchannel commented
I solved the problem.
videoSearchList = []
for topic in topics:
print(type(topic), topic)
videoSearchList.append(YoutubeSearch(topic, max_results=1).to_dict())