For list action, video may not have localizations · coder92/api-samples@9e0a102 · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

Commit 9e0a102

Browse files
For list action, video may not have localizations
1 parent f1b9f38 commit 9e0a102

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

python/video_localizations.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,14 @@ def list_video_localizations(youtube, args):
129129
id=args.video_id
130130
).execute()
131131

132-
localizations = results['items'][0]['localizations']
133-
134-
for language, localization in localizations.iteritems():
135-
print ('Video title is \'%s\' and description is \'%s\' in language \'%s\''
136-
% (localization['title'], localization['description'], language))
137-
132+
if 'localizations' in results['items'][0]:
133+
localizations = results['items'][0]['localizations']
134+
135+
for language, localization in localizations.iteritems():
136+
print ('Video title is \'%s\' and description is \'%s\' in language \'%s\''
137+
% (localization['title'], localization['description'], language))
138+
else:
139+
print 'There aren\'t any localizations for this video yet.'
138140

139141
if __name__ == '__main__':
140142
parser = argparse.ArgumentParser()

0 commit comments

Comments
 (0)

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.