Skip to content

Instantly share code, notes, and snippets.

@remitamine
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remitamine/1e2462ae3c25272dff6f to your computer and use it in GitHub Desktop.
Save remitamine/1e2462ae3c25272dff6f to your computer and use it in GitHub Desktop.
youtube-dl extractor for Picasa
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