Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

youtube api "invallid filter parameter" error when requesting on large amount of videos

$
0
0

I am attempting to extract some data from all videos on a youtube channel (2055 videos). I have stored each video ID in video_ids[] and am sending a request for data regarding all 2055 in the following code:

all_video_data = []request = youtube.videos().list(        part="snippet,contentDetails,statistics",        id=video_ids    )response = request.execute()for video in response['items']:    data_keep = {'snippet': ['channelTitle', 'title', 'publishedAt'],'statistics': ['viewCount', 'likeCount', 'commentCount'],'contentDetails': ['duration']                }    video_data = {}    video_data['video_id'] = video['id']    for k in data_keep.keys():        for v in data_keep[k]:            video_data[v] = video[k][v]    all_video_data.append(video_data)

ERROR:

HttpError                                 Traceback (most recent call last)Cell In[36], line 7      1 all_video_data = []      3 request = youtube.videos().list(      4         part="snippet,contentDetails,statistics",      5         id=video_ids[0:999]      6     )----> 7 response = request.execute()      9 for video in response['items']:     10     data_keep = {'snippet': ['channelTitle', 'title', 'publishedAt'],     11                  'statistics': ['viewCount', 'likeCount', 'commentCount'],     12                  'contentDetails': ['duration']     13                 }File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\googleapiclient\_helpers.py:130, in positional.<locals>.positional_decorator.<locals>.positional_wrapper(*args, **kwargs)    128     elif positional_parameters_enforcement == POSITIONAL_WARNING:    129         logger.warning(message)--> 130 return wrapped(*args, **kwargs)File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\googleapiclient\http.py:938, in HttpRequest.execute(self, http, num_retries)    936     callback(resp)    937 if resp.status >= 300:--> 938     raise HttpError(resp, content, uri=self.uri)    939 return self.postproc(resp, content)HttpError: <HttpError 400 when requesting https://youtube.googleapis.com/youtube/v3/videos returned "The request specifies an invalid filter parameter.". Details: "[{'message': 'The request specifies an invalid filter parameter.', 'domain': 'youtube.parameter', 'reason': 'invalidFilters', 'location': 'parameters.', 'locationType': 'other'}]">

I'm aware that the error is in my request, not sure how to fix.

tried moving around variables/names, tried doing a separate request for each video (awful), tried banging my head against a wall.


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>