use video class for channel_id extraction

This commit is contained in:
Simon 2024-05-12 21:08:37 +02:00
parent c413811e17
commit 77ee9cfc13
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
2 changed files with 7 additions and 5 deletions

View File

@ -4,12 +4,12 @@ Functionality:
- handle playlist subscriptions
"""
from home.src.download import queue # partial import
from home.src.download.thumbnails import ThumbManager
from home.src.download.yt_dlp_base import YtWrap
from home.src.es.connect import IndexPaginate
from home.src.index.channel import YoutubeChannel
from home.src.index.playlist import YoutubePlaylist
from home.src.index.video import YoutubeVideo
from home.src.index.video_constants import VideoTypeEnum
from home.src.ta.config import AppConfig
from home.src.ta.helper import is_missing
@ -341,8 +341,10 @@ class SubscriptionHandler:
if item["type"] == "video":
# extract channel id from video
vid = queue.PendingList().get_youtube_details(item["url"])
channel_id = vid["channel_id"]
video = YoutubeVideo(item["url"])
video.get_from_youtube()
video.process_youtube_meta()
channel_id = video.channel_id
elif item["type"] == "channel":
channel_id = item["url"]
else:

View File

@ -147,7 +147,7 @@ class YoutubeVideo(YouTubeItem, YoutubeSubtitle):
self.youtube_meta = youtube_meta_overwrite
self.offline_import = True
self._process_youtube_meta()
self.process_youtube_meta()
self._add_channel()
self._add_stats()
self.add_file_path()
@ -175,7 +175,7 @@ class YoutubeVideo(YouTubeItem, YoutubeSubtitle):
return integrate
def _process_youtube_meta(self):
def process_youtube_meta(self):
"""extract relevant fields from youtube"""
self._validate_id()
# extract