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