]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tagesschau.py
1 # -*- coding: utf-8 -*-
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import parse_filesize
10 class TagesschauIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?tagesschau\.de/multimedia/(?:sendung/ts|video/video)(?P<id>-?[0-9]+)\.html'
14 'url': 'http://www.tagesschau.de/multimedia/video/video1399128.html',
15 'md5': 'bcdeac2194fb296d599ce7929dfa4009',
19 'title': 'Harald Range, Generalbundesanwalt, zu den Ermittlungen',
20 'description': 'md5:69da3c61275b426426d711bde96463ab',
21 'thumbnail': 're:^http:.*\.jpg$',
24 'url': 'http://www.tagesschau.de/multimedia/sendung/ts-5727.html',
25 'md5': '3c54c1f6243d279b706bde660ceec633',
29 'description': 'md5:695c01bfd98b7e313c501386327aea59',
30 'title': 'Sendung: tagesschau \t04.12.2014 20:00 Uhr',
31 'thumbnail': 're:^http:.*\.jpg$',
36 's': {'width': 256, 'height': 144, 'quality': 1},
37 'm': {'width': 512, 'height': 288, 'quality': 2},
38 'l': {'width': 960, 'height': 544, 'quality': 3},
41 def _real_extract(self
, url
):
42 video_id
= self
._match
_id
(url
)
43 display_id
= video_id
.lstrip('-')
44 webpage
= self
._download
_webpage
(url
, display_id
)
46 player_url
= self
._html
_search
_meta
(
47 'twitter:player', webpage
, 'player URL', default
=None)
49 playerpage
= self
._download
_webpage
(
50 player_url
, display_id
, 'Downloading player page')
53 r
'"(http://media.+?)", type:"video/(.+?)", quality:"(.+?)"',
56 for url
, ext
, res
in medias
:
58 'format_id': res
+ '_' + ext
,
62 f
.update(self
._FORMATS
.get(res
, {}))
64 thumbnail_fn
= re
.findall(r
'"(/multimedia/.+?\.jpg)"', playerpage
)[-1]
65 title
= self
._og
_search
_title
(webpage
).strip()
66 description
= self
._og
_search
_description
(webpage
).strip()
68 download_text
= self
._search
_regex
(
69 r
'(?s)<p>Wir bieten dieses Video in folgenden Formaten zum Download an:</p>\s*<div class="controls">(.*?)</div>\s*<p>',
70 webpage
, 'download links')
72 r
'<div class="button" title="(?P<title>[^"]*)"><a href="(?P<url>[^"]+)">(?P<name>.+?)</a></div>',
76 format_id
= self
._search
_regex
(
77 r
'.*/[^/.]+\.([^/]+)\.[^/.]+', l
.group('url'), 'format ID')
79 'format_id': format_id
,
80 'url': l
.group('url'),
81 'format_name': l
.group('name'),
85 Video:\s*(?P<vcodec>[a-zA-Z0-9/._-]+)\s*&\#10;
86 (?P<width>[0-9]+)x(?P<height>[0-9]+)px&\#10;
87 (?P<vbr>[0-9]+)kbps&\#10;
88 Audio:\s*(?P<abr>[0-9]+)kbps,\s*(?P<audio_desc>[A-Za-z\.0-9]+)&\#10;
89 Größe:\s*(?P<filesize_approx>[0-9.,]+\s+[a-zA-Z]*B)''',
93 'format_note': m
.group('audio_desc'),
94 'vcodec': m
.group('vcodec'),
95 'width': int(m
.group('width')),
96 'height': int(m
.group('height')),
97 'abr': int(m
.group('abr')),
98 'vbr': int(m
.group('vbr')),
99 'filesize_approx': parse_filesize(m
.group('filesize_approx')),
101 formats
.append(format
)
102 thumbnail_fn
= self
._search
_regex
(
103 r
'(?s)<img alt="Sendungsbild".*?src="([^"]+)"',
104 webpage
, 'thumbnail', fatal
=False)
105 description
= self
._html
_search
_regex
(
106 r
'(?s)<p class="teasertext">(.*?)</p>',
107 webpage
, 'description', fatal
=False)
108 title
= self
._html
_search
_regex
(
109 r
'<span class="headline".*?>(.*?)</span>', webpage
, 'title')
111 self
._sort
_formats
(formats
)
112 thumbnail
= 'http://www.tagesschau.de' + thumbnail_fn
117 'thumbnail': thumbnail
,
119 'description': description
,