Merge pull request #3 from vn-ki/circle

Circle CI nightly builds for anime
master
Vishnunarayan K I 2018-06-11 23:15:21 +05:30 committed by GitHub
commit d9c11facfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 78 additions and 9 deletions

49
.circleci/config.yml Normal file
View File

@ -0,0 +1,49 @@
pip-run: &pip-install
name: Install Python dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install pytest
pip install -e .[cloudflare]
version: 2
jobs:
nineanime:
docker:
- image: circleci/python:3.6
steps:
- checkout
- run: *pip-install
- run: venv/bin/python -m pytest tests/test_anime.py --anime-url https://www4.9anime.is/watch/kochinpa.p6l6/j6ooy2
kissanime:
docker:
- image: circleci/python:3.6
steps:
- checkout
- run: *pip-install
- run: venv/bin/python -m pytest tests/test_anime.py --anime-url http://kissanime.ru/Anime/Kochin-Pa
gogoanime:
docker:
- image: circleci/python:3.6
steps:
- checkout
- run: *pip-install
- run: venv/bin/python -m pytest tests/test_anime.py --anime-url https://www2.gogoanime.se/category/kochin-pa-
workflows:
version: 2
nightly:
jobs:
- nineanime
- gogoanime
# Kissanime will always fail on remote servers due to cloudflare
# - kissanime
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master

View File

@ -22,6 +22,8 @@ Yeah. Me too! That's why this tool exists.
## Supported Sites
[![CircleCI](https://circleci.com/gh/vn-ki/anime-downloader/tree/master.svg?style=svg)](https://circleci.com/gh/vn-ki/anime-downloader/tree/master)
- 9anime
- KissAnime [cloudflare]
- KissCartoon [cloudflare]

View File

@ -2,11 +2,12 @@
from setuptools import setup, find_packages
import re
import io
with open('README.md', 'r') as f:
long_description = f.read()
with open('anime_downloader/__version__.py', 'rt', encoding='utf8') as f:
with io.open('anime_downloader/__version__.py', 'rt', encoding='utf8') as f:
version = re.search(r'__version__ = \'(.*?)\'', f.read()).group(1)
@ -25,6 +26,9 @@ setup(
'Click>=6.7',
'fuzzywuzzy>=0.16.0',
],
tests_require=[
'pytest',
],
extras_require={
'cloudflare': ['cfscrape>=1.9.5']
},

15
tests/conftest.py Normal file
View File

@ -0,0 +1,15 @@
import pytest
def pytest_addoption(parser):
parser.addoption(
'--anime-url',
action='store',
default='https://www4.9anime.is/watch/kochinpa.p6l6/j6ooy2',
help='URL for (kochinpa!) anime for a specific site'
)
@pytest.fixture
def anime_url(request):
return request.config.getoption('--anime-url')

View File

@ -1,13 +1,15 @@
from anime_downloader import get_anime_class
from anime_downloader.sites.nineanime import NineAnime
import pytest
@pytest.fixture
def anime():
return NineAnime(
'https://www4.9anime.is/watch/kochinpa.p6l6/j6ooy2',
quality='360p'
def anime(anime_url):
cls = get_anime_class(anime_url)
return cls(
anime_url, quality='360p'
)
@ -16,14 +18,11 @@ def test_length(anime):
def test_title(anime):
assert anime.title.lower() == 'kochinpa!'
assert anime.title.lower() in ['kochinpa!', 'kochin pa!']
def test_episode(anime):
episode1 = anime[0]
assert episode1.title.lower(
) == 'tw caffeine chihiro chyuu cthuko ctss damedesuyo dmo eraser evetaku first fff flax hatsuyuki hiryuu kaylith kaitou notsentai p saenaisubs scribbles tsundere watashi yolo kochinpa 01.e.mp4'
assert episode1.stream_url.endswith('.mp4')