fix/musify_artist_spam #27

Merged
Hazel merged 6 commits from fix/musify_artist_spam into experimental 2024-05-08 10:31:24 +00:00
2 changed files with 8 additions and 5 deletions
Showing only changes of commit 960d3b74ac - Show all commits

View File

@ -7,7 +7,7 @@ logging.getLogger().setLevel(logging.DEBUG)
if __name__ == "__main__":
commands = [
"s: #a Crystal F",
"dm: 10, 20"
"10"
]

View File

@ -961,7 +961,7 @@ class Musify(Page):
source_list=source_list,
date=timestamp,
album_type=album_type,
album_status=album_status
album_status=album_status,
)
def _parse_album(self, soup: BeautifulSoup) -> Album:
@ -1054,7 +1054,7 @@ class Musify(Page):
date=date
)
def _get_discography(self, url: MusifyUrl, artist_name: str = None, stop_at_level: int = 1) -> Generator[Album, None, None]:
def _get_discography(self, artist: Artist, url: MusifyUrl, artist_name: str = None, stop_at_level: int = 1) -> Generator[Album, None, None]:
"""
POST https://musify.club/artist/filteralbums
ArtistID: 280348
@ -1076,7 +1076,10 @@ class Musify(Page):
soup: BeautifulSoup = BeautifulSoup(r.content, features="html.parser")
for card_soup in soup.find_all("div", {"class": "card"}):
yield self._parse_album_card(card_soup, artist_name)
album = self._parse_album_card(card_soup, artist_name)
if album.album_type is AlbumType.COMPILATION_ALBUM or album.album_type is AlbumType.MIXTAPE:
continue
artist.main_album_collection.append(album)
def fetch_artist(self, source: Source, stop_at_level: int = 1) -> Artist:
"""
@ -1098,7 +1101,7 @@ class Musify(Page):
artist = self._get_artist_attributes(url)
artist.main_album_collection.extend(self._get_discography(url, artist.name))
self._get_discography(artist, url, artist.name)
return artist