summaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/bitwave.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:37:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:37:42 +0000
commitc7bab7c39fd51c0812f70020172766303191bc01 (patch)
tree56c05fbdd4fc47409d48ba318a4b621a7b0d299a /yt_dlp/extractor/bitwave.py
parentInitial commit. (diff)
downloadyt-dlp-c7bab7c39fd51c0812f70020172766303191bc01.tar.xz
yt-dlp-c7bab7c39fd51c0812f70020172766303191bc01.zip
Adding upstream version 2023.03.04.upstream/2023.03.04upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'yt_dlp/extractor/bitwave.py')
-rw-r--r--yt_dlp/extractor/bitwave.py58
1 files changed, 58 insertions, 0 deletions
diff --git a/yt_dlp/extractor/bitwave.py b/yt_dlp/extractor/bitwave.py
new file mode 100644
index 0000000..a82cd26
--- /dev/null
+++ b/yt_dlp/extractor/bitwave.py
@@ -0,0 +1,58 @@
+from .common import InfoExtractor
+
+
+class BitwaveReplayIE(InfoExtractor):
+ IE_NAME = 'bitwave:replay'
+ _VALID_URL = r'https?://(?:www\.)?bitwave\.tv/(?P<user>\w+)/replay/(?P<id>\w+)/?$'
+ _TEST = {
+ 'url': 'https://bitwave.tv/RhythmicCarnage/replay/z4P6eq5L7WDrM85UCrVr',
+ 'only_matching': True
+ }
+
+ 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<id>\w+)/?$'
+ _TEST = {
+ 'url': 'https://bitwave.tv/doomtube',
+ 'only_matching': True
+ }
+
+ 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')
+
+ return {
+ 'id': username,
+ 'title': channel['data']['title'],
+ 'uploader': username,
+ 'uploader_id': username,
+ 'formats': formats,
+ 'thumbnail': channel['data']['thumbnail'],
+ 'is_live': True,
+ 'view_count': channel['data']['viewCount']
+ }