From 858db521fb0c1ab9d16c881462b8c6e85da6d2f5 Mon Sep 17 00:00:00 2001 From: 7x11x13 Date: Wed, 10 Jan 2024 21:24:25 -0500 Subject: [PATCH] Fix downloading when tralbum-about is not found --- free_bandcamp_downloader/__main__.py | 6 ++++-- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/free_bandcamp_downloader/__main__.py b/free_bandcamp_downloader/__main__.py index 69c8072..931de4a 100644 --- a/free_bandcamp_downloader/__main__.py +++ b/free_bandcamp_downloader/__main__.py @@ -209,8 +209,10 @@ class BCFreeDownloader: @staticmethod def _get_album_data_from_soup(soup: BeautifulSoup) -> BCFreeDownloaderAlbumData: album_data = BCFreeDownloaderAlbumData() - album_data.about = soup.find("div", class_="tralbum-about").get_text("\n") - album_data.credits = soup.find("div", class_="tralbum-credits").get_text("\n") + about = soup.find("div", class_="tralbum-about") + album_data.about = about.get_text("\n") if about else None + credits = soup.find("div", class_="tralbum-credits") + album_data.credits = credits.get_text("\n") if credits else None tags = [tag.get_text() for tag in soup.find_all("a", class_="tag")] album_data.tags = ",".join(sorted(tags)) return album_data diff --git a/pyproject.toml b/pyproject.toml index eff88ff..10a29e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "free-bandcamp-downloader" -version = "0.1.3" +version = "0.1.4" description = "Download free and name-your-price albums from Bandcamp" authors = ["7x11x13 "] license = "MIT"