Implement subscription from RSS feed

This commit is contained in:
BreadTube 2026-01-09 00:25:10 +09:00
commit aacceacd96
11 changed files with 185 additions and 271 deletions

BIN
tests/data/rss_feed_sample.xml (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,19 @@
import logging
from pathlib import Path
from breadtube_bot.youtube_manager import YoutubeManager
from breadtube_bot.youtube_subscription import ChannelInfo
def test_rss_parsing():
logger = logging.getLogger('breadtube-bot-test')
manager = YoutubeManager(logger=logger)
channel_info, videos = manager._parse_rss_data(Path('tests/data/rss_feed_sample.xml').read_text(encoding='utf-8'))
assert channel_info == ChannelInfo(
channel_id='UCFemKOoYVrTGUhuVzuNPt4A', title='Actu Réfractaire',
url='https://www.youtube.com/channel/UCFemKOoYVrTGUhuVzuNPt4A')
assert len(videos) == 15
video_ids = {'RZfVeU_iK0I', 'sLTFoRQHq3o', 'BcJ-ATQOQps', 'bOF1Pbtdg7U', '8yai5Maa1Wc', 'j1wU7JSUhe0',
'agAf1SdyK_Y', 'a4Kj_vUULfI', 'Sl2ukhsD7w0', 'wGSpwg0MC98', 'JNWkTB-7Zyk', '2I9rY7zSLPs',
'yR98Ur1BUJ8', 'HHBZ75L_vvY', 'tmBt6RCr6gQ'}
assert {video.video_id for video in videos} == video_ids