~facundo/encuentro/trunk

« back to all changes in this revision

Viewing changes to external/youtube-dl/youtube_dl/extractor/bpb.py

  • Committer: Facundo Batista
  • Date: 2015-12-27 11:27:15 UTC
  • mto: This revision was merged to the branch mainline in revision 274.
  • Revision ID: facundo@taniquetil.com.ar-20151227112715-ztuasdhqm26hycug
Able to download TEDx.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# coding: utf-8
 
2
from __future__ import unicode_literals
 
3
 
 
4
from .common import InfoExtractor
 
5
 
 
6
 
 
7
class BpbIE(InfoExtractor):
 
8
    IE_DESC = 'Bundeszentrale für politische Bildung'
 
9
    _VALID_URL = r'http://www\.bpb\.de/mediathek/(?P<id>[0-9]+)/'
 
10
 
 
11
    _TEST = {
 
12
        'url': 'http://www.bpb.de/mediathek/297/joachim-gauck-zu-1989-und-die-erinnerung-an-die-ddr',
 
13
        'md5': '0792086e8e2bfbac9cdf27835d5f2093',
 
14
        'info_dict': {
 
15
            'id': '297',
 
16
            'ext': 'mp4',
 
17
            'title': 'Joachim Gauck zu 1989 und die Erinnerung an die DDR',
 
18
            'description': 'Joachim Gauck, erster Beauftragter für die Stasi-Unterlagen, spricht auf dem Geschichtsforum über die friedliche Revolution 1989 und eine "gewisse Traurigkeit" im Umgang mit der DDR-Vergangenheit.'
 
19
        }
 
20
    }
 
21
 
 
22
    def _real_extract(self, url):
 
23
        video_id = self._match_id(url)
 
24
        webpage = self._download_webpage(url, video_id)
 
25
 
 
26
        title = self._html_search_regex(
 
27
            r'<h2 class="white">(.*?)</h2>', webpage, 'title')
 
28
        video_url = self._html_search_regex(
 
29
            r'(http://film\.bpb\.de/player/dokument_[0-9]+\.mp4)',
 
30
            webpage, 'video URL')
 
31
 
 
32
        return {
 
33
            'id': video_id,
 
34
            'url': video_url,
 
35
            'title': title,
 
36
            'description': self._og_search_description(webpage),
 
37
        }