Add kisscartoon support
parent
63e2befe16
commit
dd705af662
|
@ -21,7 +21,8 @@ Yeah. Me too! That's why this tool exists.
|
|||
## Supported Sites
|
||||
|
||||
- 9anime
|
||||
- KissAnime
|
||||
- KissAnime [cloudflare]
|
||||
- KissCartoon [cloudflare]
|
||||
|
||||
## Installation
|
||||
|
||||
|
@ -36,13 +37,13 @@ $ pip install -U git+https://github.com/vn-ki/anime-downloader.git
|
|||
```
|
||||
*NOTE: You might have to use pip3 depending on your system*
|
||||
|
||||
KissAnime support is currently only available in master. Use the following command to install with KissAnime support.
|
||||
Cloudflare support is currently only available in master. Use the following command to install with cloudflare support.
|
||||
|
||||
```bash
|
||||
pip install -U git+https://github.com/vn-ki/anime-downloader.git#egg=anime-downloader'[cloudflare]'
|
||||
```
|
||||
|
||||
**IMP**: For KissAnime scraping [cfscrape](https://github.com/Anorov/cloudflare-scrape) is used. It depends on `node-js`. So if you want to use KissAnime, make sure you have node installed.
|
||||
**IMP**: For cloudflare scraping [cfscrape](https://github.com/Anorov/cloudflare-scrape) is used. It depends on `node-js`. So if you want to use cloudflare, make sure you have node installed.
|
||||
|
||||
## Usage
|
||||
|
||||
|
|
|
@ -72,11 +72,11 @@ def dl(ctx, anime_url, episode_range, save_playlist, url, player, skip_download,
|
|||
if episode_range is None:
|
||||
episode_range = '1:'+str(len(anime)+1)
|
||||
|
||||
if download_dir:
|
||||
logging.info('Downloading to {}'.format(os.path.abspath(download_dir)))
|
||||
|
||||
logging.info('Found anime: {}'.format(anime.title))
|
||||
|
||||
if download_dir and not skip_download:
|
||||
logging.info('Downloading to {}'.format(os.path.abspath(download_dir)))
|
||||
|
||||
try:
|
||||
start, end = [int(x) for x in episode_range.split(':')]
|
||||
anime._episodeIds = anime._episodeIds[start-1:end-1]
|
||||
|
|
|
@ -3,6 +3,7 @@ from anime_downloader.sites.nineanime import NineAnime
|
|||
|
||||
try:
|
||||
from anime_downloader.sites.kissanime import Kissanime
|
||||
from anime_downloader.sites.kisscartoon import Kisscarton
|
||||
except ImportError:
|
||||
CFSCRAPE = False
|
||||
|
||||
|
|
|
@ -69,3 +69,7 @@ class Kissanime(BaseAnimeCF):
|
|||
raise NotFoundError(err, *args)
|
||||
|
||||
return list(reversed(ret))
|
||||
|
||||
def _getMetadata(self, soup):
|
||||
info_div = soup.find('div', {'class': 'barContent'})
|
||||
self.title = info_div.find('a', {'class': 'bigChar'}).text
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
from anime_downloader.sites.kissanime import Kissanime, KissanimeEpisode
|
||||
from bs4 import BeautifulSoup
|
||||
from anime_downloader.sites.exceptions import NotFoundError
|
||||
|
||||
|
||||
class KissasianEpisode(KissanimeEpisode):
|
||||
_base_url = ''
|
||||
VERIFY_HUMAN = False
|
||||
|
||||
# def _scrape_episode(self, reponse):
|
||||
# soup = BeautifulSoup(reponse.text, 'html.parser')
|
||||
# data = dict()
|
||||
# data['stream_url'] = soup.find_all('iframe')
|
||||
# data['title'] = ''
|
||||
# data['image'] = ''
|
||||
# return data
|
||||
|
||||
|
||||
class Kissasian(Kissanime):
|
||||
sitename = 'kisscartoon'
|
||||
_episodeClass = KissasianEpisode
|
||||
|
||||
def _getEpisodeUrls(self, soup):
|
||||
ret = soup.find('div', {'class': 'listing'}).find_all('a')
|
||||
ret = [str(a['href']) for a in ret]
|
||||
|
||||
if ret == []:
|
||||
err = 'No episodes found in url "{}"'.format(self.url)
|
||||
args = [self.url]
|
||||
raise NotFoundError(err, *args)
|
||||
|
||||
return list(reversed(ret))
|
|
@ -0,0 +1,42 @@
|
|||
from anime_downloader.sites.kissanime import Kissanime
|
||||
from anime_downloader.sites.anime import BaseEpisode
|
||||
from anime_downloader.sites.exceptions import NotFoundError
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
class KisscartoonEpisode(BaseEpisode):
|
||||
_base_url = ''
|
||||
VERIFY_HUMAN = False
|
||||
_api_url = 'https://kisscartoon.ac/ajax/anime/load_episodes?v=1.1&episode_id={}'
|
||||
QUALITIES = ['720p']
|
||||
|
||||
def getData(self):
|
||||
ep_id = self.episode_id.split('id=')[-1]
|
||||
url = self._api_url.format(ep_id)
|
||||
res = requests.get(url)
|
||||
url = res.json()['value']
|
||||
|
||||
headers = {'referer': self.episode_id}
|
||||
res = requests.get('https:' + url, headers=headers)
|
||||
|
||||
self.stream_url = res.json()['playlist'][0]['file']
|
||||
self.title = self.episode_id.split(
|
||||
'Cartoon/')[-1].split('.')[0] + self.episode_id.split(
|
||||
'Episode')[-1].split('?')[0]
|
||||
|
||||
|
||||
class Kisscarton(Kissanime):
|
||||
sitename = 'kisscartoon'
|
||||
_episodeClass = KisscartoonEpisode
|
||||
|
||||
def _getEpisodeUrls(self, soup):
|
||||
ret = soup.find('div', {'class': 'listing'}).find_all('a')
|
||||
ret = [str(a['href']) for a in ret]
|
||||
|
||||
if ret == []:
|
||||
err = 'No episodes found in url "{}"'.format(self.url)
|
||||
args = [self.url]
|
||||
raise NotFoundError(err, *args)
|
||||
|
||||
return list(reversed(ret))
|
Loading…
Reference in New Issue