fetching notes

This commit is contained in:
Hellow 2023-03-17 23:55:38 +01:00
parent 5d0f9814c8
commit 5bd9439104
2 changed files with 11 additions and 4 deletions

View File

@ -588,7 +588,8 @@ class Musify(Page):
""" """
name = "" name = ""
source_list: List[Source] = [] source_list: List[Source] = []
county = None country = None
notes: FormattedText = None
breadcrumbs: BeautifulSoup = soup.find("ol", {"class": "breadcrumb"}) breadcrumbs: BeautifulSoup = soup.find("ol", {"class": "breadcrumb"})
if breadcrumbs is not None: if breadcrumbs is not None:
@ -645,11 +646,17 @@ class Musify(Page):
country = pycountry.countries.get(alpha_2=list(country_set)[0]) country = pycountry.countries.get(alpha_2=list(country_set)[0])
note_soup: BeautifulSoup = soup.find(id="text-main")
if note_soup is not None:
notes = FormattedText(html=note_soup.decode_contents())
print(notes.plaintext)
return Artist( return Artist(
_id=url.musify_id, _id=url.musify_id,
name=name, name=name,
country=county, country=country,
source_list=source_list source_list=source_list,
notes=notes
) )
@classmethod @classmethod

View File

@ -10,7 +10,7 @@ def search():
def fetch_artist(): def fetch_artist():
artist = objects.Artist( artist = objects.Artist(
name="Ghost Bath", name="Ghost Bath",
source_list=[objects.Source(objects.SourcePages.MUSIFY, "https://musify.club/artist/ghost-bath-280348")] source_list=[objects.Source(objects.SourcePages.MUSIFY, "https://musify.club/artist/psychonaut-4-83193")]
) )
artist = Musify.fetch_details(artist) artist = Musify.fetch_details(artist)