Skip to content

Commit

Permalink
Fix downloading when tralbum-about is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
7x11x13 committed Jan 11, 2024
1 parent 2e30f2e commit 858db52
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions free_bandcamp_downloader/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,10 @@ def download(download_url: str) -> str:
@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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 858db52

Please sign in to comment.