]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/pokemon.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
  13 class PokemonIE(InfoExtractor
): 
  14     _VALID_URL 
= r
'https?://(?:www\.)?pokemon\.com/[a-z]{2}(?:.*?play=(?P<id>[a-z0-9]{32})|/[^/]+/\d+_\d+-(?P<display_id>[^/?#]+))' 
  16         'url': 'http://www.pokemon.com/us/pokemon-episodes/19_01-from-a-to-z/?play=true', 
  17         'md5': '9fb209ae3a569aac25de0f5afc4ee08f', 
  19             'id': 'd0436c00c3ce4071ac6cee8130ac54a1', 
  21             'title': 'From A to Z!', 
  22             'description': 'Bonnie makes a new friend, Ash runs into an old friend, and a terrifying premonition begins to unfold!', 
  23             'timestamp': 1460478136, 
  24             'upload_date': '20160412', 
  26         'add_id': ['LimelightMedia'] 
  28         'url': 'http://www.pokemon.com/uk/pokemon-episodes/?play=2e8b5c761f1d4a9286165d7748c1ece2', 
  29         'only_matching': True, 
  31         'url': 'http://www.pokemon.com/fr/episodes-pokemon/18_09-un-hiver-inattendu/', 
  32         'only_matching': True, 
  34         'url': 'http://www.pokemon.com/de/pokemon-folgen/01_20-bye-bye-smettbo/', 
  35         'only_matching': True, 
  38     def _real_extract(self
, url
): 
  39         video_id
, display_id 
= re
.match(self
._VALID
_URL
, url
).groups() 
  40         webpage 
= self
._download
_webpage
(url
, video_id 
or display_id
) 
  41         video_data 
= extract_attributes(self
._search
_regex
( 
  42             r
'(<[^>]+data-video-id="%s"[^>]*>)' % (video_id 
if video_id 
else '[a-z0-9]{32}'), 
  43             webpage
, 'video data element')) 
  44         video_id 
= video_data
['data-video-id'] 
  45         title 
= video_data
['data-video-title'] 
  47             '_type': 'url_transparent', 
  49             'url': 'limelight:media:%s' % video_id
, 
  51             'description': video_data
.get('data-video-summary'), 
  52             'thumbnail': video_data
.get('data-video-poster'), 
  54             'season_number': int_or_none(video_data
.get('data-video-season')), 
  56             'episode_number': int_or_none(video_data
.get('data-video-episode')), 
  57             'ie_key': 'LimelightMedia',