diff options
author | Astound <kirito@disroot.org> | 2024-01-22 05:55:59 +0800 |
---|---|---|
committer | Astound <kirito@disroot.org> | 2024-01-22 05:55:59 +0800 |
commit | ca4a7356924450f21228e823b4bcc1416aea05d3 (patch) | |
tree | 4078c2b3b0b3aab29bd2f7fca58e8ce74f65e48a /youtube | |
parent | 2140f489192f98284811e7cbaba8b6fa0e552bf7 (diff) | |
download | yt-local-ca4a7356924450f21228e823b4bcc1416aea05d3.tar.lz yt-local-ca4a7356924450f21228e823b4bcc1416aea05d3.tar.xz yt-local-ca4a7356924450f21228e823b4bcc1416aea05d3.zip |
Add settings for filtering out shorts in subscriptions and channels
Diffstat (limited to 'youtube')
-rw-r--r-- | youtube/channel.py | 4 | ||||
-rw-r--r-- | youtube/subscriptions.py | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/youtube/channel.py b/youtube/channel.py index aaf4f79..75b0a15 100644 --- a/youtube/channel.py +++ b/youtube/channel.py @@ -2,6 +2,7 @@ import base64 from youtube import (util, yt_data_extract, local_playlist, subscriptions, playlist) from youtube import yt_app +import settings import urllib import json @@ -382,7 +383,8 @@ def get_channel_page_general_url(base_url, tab, request, channel_id=None): # sort 2: oldest # sort 3: newest # sort 4: newest - no shorts (Just a kludge on our end, not internal to yt) - sort = request.args.get('sort', '3') + default_sort = '3' if settings.include_shorts_in_channel else '4' + sort = request.args.get('sort', default_sort) view = request.args.get('view', '1') query = request.args.get('query', '') ctoken = request.args.get('ctoken', '') diff --git a/youtube/subscriptions.py b/youtube/subscriptions.py index ea544a3..e37ac28 100644 --- a/youtube/subscriptions.py +++ b/youtube/subscriptions.py @@ -464,8 +464,12 @@ def _get_atoma_feed(channel_id): def _get_channel_videos_first_page(channel_id, channel_status_name): try: # First try the playlist method - pl_json = playlist.get_videos('UU' + channel_id[2:], 1, - include_shorts=False, report_text=None) + pl_json = playlist.get_videos( + 'UU' + channel_id[2:], + 1, + include_shorts=settings.include_shorts_in_subscriptions, + report_text=None + ) pl_info = yt_data_extract.extract_playlist_info(pl_json) if pl_info.get('items'): pl_info['items'] = pl_info['items'][0:30] |