diff --git a/personal_data/fetchers/youtube.py b/personal_data/fetchers/youtube.py index 6b3de5b..a193bf2 100644 --- a/personal_data/fetchers/youtube.py +++ b/personal_data/fetchers/youtube.py @@ -37,8 +37,17 @@ class YoutubeFavoritesScraper(Scraper): def to_csv(self, videos: list[dict]) -> str: """Convert the list of videos to CSV format.""" headers = ['id', 'title', 'url', 'upload_date'] - rows = [headers] + [[video.get('id'), video.get('title'), video.get('url'), video.get('upload_date')] for video in videos] + rows = [headers] + [ + [ + video.get('id'), + video.get('title'), + video.get('url'), + video.get('upload_date'), + ] + for video in videos + ] from io import StringIO + sio = StringIO() csv.writer(sio).writerows(rows) return sio.getvalue()