Last active
May 17, 2024 01:59
-
-
Save remitamine/1e2462ae3c25272dff6f to your computer and use it in GitHub Desktop.
youtube-dl extractor for Picasa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from .common import InfoExtractor | |
class PicasaIE(InfoExtractor): | |
_VALID_URL = r'(?:https?://)?picasaweb\.google.com/lh/photo/(?P<id>.+?)$' | |
def _real_extract(self, url): | |
video_id = self._match_id(url) | |
webpage = self._download_webpage(url, video_id) | |
title = self._html_search_regex( | |
r'"title":"(?P<title>.*?)"', | |
webpage, | |
'title', | |
group='title' | |
) | |
content = self._parse_json(self._html_search_regex( | |
r'"content":(?P<content>\[.*?\])', | |
webpage, | |
'content', | |
group='content' | |
), video_id) | |
formats = [] | |
for format in content: | |
medium, ext = format['type'].split('/') | |
if medium == 'video': | |
formats.append({ | |
'url': format['url'], | |
'width': format['width'], | |
'height': format['height'], | |
'ext': ext | |
}) | |
self._sort_formats(formats) | |
return { | |
'id': video_id, | |
'title': title, | |
'formats': formats | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment