finished fetching of single song

This commit is contained in:
Hellow2 2023-06-20 12:52:00 +02:00
parent d5717c9a6b
commit 0a8a96c546
2 changed files with 18 additions and 2 deletions

View File

@ -13,7 +13,7 @@ if __name__ == "__main__":
] ]
fetch_musify_song = [ fetch_musify_song = [
"s: https://musify.club/track/linkin-park-numb-210765" "s: https://musify.club/track/blokkmonsta-schwartz-crystal-f-purer-hass-8369115"
] ]
youtube_search = [ youtube_search = [

View File

@ -397,7 +397,7 @@ class Musify(Page):
def _parse_artist_anchor(artist_soup: BeautifulSoup): def _parse_artist_anchor(artist_soup: BeautifulSoup):
nonlocal artist_list nonlocal artist_list
if artist_anchor is None: if artist_soup is None:
return return
artist_src_list = [] artist_src_list = []
@ -437,6 +437,22 @@ class Musify(Page):
if href is not None: if href is not None:
source.audio_url = self.HOST + href source.audio_url = self.HOST + href
# song detail
album_info: BeautifulSoup
for album_info in soup.find_all("ul", {"class": "album-info"}):
list_element: BeautifulSoup = album_info.find("li")
if list_element is not None:
artist_soup: BeautifulSoup
for artist_soup in list_element.find_all("a"):
artist_source_list = []
href = artist_soup["href"]
if href is not None:
artist_source_list = [Source(self.SOURCE_TYPE, self.HOST + href)]
artist_list.append(Artist(
name=artist_soup.text.strip(),
source_list=artist_source_list
))
# breadcrums # breadcrums
breadcrumb_list_element_list: List[BeautifulSoup] = soup.find_all("ol", {"class": "breadcrumb"}) breadcrumb_list_element_list: List[BeautifulSoup] = soup.find_all("ol", {"class": "breadcrumb"})