from googleapiclient.discovery import buildfrom datetime import datetime, timedelta# Installing the API key and creating an instance of the youtube objectapi_key = "***"youtube = build('youtube', 'v3', developerKey=api_key)# Channel search functiondef search_channels(query, min_subscriber_count=0, published_after=None): # Defining request parameters query_params = {'q': query,'type': 'channel','part': 'id,snippet','maxResults': 10,'order': 'relevance' } # Adding filtering parameters if min_subscriber_count > 0: query_params['minSubscriberCount'] = min_subscriber_count if published_after is not None: query_params['publishedAfter'] = published_after # Request execution request = youtube.search().list(**query_params) response = request.execute() channels = [] # Processing of results for item in response['items']: channel = {'id': item['id']['channelId'],'title': item['snippet']['title'],'description': item['snippet']['description'],'published_at': item['snippet']['publishedAt'],'thumbnail': item['snippet']['thumbnails']['default']['url'],'subscriber_count': 0 } # Getting information about the number of subscribers statistics = youtube.channels().list( part='statistics', id=channel['id'] ).execute() if statistics['items']: channel['subscriber_count'] = int(statistics['items'][0]['statistics']['subscriberCount']) channels.append(channel) return channels# Example of using the function search_channelssix_months_ago = (datetime.utcnow() - timedelta(days=180)).strftime('%Y-%m-%dT%H:%M:%SZ')channels = search_channels('python', min_subscriber_count=50000, published_after=six_months_ago)for channel in channels: print(f"{channel['title']} ({channel['subscriber_count']} subscribers)")
Issues an oibc: File "C:\Users\Puzyrin\PycharmProjects\pythonProject1\venv\Lib\site-packages\googleapiclient\discovery.py " , line 1048, in the raise TypeError method("An unexpected argument of the keyword {}" was received.format(name)) TypeError: An unexpected argument of the minSubscriberCount keyword was received
Please help with the names in the API.