Use voussoirkit.vlogging for loud.
This commit is contained in:
parent
a3f69573a4
commit
aabb6691f0
1 changed files with 8 additions and 3 deletions
|
@ -1,10 +1,12 @@
|
|||
import bs4
|
||||
import logging
|
||||
import requests
|
||||
|
||||
from voussoirkit import vlogging
|
||||
|
||||
from . import exceptions
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
log = vlogging.getLogger(__name__)
|
||||
|
||||
session = requests.Session()
|
||||
|
||||
def _get_user_videos(uid):
|
||||
|
@ -15,6 +17,7 @@ def _get_user_videos(uid):
|
|||
soup = bs4.BeautifulSoup(response.text, 'lxml')
|
||||
# find_all does not work on namespaced tags unless you add a limit paramter.
|
||||
video_ids = [v.text for v in soup.find_all('yt:videoid', limit=9999)]
|
||||
log.loud('RSS got %s.', video_ids)
|
||||
return video_ids
|
||||
|
||||
def get_user_videos(uid):
|
||||
|
@ -29,4 +32,6 @@ def get_user_videos_since(uid, most_recent_video):
|
|||
index = video_ids.index(most_recent_video)
|
||||
except ValueError:
|
||||
raise exceptions.RSSAssistFailed(f'RSS didn\'t contain {most_recent_video}.')
|
||||
return video_ids[:index]
|
||||
video_ids = video_ids[:index]
|
||||
log.loud('Since %s: %s', most_recent_video, str(video_ids))
|
||||
return video_ids
|
||||
|
|
Loading…
Reference in a new issue