Log the total number of snippets retrieved.
This commit is contained in:
parent
7ec78da0a4
commit
8821491ff3
1 changed files with 3 additions and 0 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue