diff options
author | Pccode66 <49125134+Pccode66@users.noreply.github.com> | 2021-02-24 15:45:56 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-25 00:15:56 +0530 |
commit | 7a5c1cfe93924351387b44919b3c0b2f66c4b883 (patch) | |
tree | 6da63f3d7b16cf7d4b9fdb29b029125cab8bd0d3 /yt_dlp/extractor/techtalks.py | |
parent | c4218ac3f1146daac20308439cdc374e3561101a (diff) | |
download | hypervideo-pre-7a5c1cfe93924351387b44919b3c0b2f66c4b883.tar.lz hypervideo-pre-7a5c1cfe93924351387b44919b3c0b2f66c4b883.tar.xz hypervideo-pre-7a5c1cfe93924351387b44919b3c0b2f66c4b883.zip |
Completely change project name to yt-dlp (#85)
* All modules and binary names are changed
* All documentation references changed
* yt-dlp no longer loads youtube-dlc config files
* All URLs changed to point to organization account
Co-authored-by: Pccode66
Co-authored-by: pukkandan
Diffstat (limited to 'yt_dlp/extractor/techtalks.py')
-rw-r--r-- | yt_dlp/extractor/techtalks.py | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/yt_dlp/extractor/techtalks.py b/yt_dlp/extractor/techtalks.py new file mode 100644 index 000000000..a5b62c717 --- /dev/null +++ b/yt_dlp/extractor/techtalks.py @@ -0,0 +1,82 @@ +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + get_element_by_attribute, + clean_html, +) + + +class TechTalksIE(InfoExtractor): + _VALID_URL = r'https?://techtalks\.tv/talks/(?:[^/]+/)?(?P<id>\d+)' + + _TESTS = [{ + 'url': 'http://techtalks.tv/talks/learning-topic-models-going-beyond-svd/57758/', + 'info_dict': { + 'id': '57758', + 'title': 'Learning Topic Models --- Going beyond SVD', + }, + 'playlist': [ + { + 'info_dict': { + 'id': '57758', + 'ext': 'flv', + 'title': 'Learning Topic Models --- Going beyond SVD', + }, + }, + { + 'info_dict': { + 'id': '57758-slides', + 'ext': 'flv', + 'title': 'Learning Topic Models --- Going beyond SVD', + }, + }, + ], + 'params': { + # rtmp download + 'skip_download': True, + }, + }, { + 'url': 'http://techtalks.tv/talks/57758', + 'only_matching': True, + }] + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + talk_id = mobj.group('id') + webpage = self._download_webpage(url, talk_id) + rtmp_url = self._search_regex( + r'netConnectionUrl: \'(.*?)\'', webpage, 'rtmp url') + play_path = self._search_regex( + r'href=\'(.*?)\' [^>]*id="flowplayer_presenter"', + webpage, 'presenter play path') + title = clean_html(get_element_by_attribute('class', 'title', webpage)) + video_info = { + 'id': talk_id, + 'title': title, + 'url': rtmp_url, + 'play_path': play_path, + 'ext': 'flv', + } + m_slides = re.search(r'<a class="slides" href=\'(.*?)\'', webpage) + if m_slides is None: + return video_info + else: + return { + '_type': 'playlist', + 'id': talk_id, + 'title': title, + 'entries': [ + video_info, + # The slides video + { + 'id': talk_id + '-slides', + 'title': title, + 'url': rtmp_url, + 'play_path': m_slides.group(1), + 'ext': 'flv', + }, + ], + } |