Skip to content

Instantly share code, notes, and snippets.

@remitamine remitamine/picasa.py
Last active Aug 29, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.