Skip to content

Commit

Permalink
Merge pull request #635 from AbdullahM0hamed/animeout
Browse files Browse the repository at this point in the history
Add quality selection to animeout
  • Loading branch information
AbdullahM0hamed committed Mar 21, 2021
2 parents a47a524 + c097942 commit 655d583
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions anime_downloader/sites/animeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class AnimeOut(Anime, sitename='animeout'):

@classmethod
def search(cls, query):
search_results = helpers.soupify(helpers.get(cls.url, params={'s': query})).select('h3.post-title > a')
search_results = helpers.soupify(helpers.get(
cls.url, params={'s': query})).select('h3.post-title > a')
# Removes the unneded metadata from the title
# Used by MAL matcher
clean_title_regex = r'\(.*?\)'
Expand All @@ -31,7 +32,19 @@ def _scrape_episodes(self):
# Only uses the direct download links for consistency.
soup = helpers.soupify(helpers.get(self.url))
elements = soup.select('article.post a')
return [i.get('href') for i in elements if 'Direct Download' in i.text]
episodes = [i.get('href')
for i in elements if 'Direct Download' in i.text]

filters = [self.quality, "1080p", "720p"]
quality_filtered = []

for _filter in filters:
if not quality_filtered:
quality_filtered = [x for x in episodes if _filter in x]
else:
break

return episodes if not quality_filtered else quality_filtered

def _scrape_metadata(self):
soup = helpers.soupify(helpers.get(self.url))
Expand Down

0 comments on commit 655d583

Please sign in to comment.