]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/yesjapan.py
1 from .common
import InfoExtractor
4 get_element_by_attribute
,
9 class YesJapanIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www\.)?yesjapan\.com/video/(?P<slug>[A-Za-z0-9\-]*)_(?P<id>[A-Za-z0-9]+)\.html'
12 'url': 'http://www.yesjapan.com/video/japanese-in-5-20-wa-and-ga-particle-usages_726497834.html',
13 'md5': 'f0be416314e5be21a12b499b330c21cf',
16 'title': 'Japanese in 5! #20 - WA And GA Particle Usages',
17 'description': 'This should clear up some issues most students of Japanese encounter with WA and GA....',
19 'timestamp': 1416391590,
20 'upload_date': '20141119',
21 'thumbnail': r
're:^https?://.*\.jpg$',
25 def _real_extract(self
, url
):
26 video_id
= self
._match
_id
(url
)
28 webpage
= self
._download
_webpage
(url
, video_id
)
29 title
= self
._og
_search
_title
(webpage
)
30 video_url
= self
._og
_search
_video
_url
(webpage
)
31 description
= self
._og
_search
_description
(webpage
)
32 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
35 submit_info
= get_element_by_attribute('class', 'pm-submit-data', webpage
)
37 timestamp
= parse_iso8601(self
._search
_regex
(
38 r
'datetime="([^"]+)"', submit_info
, 'upload date', fatal
=False, default
=None))
40 # attempt to resolve the final URL in order to get a proper extension
41 redirect_req
= HEADRequest(video_url
)
42 req
= self
._request
_webpage
(
43 redirect_req
, video_id
, note
='Resolving final URL', errnote
='Could not resolve final URL', fatal
=False)
45 video_url
= req
.geturl()
56 'description': description
,
57 'timestamp': timestamp
,
58 'thumbnail': thumbnail
,