From 7aef451b07d4c2e07bf4496dd89fa20756003ed4 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Wed, 31 Mar 2021 14:35:31 -0700 Subject: [PATCH] Add a few more docstrings about ytrss. --- ycdl/objects.py | 7 +++++++ ycdl/ytrss.py | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/ycdl/objects.py b/ycdl/objects.py index 0d6a6ae..465a0ea 100644 --- a/ycdl/objects.py +++ b/ycdl/objects.py @@ -32,6 +32,13 @@ class Channel(Base): return f'Channel:{self.id}' def _rss_assisted_videos(self): + ''' + RSS-assisted refresh will use the channel's RSS feed to find videos + that are newer than the most recent video we have in the database. + Then, these new videos can be queried using the regular API since the + RSS doesn't contain all the attributes we need. This saves us from + wasting any metered API calls in the case that the RSS has nothing new. + ''' try: most_recent_video = self.get_most_recent_video_id() except exceptions.NoVideos as exc: diff --git a/ycdl/ytrss.py b/ycdl/ytrss.py index 4676397..f63e15c 100644 --- a/ycdl/ytrss.py +++ b/ycdl/ytrss.py @@ -21,12 +21,20 @@ def _get_user_videos(channel_id): return video_ids def get_user_videos(channel_id): + ''' + Return the list of video ids from the channel. + Expect a maximum of 15 results. + ''' try: return _get_user_videos(channel_id) except Exception: raise exceptions.RSSAssistFailed(f'Failed to fetch RSS videos.') from exc def get_user_videos_since(channel_id, video_id): + ''' + Return the list of video ids that are more recently released than the + reference id. + ''' video_ids = get_user_videos(channel_id) try: index = video_ids.index(video_id)