]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ntvde.py 
a83e85cb8109ef44468851355f2b522e22fc5831
   2  from  __future__ 
import  unicode_literals
   4  from  . common 
import  InfoExtractor
   5  from  .. compat 
import  compat_urlparse
  13  class  NTVDeIE ( InfoExtractor
):   15      _VALID_URL 
=  r
'https?://(?:www\.)?n-tv\.de/mediathek/videos/[^/?#]+/[^/?#]+-article(?P<id>.+)\.html'   18          'url' :  'http://www.n-tv.de/mediathek/videos/panorama/Schnee-und-Glaette-fuehren-zu-zahlreichen-Unfaellen-und-Staus-article14438086.html' ,   19          'md5' :  '6ef2514d4b1e8e03ca24b49e2f167153' ,   23              'thumbnail' :  're:^https?://.*\.jpg$' ,   24              'title' :  'Schnee und Glätte führen zu zahlreichen Unfällen und Staus' ,   25              'alt_title' :  'Winterchaos auf deutschen Straßen' ,   26              'description' :  'Schnee und Glätte sorgen deutschlandweit für einen chaotischen Start in die Woche: Auf den Straßen kommt es zu kilometerlangen Staus und Dutzenden Glätteunfällen. In Düsseldorf und München wirbelt der Schnee zudem den Flugplan durcheinander. Dutzende Flüge landen zu spät, einige fallen ganz aus.' ,   28              'timestamp' :  1422892797 ,   29              'upload_date' :  '20150202' ,   33      def  _real_extract ( self
,  url
):   34          video_id 
=  self
._ match
_ id
( url
)   35          webpage 
=  self
._ download
_ webpage
( url
,  video_id
)   37          info 
=  self
._ parse
_ json
( self
._ search
_ regex
(   38              r
'(?s)ntv\.pageInfo\.article\s*=\s*(\{.*?\});' ,  webpage
,  'info' ),   39              video_id
,  transform_source
= js_to_json
)   40          timestamp 
=  int_or_none ( info
. get ( 'publishedDateAsUnixTimeStamp' ))   41          vdata 
=  self
._ parse
_ json
( self
._ search
_ regex
(   42              r
'(?s)\$\(\s*"\#player"\s*\)\s*\.data\(\s*"player",\s*(\{.*?\})\);' ,   43              webpage
,  'player data' ),   44              video_id
,  transform_source
= js_to_json
)   45          duration 
=  parse_duration ( vdata
. get ( 'duration' ))   48          if  vdata
. get ( 'video' ):   51                  'url' :  'rtmp://fms.n-tv.de/ %s '  %  vdata
[ 'video' ],   53          if  vdata
. get ( 'videoMp4' ):   55                  'format_id' :  'mobile' ,   56                  'url' :  compat_urlparse
. urljoin ( 'http://video.n-tv.de' ,  vdata
[ 'videoMp4' ]),   57                  'tbr' :  400 ,   # estimation   59          if  vdata
. get ( 'videoM3u8' ):   60              m3u8_url 
=  compat_urlparse
. urljoin ( 'http://video.n-tv.de' ,  vdata
[ 'videoM3u8' ])   61              formats
. extend ( self
._ extract
_ m
3u8_ formats
(   62                  m3u8_url
,  video_id
,  ext
= 'mp4' ,  entry_protocol
= 'm3u8_native' ,   63                  preference
= 0 ,  m3u8_id
= 'hls' ,  fatal
= False ))   64          self
._ sort
_ formats
( formats
)   68              'title' :  info
[ 'headline' ],   69              'description' :  info
. get ( 'intro' ),   70              'alt_title' :  info
. get ( 'kicker' ),   71              'timestamp' :  timestamp
,   72              'thumbnail' :  vdata
. get ( 'html5VideoPoster' ),