123456789101112131415161718192021222324252627282930313233 |
- """A function for each service to download the video thumbnail
- Each function should accept one argument (the video id from that service) and should return the download URL for the video's thumbnail.
- """
- """
- LIBRARIES
- """
- import urllib
- import json
- """
- END OF LIBRARIES
- """
- def generate_thumbnail_download_link_youtube(video_id_from_shortcode):
- """Thumbnail URL generator for YouTube videos."""
-
- thumbnail_download_link="https://img.youtube.com/vi/" + video_id_from_shortcode + "/0.jpg"
- return thumbnail_download_link
- def generate_thumbnail_download_link_vimeo(video_id_from_shortcode):
- """Thumbnail URL generator for Vimeo videos."""
-
-
- video_metadata = urllib.urlopen("https://vimeo.com/api/v2/video/" + video_id_from_shortcode + ".json")
- video_metadata_parsed = json.load(video_metadata)
- video_thumbnail_large_location = video_metadata_parsed[0]['thumbnail_large']
- return video_thumbnail_large_location
|