Fix logic for is_url

This is not perfect

Signed-off-by: lzzy12 <jhashivam2020@gmail.com>
This commit is contained in:
lzzy12 2019-09-26 05:53:51 +05:30
parent 6c082f7e77
commit 50020b0e6b

View File

@ -11,11 +11,10 @@ class DownloadHelper:
self.__is_torrent = False self.__is_torrent = False
def is_url(self, url: str): def is_url(self, url: str):
try: # TODO: Find the proper way to validate the url
urlparse(url) if url.startswith('https://') or url.startswith('http://'):
return True return True
except ValueError: return False
return False
def is_magnet(self, url: str): def is_magnet(self, url: str):
if "magnet" in url: if "magnet" in url: