fix: not directly adding all sources
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
415210522f
commit
95d1df3530
@ -36,16 +36,16 @@ class Source:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def match_url(cls, url: str, referrer_page: SourcePages) -> Optional[Source]:
|
def match_url(cls, url: str, referrer_page: SourcePages) -> Optional[Source]:
|
||||||
"""
|
"""
|
||||||
this shouldn't be used, unlesse you are not certain what the source is for
|
this shouldn't be used, unless you are not certain what the source is for
|
||||||
the reason is that it is more inefficient
|
the reason is that it is more inefficient
|
||||||
"""
|
"""
|
||||||
parsed = urlparse(url)
|
parsed_url = urlparse(url)
|
||||||
url = parsed.geturl()
|
url = parsed_url.geturl()
|
||||||
|
|
||||||
if "musify" in parsed.netloc:
|
if "musify" in parsed_url.netloc:
|
||||||
return cls(SourcePages.MUSIFY, url, referrer_page=referrer_page)
|
return cls(SourcePages.MUSIFY, url, referrer_page=referrer_page)
|
||||||
|
|
||||||
if parsed.netloc in [_url.netloc for _url in youtube_settings['youtube_url']]:
|
if parsed_url.netloc in [_url.netloc for _url in youtube_settings['youtube_url']]:
|
||||||
return cls(SourcePages.YOUTUBE, url, referrer_page=referrer_page)
|
return cls(SourcePages.YOUTUBE, url, referrer_page=referrer_page)
|
||||||
|
|
||||||
if url.startswith("https://www.deezer"):
|
if url.startswith("https://www.deezer"):
|
||||||
@ -57,7 +57,7 @@ class Source:
|
|||||||
if "bandcamp" in url:
|
if "bandcamp" in url:
|
||||||
return cls(SourcePages.BANDCAMP, url, referrer_page=referrer_page)
|
return cls(SourcePages.BANDCAMP, url, referrer_page=referrer_page)
|
||||||
|
|
||||||
if "wikipedia" in parsed.netloc:
|
if "wikipedia" in parsed_url.netloc:
|
||||||
return cls(SourcePages.WIKIPEDIA, url, referrer_page=referrer_page)
|
return cls(SourcePages.WIKIPEDIA, url, referrer_page=referrer_page)
|
||||||
|
|
||||||
if url.startswith("https://www.metal-archives.com/"):
|
if url.startswith("https://www.metal-archives.com/"):
|
||||||
|
Loading…
Reference in New Issue
Block a user