Check the channel the user subscribed to, not the user's channel

This commit is contained in:
tcely authored and GitHub committed 2025-06-27 13:46:23 -04:00
1 parent bdbeed0983
commit 502358a953
1 file changed
+3 -3
@@ -27,18 +27,18 @@ class Command(BaseCommand):
except urllib.error.HTTPError as e: except urllib.error.HTTPError as e:
self.stderr.write(e) self.stderr.write(e)
subscriptions = info.get('subscriptions', []) subscriptions = info.get('subscriptions', [])
keys = ('channelId', 'title',) keys = ('channelId', 'resourceId', 'title',)
sources = [ sources = [
{ {
k:v for k,v in s.get('snippet', {}).items() \ k:v for k,v in s.get('snippet', {}).items() \
if k in keys if k in keys
} for s in subscriptions \ } 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) d = json.dumps(sources, indent=4, sort_keys=True, cls=JSONEncoder)
self.stdout.write(d) self.stdout.write(d)
source_objs = [ 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: for source in source_objs:
source.source_type = YouTube_SourceType.CHANNEL_ID source.source_type = YouTube_SourceType.CHANNEL_ID