Skip to content

Commit

Permalink
Merge pull request #247 from pjzzz/animeflix
Browse files Browse the repository at this point in the history
website addition: animeflix.io
  • Loading branch information
vn-ki committed Oct 18, 2019
2 parents de62539 + 5d6a549 commit e12ec08
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Yeah. Me too! That's why this tool exists.
- Animeflv (Latin)
- itsaturday.com
- Animefreak
- Animeflix
- Masterani.me [cloudlfare] (site shut down**

## Installation
Expand Down
57 changes: 57 additions & 0 deletions anime_downloader/sites/animeflix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
from anime_downloader.sites.anime import Anime, AnimeEpisode, SearchResult
from anime_downloader.sites import helpers


class AnimeFlix(Anime, sitename='animeflix'):
"""
Site :https://animeflix.io/
"""
sitename = 'animeflix'
search_url = 'https://www.animeflix.io/api/search'
anime_url = 'https://www.animeflix.io/shows'
episodeList_url = 'https://www.animeflix.io/api/anime-schema'
meta_url = 'https://animeflix.io/api/anime/detail'
QUALITIES = ['360p', '480p', '720p', '1080p']

@classmethod
def search(cls, query):
search_results = helpers.get(cls.search_url,
params={'q' : query}).json()
search_results = [
SearchResult(
title=result['title'],
url=f'{cls.anime_url}/{result["slug"]}',
)
for result in search_results.get('data',[])
]

return search_results

def _scrape_episodes(self):
# TODO: find a better way to do splits
# find a way to pass some values within the class
self.slug = self.url.strip('/').split('/')[-1]
episodes = helpers.get(self.episodeList_url,
params={'slug': self.slug}).json()
return [ self.anime_url + episode['url'] for episode in episodes['episodes'] ]

def _scrape_metadata(self):
meta = helpers.get(self.meta_url,
params={'slug': self.slug}).json()
self.title = meta['data']['title']



class AnimeFlixEpisode(AnimeEpisode, sitename='animeflix'):
episodeId_url = 'https://animeflix.io/api/episode'
stream_url = 'https://animeflix.io/api/videos?episode_id'
anime_url = 'https://www.animeflix.io/shows'

def _get_sources(self):
episode = helpers.get(self.episodeId_url,
params={'episode_num': self.ep_no, 'slug': self.url.strip('/').split('/')[-2]}).json()
id = episode['data']['current']['id']
download_link = helpers.get(
f'{self.stream_url}={id}').json()[0]['file']
return [('no_extractor',download_link)]
1 change: 1 addition & 0 deletions anime_downloader/sites/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
('animeflv', 'animeflv', 'Animeflv'),
('itsaturday', 'itsaturday', 'Itsaturday'),
('animefreak', 'animefreak', 'AnimeFreak'),
('animeflix', 'animeflix', 'AnimeFlix'),
]


Expand Down

0 comments on commit e12ec08

Please sign in to comment.