3 from __future__
import unicode_literals
7 from .common
import InfoExtractor
14 class RTLnowIE(InfoExtractor
):
15 """Information Extractor for RTL NOW, RTL2 NOW, RTL NITRO, SUPER RTL NOW, VOX NOW and n-tv NOW"""
16 _VALID_URL
= r
'(?:http://)?(?P<url>(?P<domain>rtl-now\.rtl\.de|rtl2now\.rtl2\.de|(?:www\.)?voxnow\.de|(?:www\.)?rtlnitronow\.de|(?:www\.)?superrtlnow\.de|(?:www\.)?n-tvnow\.de)/+[a-zA-Z0-9-]+/[a-zA-Z0-9-]+\.php\?(?:container_id|film_id)=(?P<video_id>[0-9]+)&player=1(?:&season=[0-9]+)?(?:&.*)?)'
18 'url': 'http://rtl-now.rtl.de/ahornallee/folge-1.php?film_id=90419&player=1&season=1',
21 'upload_date': '20070416',
22 'title': 'Ahornallee - Folge 1 - Der Einzug',
23 'description': 'Folge 1 - Der Einzug',
26 'skip_download': True,
28 'skip': 'Only works from Germany',
31 'url': 'http://rtl2now.rtl2.de/aerger-im-revier/episode-15-teil-1.php?film_id=69756&player=1&season=2&index=5',
34 'upload_date': '20120519',
35 'title': 'Ärger im Revier - Ein junger Ladendieb, ein handfester Streit...',
36 'description': 'Ärger im Revier - Ein junger Ladendieb, ein handfester Streit u.a.',
37 'thumbnail': 'http://autoimg.static-fra.de/rtl2now/219850/1500x1500/image2.jpg',
40 'skip_download': True,
42 'skip': 'Only works from Germany',
45 'url': 'http://www.voxnow.de/voxtours/suedafrika-reporter-ii.php?film_id=13883&player=1&season=17',
48 'upload_date': '20090627',
49 'title': 'Voxtours - Südafrika-Reporter II',
50 'description': 'Südafrika-Reporter II',
53 'skip_download': True,
57 'url': 'http://superrtlnow.de/medicopter-117/angst.php?film_id=99205&player=1',
60 'upload_date': '20080928',
61 'title': 'Medicopter 117 - Angst!',
62 'description': 'Angst!',
63 'thumbnail': 'http://autoimg.static-fra.de/superrtlnow/287529/1500x1500/image2.jpg'
66 'skip_download': True,
70 'url': 'http://www.n-tvnow.de/top-gear/episode-1-2013-01-01-00-00-00.php?film_id=124903&player=1&season=10',
73 'upload_date': '20130101',
74 'title': 'Top Gear vom 01.01.2013',
75 'description': 'Episode 1',
78 'skip_download': True,
80 'skip': 'Only works from Germany',
83 def _real_extract(self
, url
):
84 mobj
= re
.match(self
._VALID
_URL
, url
)
86 webpage_url
= 'http://' + mobj
.group('url')
87 video_page_url
= 'http://' + mobj
.group('domain') + '/'
88 video_id
= mobj
.group('video_id')
90 webpage
= self
._download
_webpage
(webpage_url
, video_id
)
92 note_m
= re
.search(r
'''(?sx)
93 <div[ ]style="margin-left:[ ]20px;[ ]font-size:[ ]13px;">(.*?)
94 <div[ ]id="playerteaser">''', webpage
)
96 msg
= clean_html(note_m
.group(1))
97 raise ExtractorError(msg
)
99 video_title
= self
._html
_search
_regex
(
100 r
'<title>(?P<title>[^<]+?)( \| [^<]*)?</title>',
102 playerdata_url
= self
._html
_search
_regex
(
103 r
'\'playerdata
\': \'(?P
<playerdata_url
>[^
\']+)\'',
104 webpage, 'playerdata_url
')
106 playerdata = self._download_webpage(playerdata_url, video_id)
107 mobj = re.search(r'<title
><!\
[CDATA\
[(?P
<description
>.+?
)(?
:\s
+- (?
:Sendung
)?
vom (?P
<upload_date_d
>[0-9]{2}
)\
.(?P
<upload_date_m
>[0-9]{2}
)\
.(?
:(?P
<upload_date_Y
>[0-9]{4}
)|
(?P
<upload_date_y
>[0-9]{2}
)) [0-9]{2}
:[0-9]{2} Uhr
)?\
]\
]></title
>', playerdata)
109 video_description = mobj.group('description
')
110 if mobj.group('upload_date_Y
'):
111 video_upload_date = mobj.group('upload_date_Y
')
112 elif mobj.group('upload_date_y
'):
113 video_upload_date = '20' + mobj.group('upload_date_y
')
115 video_upload_date = None
116 if video_upload_date:
117 video_upload_date += mobj.group('upload_date_m
') + mobj.group('upload_date_d
')
119 video_description = None
120 video_upload_date = None
121 self._downloader.report_warning('Unable to extract description
and upload date
')
123 # Thumbnail: not every video has an thumbnail
124 mobj = re.search(r'<meta
property="og:image" content
="(?P<thumbnail>[^"]+)">', webpage)
126 video_thumbnail = mobj.group('thumbnail')
128 video_thumbnail = None
130 mobj = re.search(r'<filename [^>]+><!\[CDATA\[(?P<url>rtmpe://(?:[^/]+/){2})(?P<play_path>[^\]]+)\]\]></filename>', playerdata)
132 raise ExtractorError('Unable to extract media URL')
133 video_url = mobj.group('url')
134 video_play_path = 'mp4:' + mobj.group('play_path')
135 video_player_url = video_page_url + 'includes/vodplayer.swf'
140 'play_path': video_play_path,
141 'page_url': video_page_url,
142 'player_url': video_player_url,
144 'title': video_title,
145 'description': video_description,
146 'upload_date': video_upload_date,
147 'thumbnail': video_thumbnail,