From 502358a953adc9a66fa258907a8d0a595023e239 Mon Sep 17 00:00:00 2001 From: tcely Date: Fri, 27 Jun 2025 13:46:23 -0400 Subject: [PATCH] Check the channel the user subscribed to, not the user's channel --- .../sync/management/commands/youtube-add-subscriptions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tubesync/sync/management/commands/youtube-add-subscriptions.py b/tubesync/sync/management/commands/youtube-add-subscriptions.py index 22524b8f..17af8582 100644 --- a/tubesync/sync/management/commands/youtube-add-subscriptions.py +++ b/tubesync/sync/management/commands/youtube-add-subscriptions.py @@ -27,18 +27,18 @@ class Command(BaseCommand): except urllib.error.HTTPError as e: self.stderr.write(e) subscriptions = info.get('subscriptions', []) - keys = ('channelId', 'title',) + keys = ('channelId', 'resourceId', 'title',) sources = [ { k:v for k,v in s.get('snippet', {}).items() \ if k in keys } for s in subscriptions \ - if s.get('snippet', {}).get(keys[0]) not in existing_sources + if s.get('snippet', {}).get(keys[1], {}).get(keys[0]) not in existing_sources ] d = json.dumps(sources, indent=4, sort_keys=True, cls=JSONEncoder) self.stdout.write(d) source_objs = [ - Source(key=s[keys[0]], name=s[keys[1]]) for s in sources + Source(key=s[keys[1]][keys[0]], name=s[keys[2]]) for s in sources ] for source in source_objs: source.source_type = YouTube_SourceType.CHANNEL_ID