feat: fixed cache plus concisten cache throughout musify
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Hellow
2024-04-26 01:05:22 +02:00
parent a015b8918e
commit 3d94e6e2dd
8 changed files with 38 additions and 127 deletions

View File

@@ -121,6 +121,7 @@ class Musify(Page):
self.connection: Connection = Connection(
host="https://musify.club/",
logger=self.LOGGER,
module="musify",
)
self.stream_connection: Connection = Connection(
@@ -393,10 +394,11 @@ class Musify(Page):
return search_results
def fetch_song(self, source: Source, stop_at_level: int = 1) -> Song:
# https://musify.club/track/linkin-park-numb-210765
r = self.connection.get(source.url)
musify_url = parse_url(source.url)
r = self.connection.get(source.url, name="track_" + musify_url.name_with_id)
if r is None:
return Song
return Song()
soup = self.get_soup_from_response(r)
@@ -672,7 +674,7 @@ class Musify(Page):
url = parse_url(source.url)
endpoint = self.HOST + "/release/" + url.name_with_id
r = self.connection.get(endpoint)
r = self.connection.get(endpoint, name=url.name_with_id)
if r is None:
return Album()
@@ -709,7 +711,7 @@ class Musify(Page):
:return:
"""
r = self.connection.get(f"https://musify.club/{url.source_type.value}/{url.name_with_id}?_pjax=#bodyContent")
r = self.connection.get(f"https://musify.club/{url.source_type.value}/{url.name_with_id}?_pjax=#bodyContent", name="artist_attributes_" + url.name_with_id)
if r is None:
return Artist()
@@ -1075,7 +1077,7 @@ class Musify(Page):
"SortOrder.Property": "dateCreated",
"SortOrder.IsAscending": False,
"X-Requested-With": "XMLHttpRequest"
})
}, name="discography_" + url.name_with_id)
if r is None:
return []
soup: BeautifulSoup = BeautifulSoup(r.content, features="html.parser")