youtube-dl/youtube_dl/extractor/teletask.py

68 lines
2.1 KiB
Python
Raw Normal View History

2014-12-21 10:01:28 +00:00
# coding: utf-8
from __future__ import unicode_literals
2014-12-21 11:26:47 +00:00
import re
2014-12-21 10:01:28 +00:00
import datetime
from .common import InfoExtractor
class TeleTaskIE(InfoExtractor):
_VALID_URL = r'http?://(?:www\.)?tele-task\.de/archive/video/html5/(?P<id>[0-9]+)/'
_TEST = {
2014-12-21 11:26:47 +00:00
'url': 'http://www.tele-task.de/archive/video/html5/26168/',
2014-12-21 10:01:28 +00:00
'info_dict': {
'title': 'Duplicate Detection',
2014-12-21 11:26:47 +00:00
},
'playlist': [{
'md5': '290ef69fb2792e481169c3958dbfbd57',
'info_dict': {
'title': 'Duplicate Detection',
'upload_date': '20141218',
'id': 'speaker_26168',
'ext': 'mp4',
}
},
{
'md5': 'e1e7218c5f0e4790015a437fcf6c71b4',
'info_dict': {
'title': 'Duplicate Detection',
'upload_date': '20141218',
'id': 'slides_26168',
'ext': 'mp4',
}
}]
2014-12-21 10:01:28 +00:00
}
def _real_extract(self, url):
2014-12-21 11:26:47 +00:00
lecture_id = self._match_id(url)
webpage = self._download_webpage(url, lecture_id)
2014-12-21 10:01:28 +00:00
title = self._html_search_regex(
r'itemprop="name">([^"]+)</a>', webpage, 'title')
2014-12-21 11:26:47 +00:00
url_speaker = self._html_search_regex(
r'class="speaker".*?src="([^"]+)"', webpage, 'video_url_speaker', flags=re.DOTALL)
url_slides = self._html_search_regex(
r'class="slides".*?src="([^"]+)"', webpage, 'video_url_slides', flags=re.DOTALL)
2014-12-21 10:01:28 +00:00
date = self._html_search_regex(
r'<td class="label">Date:</td><td>([^"]+)</td>', webpage, 'date')
date = datetime.datetime.strptime(date, '%d.%m.%Y').strftime('%Y%m%d')
2014-12-21 11:26:47 +00:00
entries = [{
'title': title,
'upload_date': date,
'id': "speaker_"+lecture_id,
'url': url_speaker,
},
{
'title': title,
'upload_date': date,
'id': "slides_"+lecture_id,
'url': url_slides}]
2014-12-21 10:01:28 +00:00
return {
2014-12-21 11:26:47 +00:00
'_type': "playlist",
'id': lecture_id,
2014-12-21 10:01:28 +00:00
'title': title,
2014-12-21 11:26:47 +00:00
'entries': entries,
}