]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/telewebion.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
   7 class TelewebionIE(InfoExtractor
): 
   8     _VALID_URL 
= r
'https?://(?:www\.)?telewebion\.com/#!/episode/(?P<id>\d+)' 
  11         'url': 'http://www.telewebion.com/#!/episode/1263668/', 
  15             'title': 'قرعه\u200cکشی لیگ قهرمانان اروپا', 
  16             'thumbnail': r
're:^https?://.*\.jpg', 
  21             'skip_download': True, 
  25     def _real_extract(self
, url
): 
  26         video_id 
= self
._match
_id
(url
) 
  28         secure_token 
= self
._download
_webpage
( 
  29             'http://m.s2.telewebion.com/op/op?action=getSecurityToken', video_id
) 
  30         episode_details 
= self
._download
_json
( 
  31             'http://m.s2.telewebion.com/op/op', video_id
, 
  32             query
={'action': 'getEpisodeDetails', 'episode_id': video_id
}) 
  34         m3u8_url 
= 'http://m.s1.telewebion.com/smil/%s.m3u8?filepath=%s&m3u8=1&secure_token=%s' % ( 
  35             video_id
, episode_details
['file_path'], secure_token
) 
  36         formats 
= self
._extract
_m
3u8_formats
( 
  37             m3u8_url
, video_id
, ext
='mp4', m3u8_id
='hls') 
  40             episode_details
.get('picture_path'), 
  41             episode_details
.get('large_picture_path'), 
  47         } for idx
, picture_path 
in enumerate(picture_paths
) if picture_path 
is not None] 
  51             'title': episode_details
['title'], 
  53             'thumbnails': thumbnails
, 
  54             'view_count': episode_details
.get('view_count'),