]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/servingsys.py
   1 from __future__ 
import unicode_literals
 
   3 from .common 
import InfoExtractor
 
   9 class ServingSysIE(InfoExtractor
): 
  10     _VALID_URL 
= r
'https?://(?:[^.]+\.)?serving-sys\.com/BurstingPipe/adServer\.bs\?.*?&pli=(?P<id>[0-9]+)' 
  13         'url': 'http://bs.serving-sys.com/BurstingPipe/adServer.bs?cn=is&c=23&pl=VAST&pli=5349193&PluID=0&pos=7135&ord=[timestamp]&cim=1?', 
  16             'title': 'AdAPPter_Hyundai_demo', 
  19             'md5': 'baed851342df6846eb8677a60a011a0f', 
  23                 'title': 'AdAPPter_Hyundai_demo (1)', 
  30             'md5': '979b4da2655c4bc2d81aeb915a8c5014', 
  34                 'title': 'AdAPPter_Hyundai_demo (2)', 
  44         '_skip': 'Blocked in the US [sic]', 
  47     def _real_extract(self
, url
): 
  48         pl_id 
= self
._match
_id
(url
) 
  49         vast_doc 
= self
._download
_xml
(url
, pl_id
) 
  51         title 
= vast_doc
.find('.//AdTitle').text
 
  52         media 
= vast_doc
.find('.//MediaFile').text
 
  53         info_url 
= self
._search
_regex
(r
'&adData=([^&]+)&', media
, 'info URL') 
  55         doc 
= self
._download
_xml
(info_url
, pl_id
, 'Downloading video info') 
  59             'title': '%s (%s)' % (title
, a
.attrib
['assetID']), 
  60             'url': a
.attrib
['URL'], 
  61             'duration': int_or_none(a
.attrib
.get('length')), 
  62             'tbr': int_or_none(a
.attrib
.get('bitrate')), 
  63             'height': int_or_none(a
.attrib
.get('height')), 
  64             'width': int_or_none(a
.attrib
.get('width')), 
  65         } for a 
in doc
.findall('.//AdditionalAssets/asset')]