]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/fc2.py
81ceace53289709b93d7c647f6627197320381ef
1 #! -*- coding: utf-8 -*-
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
16 class FC2IE(InfoExtractor
):
17 _VALID_URL
= r
'^http://video\.fc2\.com/(?:[^/]+/)?content/(?P<id>[^/]+)'
20 'url': 'http://video.fc2.com/en/content/20121103kUan1KHs',
21 'md5': 'a6ebe8ebe0396518689d963774a54eb7',
23 'id': '20121103kUan1KHs',
25 'title': 'Boxing again with Puff',
29 def _real_extract(self
, url
):
30 video_id
= self
._match
_id
(url
)
31 webpage
= self
._download
_webpage
(url
, video_id
)
32 self
._downloader
.cookiejar
.clear_session_cookies() # must clear
34 title
= self
._og
_search
_title
(webpage
)
35 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
36 refer
= url
.replace('/content/', '/a/content/')
38 mimi
= hashlib
.md5((video_id
+ '_gGddgPfeaf_gzyr').encode('utf-8')).hexdigest()
41 "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&".
42 format(video_id
, mimi
, compat_urllib_request
.quote(refer
, safe
='').replace('.', '%2E')))
44 info_webpage
= self
._download
_webpage
(
45 info_url
, video_id
, note
='Downloading info page')
46 info
= compat_urlparse
.parse_qs(info_webpage
)
48 if 'err_code' in info
:
49 raise ExtractorError('Error code: %s' % info
['err_code'][0])
51 video_url
= info
['filepath'][0] + '?mid=' + info
['mid'][0]
52 title_info
= info
.get('title')
61 'thumbnail': thumbnail
,