]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/sendtonews.py
3 from . common
import InfoExtractor
14 class SendtoNewsIE ( InfoExtractor
):
15 _VALID_URL
= r
'https?://embed\.sendtonews\.com/player2/embedplayer\.php\?.*\bSC=(?P<id>[0-9A-Za-z-]+)'
18 # From http://cleveland.cbslocal.com/2016/05/16/indians-score-season-high-15-runs-in-blowout-win-over-reds-rapid-reaction/
19 'url' : 'http://embed.sendtonews.com/player2/embedplayer.php?SC=GxfCe0Zo7D-175909-5588&type=single&autoplay=on&sound=YES' ,
21 'id' : 'GxfCe0Zo7D-175909-5588'
24 # test the first video only to prevent lengthy tests
29 'title' : 'Indians introduce Encarnacion' ,
30 'description' : 'Indians president of baseball operations Chris Antonetti and Edwin Encarnacion discuss the slugger \' s three-year contract with Cleveland' ,
32 'thumbnail' : r
're:https?://.*\.jpg$' ,
33 'upload_date' : '20170105' ,
34 'timestamp' : 1483649762 ,
39 'skip_download' : True ,
43 _URL_TEMPLATE
= '//embed.sendtonews.com/player2/embedplayer.php?SC= %s '
46 def _extract_embed_urls ( cls
, url
, webpage
):
47 mobj
= re
. search ( r
'''(?x)<script[^>]+src=([\' "])
48 (?:https?:)?//embed\.sendtonews\.com/player/responsiveembed\.php \?
49 .* \b SC=(?P<SC>[0-9a-zA-Z-]+).*
53 yield cls._URL_TEMPLATE % sc
55 def _real_extract(self, url):
56 playlist_id = self._match_id(url)
58 data_url = update_url_query(
59 url.replace('embedplayer.php', 'data_read.php'),
60 {'cmd': 'loadInitial'} )
61 playlist_data = self._download_json(data_url, playlist_id)
64 for video in playlist_data['playlistData'][0]:
65 info_dict = self._parse_jwplayer_data(
66 video['jwconfiguration'],
67 require_title=False, m3u8_id='hls', rtmp_params= {'no_resume': True} )
69 for f in info_dict['formats']:
72 tbr = int_or_none(self._search_regex(
73 r'/(\d+)k/', f['url'], 'bitrate', default=None))
77 'format_id': ' %s-%d ' % (determine_protocol(f), tbr),
82 if video.get('thumbnailUrl'):
85 'url': video['thumbnailUrl'],
87 if video.get('smThumbnailUrl'):
90 'url': video['smThumbnailUrl'],
93 'title': video['S_headLine'].strip(),
94 'description': unescapeHTML(video.get('S_fullStory')),
95 'thumbnails': thumbnails,
96 'duration': float_or_none(video.get('SM_length')),
97 'timestamp': parse_iso8601(video.get('S_sysDate'), delimiter=' '),
98 # 'tbr' was explicitly set to be preferred over 'height' originally,
99 # So this is being kept unless someone can confirm this is unnecessary
100 '_format_sort_fields': ('tbr', 'res')
102 entries.append(info_dict)
104 return self.playlist_result(entries, playlist_id)