]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/rokfin.py
[ie/crunchyroll] Fix stream extraction (#10005)
[yt-dlp.git] / yt_dlp / extractor / rokfin.py
index cad76f0c9947a76b7ef551693dae5b1334b5052e..3bc5f3cab293483e602b3b4b86f13d86f2db074d 100644 (file)
@@ -1,8 +1,8 @@
+import datetime as dt
 import itertools
 import json
 import re
 import urllib.parse
-from datetime import datetime
 
 from .common import InfoExtractor, SearchInfoExtractor
 from ..utils import (
@@ -38,7 +38,7 @@ class RokfinIE(InfoExtractor):
             'upload_date': '20211023',
             'timestamp': 1634998029,
             'channel': 'Jimmy Dore',
-            'channel_id': 65429,
+            'channel_id': '65429',
             'channel_url': 'https://rokfin.com/TheJimmyDoreShow',
             'availability': 'public',
             'live_status': 'not_live',
@@ -56,7 +56,7 @@ class RokfinIE(InfoExtractor):
             'upload_date': '20190412',
             'timestamp': 1555052644,
             'channel': 'Ron Placone',
-            'channel_id': 10,
+            'channel_id': '10',
             'channel_url': 'https://rokfin.com/RonPlacone',
             'availability': 'public',
             'live_status': 'not_live',
@@ -73,7 +73,7 @@ class RokfinIE(InfoExtractor):
             'thumbnail': r're:https://img\.production\.rokfin\.com/.+',
             'description': 'md5:324ce2d3e3b62e659506409e458b9d8e',
             'channel': 'TLAVagabond',
-            'channel_id': 53856,
+            'channel_id': '53856',
             'channel_url': 'https://rokfin.com/TLAVagabond',
             'availability': 'public',
             'is_live': False,
@@ -86,7 +86,6 @@ class RokfinIE(InfoExtractor):
             'dislike_count': int,
             'like_count': int,
             'tags': ['FreeThinkingMedia^'],
-            'duration': None,
         }
     }, {
         'url': 'https://rokfin.com/post/126703/Brave-New-World--Aldous-Huxley-DEEPDIVE--Chpts-13--Quite-Frankly--Jay-Dyer',
@@ -96,7 +95,7 @@ class RokfinIE(InfoExtractor):
             'title': 'Brave New World - Aldous Huxley DEEPDIVE!  (Chpts 1-3) - Quite Frankly & Jay Dyer',
             'thumbnail': r're:https://img\.production\.rokfin\.com/.+',
             'channel': 'Jay Dyer',
-            'channel_id': 186881,
+            'channel_id': '186881',
             'channel_url': 'https://rokfin.com/jaydyer',
             'availability': 'premium_only',
             'live_status': 'not_live',
@@ -116,7 +115,7 @@ class RokfinIE(InfoExtractor):
             'title': 'The Grayzone live on Nordstream blame game',
             'thumbnail': r're:https://image\.v\.rokfin\.com/.+',
             'channel': 'Max Blumenthal',
-            'channel_id': 248902,
+            'channel_id': '248902',
             'channel_url': 'https://rokfin.com/MaxBlumenthal',
             'availability': 'premium_only',
             'live_status': 'was_live',
@@ -157,7 +156,7 @@ def _real_extract(self, url):
                 self.raise_login_required('This video is only available to premium users', True, method='cookies')
             elif scheduled:
                 self.raise_no_formats(
-                    f'Stream is offline; scheduled for {datetime.fromtimestamp(scheduled).strftime("%Y-%m-%d %H:%M:%S")}',
+                    f'Stream is offline; scheduled for {dt.datetime.fromtimestamp(scheduled).strftime("%Y-%m-%d %H:%M:%S")}',
                     video_id=video_id, expected=True)
 
         uploader = traverse_obj(metadata, ('createdBy', 'username'), ('creator', 'username'))
@@ -174,7 +173,7 @@ def _real_extract(self, url):
             'like_count': int_or_none(metadata.get('likeCount')),
             'dislike_count': int_or_none(metadata.get('dislikeCount')),
             'channel': str_or_none(traverse_obj(metadata, ('createdBy', 'name'), ('creator', 'name'))),
-            'channel_id': traverse_obj(metadata, ('createdBy', 'id'), ('creator', 'id')),
+            'channel_id': str_or_none(traverse_obj(metadata, ('createdBy', 'id'), ('creator', 'id'))),
             'channel_url': url_or_none(f'https://rokfin.com/{uploader}') if uploader else None,
             'timestamp': timestamp,
             'release_timestamp': timestamp if live_status != 'not_live' else None,