From 2b547dd782bb31104085eef067d71ea7144b70ba Mon Sep 17 00:00:00 2001 From: lorpus Date: Sat, 14 Nov 2020 19:55:50 -0500 Subject: [bitwave.tv] new extractor --- youtube_dlc/extractor/bitwave.py | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 youtube_dlc/extractor/bitwave.py (limited to 'youtube_dlc/extractor/bitwave.py') diff --git a/youtube_dlc/extractor/bitwave.py b/youtube_dlc/extractor/bitwave.py new file mode 100644 index 000000000..6fe02c8c2 --- /dev/null +++ b/youtube_dlc/extractor/bitwave.py @@ -0,0 +1,51 @@ +from .common import InfoExtractor + + +class BitwaveReplayIE(InfoExtractor): + IE_NAME = 'bitwave:replay' + _VALID_URL = r'https?://(?:www\.)?bitwave\.tv/(?P\w+)/replay/(?P\w+)/?$' + + def _real_extract(self, url): + replay_id = self._match_id(url) + replay = self._download_json( + 'https://api.bitwave.tv/v1/replays/' + replay_id, + replay_id + ) + + return { + 'id': replay_id, + 'title': replay['data']['title'], + 'uploader': replay['data']['name'], + 'uploader_id': replay['data']['name'], + 'url': replay['data']['url'], + 'thumbnails': [ + {'url': x} for x in replay['data']['thumbnails'] + ], + } + + +class BitwaveStreamIE(InfoExtractor): + IE_NAME = 'bitwave:stream' + _VALID_URL = r'https?://(?:www\.)?bitwave\.tv/(?P\w+)/?$' + + def _real_extract(self, url): + username = self._match_id(url) + channel = self._download_json( + 'https://api.bitwave.tv/v1/channels/' + username, + username) + + formats = self._extract_m3u8_formats( + channel['data']['url'], username, + 'mp4') + self._sort_formats(formats) + + return { + 'id': username, + 'title': self._live_title(channel['data']['title']), + 'uploader': username, + 'uploader_id': username, + 'formats': formats, + 'thumbnail': channel['data']['thumbnail'], + 'is_live': True, + 'view_count': channel['data']['viewCount'] + } -- cgit v1.2.3 From d9c2b0a6de70a0bd610332202467eceb97bf1285 Mon Sep 17 00:00:00 2001 From: lorpus Date: Sat, 14 Nov 2020 20:18:30 -0500 Subject: [bitwave.tv] fix build --- youtube_dlc/extractor/bitwave.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'youtube_dlc/extractor/bitwave.py') diff --git a/youtube_dlc/extractor/bitwave.py b/youtube_dlc/extractor/bitwave.py index 6fe02c8c2..9aa210510 100644 --- a/youtube_dlc/extractor/bitwave.py +++ b/youtube_dlc/extractor/bitwave.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from .common import InfoExtractor -- cgit v1.2.3 From ae7c01431db6853bf39600d8d862806511fe4f36 Mon Sep 17 00:00:00 2001 From: lorpus Date: Fri, 27 Nov 2020 00:23:13 -0500 Subject: [bitwave.tv] add test --- youtube_dlc/extractor/bitwave.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'youtube_dlc/extractor/bitwave.py') diff --git a/youtube_dlc/extractor/bitwave.py b/youtube_dlc/extractor/bitwave.py index 9aa210510..eb16c469d 100644 --- a/youtube_dlc/extractor/bitwave.py +++ b/youtube_dlc/extractor/bitwave.py @@ -6,6 +6,10 @@ from .common import InfoExtractor class BitwaveReplayIE(InfoExtractor): IE_NAME = 'bitwave:replay' _VALID_URL = r'https?://(?:www\.)?bitwave\.tv/(?P\w+)/replay/(?P\w+)/?$' + _TEST = { + 'url': 'https://bitwave.tv/RhythmicCarnage/replay/z4P6eq5L7WDrM85UCrVr', + 'only_matching': True + } def _real_extract(self, url): replay_id = self._match_id(url) @@ -29,6 +33,10 @@ class BitwaveReplayIE(InfoExtractor): class BitwaveStreamIE(InfoExtractor): IE_NAME = 'bitwave:stream' _VALID_URL = r'https?://(?:www\.)?bitwave\.tv/(?P\w+)/?$' + _TEST = { + 'url': 'https://bitwave.tv/doomtube', + 'only_matching': True + } def _real_extract(self, url): username = self._match_id(url) -- cgit v1.2.3