1 #! -*- coding: utf-8 -*-
2 from __future__ import unicode_literals
7 from .common import InfoExtractor
10 compat_urllib_request,
15 class FC2IE(InfoExtractor):
16 _VALID_URL = r'^http://video\.fc2\.com/(?P<lang>[^/]+)/content/(?P<id>[^/]+)'
19 'url': 'http://video.fc2.com/en/content/20121103kUan1KHs',
20 'md5': 'a6ebe8ebe0396518689d963774a54eb7',
22 'id': '20121103kUan1KHs',
24 'title': 'Boxing again with Puff',
28 def _real_extract(self, url):
29 mobj = re.match(self._VALID_URL, url)
30 video_id = mobj.group('id')
32 webpage = self._download_webpage(url, video_id)
33 self._downloader.cookiejar.clear_session_cookies() # must clear
35 title = self._og_search_title(webpage)
36 thumbnail = self._og_search_thumbnail(webpage)
37 refer = url.replace('/content/', '/a/content/')
39 mimi = hashlib.md5(video_id + '_gGddgPfeaf_gzyr').hexdigest()
42 "http://video.fc2.com/ginfo.php?mimi={1:s}&href={2:s}&v={0:s}&fversion=WIN%2011%2C6%2C602%2C180&from=2&otag=0&upid={0:s}&tk=null&".
43 format(video_id, mimi, compat_urllib_request.quote(refer, safe='').replace('.','%2E')))
45 info_webpage = self._download_webpage(
46 info_url, video_id, note='Downloading info page')
47 info = compat_urlparse.parse_qs(info_webpage)
49 if 'err_code' in info:
50 raise ExtractorError('Error code: %s' % info['err_code'][0])
52 video_url = info['filepath'][0] + '?mid=' + info['mid'][0]
56 'title': info['title'][0],
59 'thumbnail': thumbnail,