Add a few more docstrings about ytrss.

This commit is contained in:
voussoir 2021-03-31 14:35:31 -07:00
parent 341c40ad1c
commit 7aef451b07
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
2 changed files with 15 additions and 0 deletions

View file

@ -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:

View file

@ -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)