Add a few more docstrings about ytrss.
This commit is contained in:
parent
341c40ad1c
commit
7aef451b07
2 changed files with 15 additions and 0 deletions
|
@ -32,6 +32,13 @@ class Channel(Base):
|
||||||
return f'Channel:{self.id}'
|
return f'Channel:{self.id}'
|
||||||
|
|
||||||
def _rss_assisted_videos(self):
|
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:
|
try:
|
||||||
most_recent_video = self.get_most_recent_video_id()
|
most_recent_video = self.get_most_recent_video_id()
|
||||||
except exceptions.NoVideos as exc:
|
except exceptions.NoVideos as exc:
|
||||||
|
|
|
@ -21,12 +21,20 @@ def _get_user_videos(channel_id):
|
||||||
return video_ids
|
return video_ids
|
||||||
|
|
||||||
def get_user_videos(channel_id):
|
def get_user_videos(channel_id):
|
||||||
|
'''
|
||||||
|
Return the list of video ids from the channel.
|
||||||
|
Expect a maximum of 15 results.
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
return _get_user_videos(channel_id)
|
return _get_user_videos(channel_id)
|
||||||
except Exception:
|
except Exception:
|
||||||
raise exceptions.RSSAssistFailed(f'Failed to fetch RSS videos.') from exc
|
raise exceptions.RSSAssistFailed(f'Failed to fetch RSS videos.') from exc
|
||||||
|
|
||||||
def get_user_videos_since(channel_id, video_id):
|
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)
|
video_ids = get_user_videos(channel_id)
|
||||||
try:
|
try:
|
||||||
index = video_ids.index(video_id)
|
index = video_ids.index(video_id)
|
||||||
|
|
Loading…
Reference in a new issue