1 from __future__ import unicode_literals
5 from .common import InfoExtractor
12 class FlickrIE(InfoExtractor):
13 _VALID_URL = r'https?://(?:www\.|secure\.)?flickr\.com/photos/(?P<uploader_id>[\w\-_@]+)/(?P<id>\d+).*'
15 'url': 'http://www.flickr.com/photos/forestwander-nature-pictures/5645318632/in/photostream/',
16 'md5': '6fdc01adbc89d72fc9c4f15b4a4ba87b',
20 "description": "Waterfalls in the Springtime at Dark Hollow Waterfalls. These are located just off of Skyline Drive in Virginia. They are only about 6/10 of a mile hike but it is a pretty steep hill and a good climb back up.",
21 "uploader_id": "forestwander-nature-pictures",
22 "title": "Dark Hollow Waterfalls"
26 def _real_extract(self, url):
27 mobj = re.match(self._VALID_URL, url)
29 video_id = mobj.group('id')
30 video_uploader_id = mobj.group('uploader_id')
31 webpage_url = 'http://www.flickr.com/photos/' + video_uploader_id + '/' + video_id
32 webpage = self._download_webpage(webpage_url, video_id)
34 secret = self._search_regex(r"photo_secret: '(\w+)'", webpage, 'secret')
36 first_url = 'https://secure.flickr.com/apps/video/video_mtl_xml.gne?v=x&photo_id=' + video_id + '&secret=' + secret + '&bitrate=700&target=_self'
37 first_xml = self._download_webpage(first_url, video_id, 'Downloading first data webpage')
39 node_id = self._html_search_regex(r'<Item id="id">(\d+-\d+)</Item>',
42 second_url = 'https://secure.flickr.com/video_playlist.gne?node_id=' + node_id + '&tech=flash&mode=playlist&bitrate=700&secret=' + secret + '&rd=video.yahoo.com&noad=1'
43 second_xml = self._download_webpage(second_url, video_id, 'Downloading second data webpage')
45 self.report_extraction(video_id)
47 mobj = re.search(r'<STREAM APP="(.+?)" FULLPATH="(.+?)"', second_xml)
49 raise ExtractorError('Unable to extract video url')
50 video_url = mobj.group(1) + unescapeHTML(mobj.group(2))
56 'title': self._og_search_title(webpage),
57 'description': self._og_search_description(webpage),
58 'thumbnail': self._og_search_thumbnail(webpage),
59 'uploader_id': video_uploader_id,