Refactor Erome class

This commit is contained in:
Serene-Arc authored and Ali Parlakci committed 2021-04-18 16:44:34 +03:00
1 parent 6a1e652628
commit 902f796178
2 files changed
+8 -30

No files matched your search

+6 -17
View File
@@ -25,23 +25,12 @@ class Erome(BaseDownloader):
if not links:
raise NotADownloadableLinkError('Erome parser could not find any links')
if len(links) == 1:
link = links.pop()
link = self._validate_url(link)
return [Resource(self.post, link)]
else:
out = []
for i, link in enumerate(links):
link = self._validate_url(link)
out.append(Resource(self.post, link))
return out
@staticmethod
def _validate_url(image):
if not re.match(r'https?://.*', image):
image = "https://" + image
return image
out = []
for link in links:
if not re.match(r'https?://.*', link):
link = 'https://' + link
out.append(Resource(self.post, link))
return out
@staticmethod
def _get_links(url: str) -> set[str]: