]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/yesjapan.py
112a6c030138e6c7d0e58619d40f3af012e13362
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
   7     get_element_by_attribute
, 
  12 class YesJapanIE(InfoExtractor
): 
  13     _VALID_URL 
= r
'https?://(?:www\.)?yesjapan\.com/video/(?P<slug>[A-Za-z0-9\-]*)_(?P<id>[A-Za-z0-9]+)\.html' 
  15         'url': 'http://www.yesjapan.com/video/japanese-in-5-20-wa-and-ga-particle-usages_726497834.html', 
  16         'md5': 'f0be416314e5be21a12b499b330c21cf', 
  19             'title': 'Japanese in 5! #20 - WA And GA Particle Usages', 
  20             'description': 'This should clear up some issues most students of Japanese encounter with WA and GA....', 
  22             'timestamp': 1416391590, 
  23             'upload_date': '20141119', 
  24             'thumbnail': 're:^https?://.*\.jpg$', 
  28     def _real_extract(self
, url
): 
  29         video_id 
= self
._match
_id
(url
) 
  31         webpage 
= self
._download
_webpage
(url
, video_id
) 
  32         title 
= self
._og
_search
_title
(webpage
) 
  33         video_url 
= self
._og
_search
_video
_url
(webpage
) 
  34         description 
= self
._og
_search
_description
(webpage
) 
  35         thumbnail 
= self
._og
_search
_thumbnail
(webpage
) 
  38         submit_info 
= get_element_by_attribute('class', 'pm-submit-data', webpage
) 
  40             timestamp 
= parse_iso8601(self
._search
_regex
( 
  41                 r
'datetime="([^"]+)"', submit_info
, 'upload date', fatal
=False, default
=None)) 
  43         # attempt to resolve the final URL in order to get a proper extension 
  44         redirect_req 
= HEADRequest(video_url
) 
  45         req 
= self
._request
_webpage
( 
  46             redirect_req
, video_id
, note
='Resolving final URL', errnote
='Could not resolve final URL', fatal
=False) 
  48             video_url 
= req
.geturl() 
  59             'description': description
, 
  60             'timestamp': timestamp
, 
  61             'thumbnail': thumbnail
,