Refactor Erome class

This commit is contained in:
Serene-Arc
2021-03-19 22:49:25 +10:00
committed by Ali Parlakci
parent 6a1e652628
commit 902f796178
2 changed files with 8 additions and 30 deletions

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]: