Log the total number of snippets retrieved.

This commit is contained in:
voussoir 2021-10-25 14:00:12 -07:00
parent 7ec78da0a4
commit 8821491ff3
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -128,6 +128,7 @@ class Youtube:
def get_videos(self, video_ids): def get_videos(self, video_ids):
chunks = gentools.chunk_generator(video_ids, 50) chunks = gentools.chunk_generator(video_ids, 50)
total_snippets = 0
for chunk in chunks: for chunk in chunks:
self.log.debug('Requesting batch of %d video ids.', len(chunk)) self.log.debug('Requesting batch of %d video ids.', len(chunk))
self.log.loud(chunk) self.log.loud(chunk)
@ -138,6 +139,7 @@ class Youtube:
).execute() ).execute()
snippets = data['items'] snippets = data['items']
self.log.debug('Got %d snippets.', len(snippets)) self.log.debug('Got %d snippets.', len(snippets))
total_snippets += len(snippets)
self.log.loud(snippets) self.log.loud(snippets)
for snippet in snippets: for snippet in snippets:
try: try:
@ -145,3 +147,4 @@ class Youtube:
yield video yield video
except KeyError as exc: except KeyError as exc:
self.log.warning(f'KEYERROR: {exc} not in {snippet}') self.log.warning(f'KEYERROR: {exc} not in {snippet}')
self.log.debug('Finished getting a total of %d snippets.', total_snippets)