Rename function
This commit is contained in:
parent
b74e93d2b7
commit
f47688812d
@ -21,7 +21,7 @@ from bdfr.site_downloaders.youtube import Youtube
|
||||
class DownloadFactory:
|
||||
@staticmethod
|
||||
def pull_lever(url: str) -> Type[BaseDownloader]:
|
||||
sanitised_url = DownloadFactory._sanitise_url(url)
|
||||
sanitised_url = DownloadFactory.sanitise_url(url)
|
||||
if re.match(r'(i\.)?imgur.*\.gifv$', sanitised_url):
|
||||
return Imgur
|
||||
elif re.match(r'.*/.*\.\w{3,4}(\?[\w;&=]*)?$', sanitised_url):
|
||||
@ -49,7 +49,7 @@ class DownloadFactory:
|
||||
f'No downloader module exists for url {url}')
|
||||
|
||||
@staticmethod
|
||||
def _sanitise_url(url: str) -> str:
|
||||
def sanitise_url(url: str) -> str:
|
||||
beginning_regex = re.compile(r'\s*(www\.?)?')
|
||||
split_url = urllib.parse.urlsplit(url)
|
||||
split_url = split_url.netloc + split_url.path
|
||||
|
@ -70,5 +70,5 @@ def test_factory_lever_bad(test_url: str):
|
||||
('https://i.imgur.com/BuzvZwb.gifv', 'i.imgur.com/BuzvZwb.gifv'),
|
||||
))
|
||||
def test_sanitise_url(test_url: str, expected: str):
|
||||
result = DownloadFactory._sanitise_url(test_url)
|
||||
result = DownloadFactory.sanitise_url(test_url)
|
||||
assert result == expected
|
||||
|
Loading…
Reference in New Issue
Block a user