Fix anime-ultime
This commit is contained in:
parent
6fd4708b22
commit
e4fcc45e7d
49
poetry.lock
generated
49
poetry.lock
generated
@ -282,14 +282,14 @@ six = ">=1.13.0"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dateparser"
|
name = "dateparser"
|
||||||
version = "1.1.5"
|
version = "1.1.6"
|
||||||
description = "Date parsing library designed to parse dates from HTML pages"
|
description = "Date parsing library designed to parse dates from HTML pages"
|
||||||
category = "main"
|
category = "main"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
{file = "dateparser-1.1.5-py2.py3-none-any.whl", hash = "sha256:ceb159f1b4a9df54ed6209e91298097deafde476037f8611b4cb2b1cb8b31c58"},
|
{file = "dateparser-1.1.6-py2.py3-none-any.whl", hash = "sha256:c47b6e4b8c4b2b2a21690111b6571b6991295ba327ec6503753abeebf5e80696"},
|
||||||
{file = "dateparser-1.1.5.tar.gz", hash = "sha256:107f3cc87a60770e10d111349adc1504224a6b60753a47a64b0ec842ab85b5a9"},
|
{file = "dateparser-1.1.6.tar.gz", hash = "sha256:e703db1815270c020552f4b3e3a981937b48b2cbcfcef5347071b74788dd9214"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
@ -361,14 +361,14 @@ test = ["pytest (>=6)"]
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "faker"
|
name = "faker"
|
||||||
version = "15.3.4"
|
version = "16.4.0"
|
||||||
description = "Faker is a Python package that generates fake data for you."
|
description = "Faker is a Python package that generates fake data for you."
|
||||||
category = "dev"
|
category = "dev"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
{file = "Faker-15.3.4-py3-none-any.whl", hash = "sha256:c2a2ff9dd8dfd991109b517ab98d5cb465e857acb45f6b643a0e284a9eb2cc76"},
|
{file = "Faker-16.4.0-py3-none-any.whl", hash = "sha256:5420467fad3fa582094057754e5e81326cb1f51ab822bf9df96c077cfb35ae49"},
|
||||||
{file = "Faker-15.3.4.tar.gz", hash = "sha256:2d5443724f640ce07658ca8ca8bbd40d26b58914e63eec6549727869aa67e2cc"},
|
{file = "Faker-16.4.0.tar.gz", hash = "sha256:dcffdca8ec9a715982bcd5f53ee688dc4784cd112f9910f8f7183773eb3ec276"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
@ -637,14 +637,14 @@ testing = ["flake8 (<5)", "flufl.flake8", "importlib-resources (>=1.3)", "packag
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iniconfig"
|
name = "iniconfig"
|
||||||
version = "1.1.1"
|
version = "2.0.0"
|
||||||
description = "iniconfig: brain-dead simple config-ini parsing"
|
description = "brain-dead simple config-ini parsing"
|
||||||
category = "dev"
|
category = "dev"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = "*"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
{file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"},
|
{file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"},
|
||||||
{file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"},
|
{file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -820,14 +820,14 @@ files = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "packaging"
|
name = "packaging"
|
||||||
version = "22.0"
|
version = "23.0"
|
||||||
description = "Core utilities for Python packages"
|
description = "Core utilities for Python packages"
|
||||||
category = "dev"
|
category = "dev"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
{file = "packaging-22.0-py3-none-any.whl", hash = "sha256:957e2148ba0e1a3b282772e791ef1d8083648bc131c8ab0c1feba110ce1146c3"},
|
{file = "packaging-23.0-py3-none-any.whl", hash = "sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2"},
|
||||||
{file = "packaging-22.0.tar.gz", hash = "sha256:2198ec20bd4c017b8f9717e00f0c8714076fc2fd93816750ab48e2c41de2cfd3"},
|
{file = "packaging-23.0.tar.gz", hash = "sha256:b6ad297f8907de0fa2fe1ccbd26fdaf387f5f47c7275fedf8cce89f99446cf97"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1166,14 +1166,14 @@ files = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redis"
|
name = "redis"
|
||||||
version = "4.4.0"
|
version = "4.4.2"
|
||||||
description = "Python client for Redis database and key-value store"
|
description = "Python client for Redis database and key-value store"
|
||||||
category = "main"
|
category = "main"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.7"
|
python-versions = ">=3.7"
|
||||||
files = [
|
files = [
|
||||||
{file = "redis-4.4.0-py3-none-any.whl", hash = "sha256:cae3ee5d1f57d8caf534cd8764edf3163c77e073bdd74b6f54a87ffafdc5e7d9"},
|
{file = "redis-4.4.2-py3-none-any.whl", hash = "sha256:e6206448e2f8a432871d07d432c13ed6c2abcf6b74edb436c99752b1371be387"},
|
||||||
{file = "redis-4.4.0.tar.gz", hash = "sha256:7b8c87d19c45d3f1271b124858d2a5c13160c4e74d4835e28273400fa34d5228"},
|
{file = "redis-4.4.2.tar.gz", hash = "sha256:a010f6cb7378065040a02839c3f75c7e0fb37a87116fb4a95be82a95552776c7"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
@ -1343,14 +1343,14 @@ importlib-metadata = {version = ">=1.0", markers = "python_version < \"3.8\""}
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sentry-sdk"
|
name = "sentry-sdk"
|
||||||
version = "1.12.1"
|
version = "1.13.0"
|
||||||
description = "Python client for Sentry (https://sentry.io)"
|
description = "Python client for Sentry (https://sentry.io)"
|
||||||
category = "main"
|
category = "main"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = "*"
|
python-versions = "*"
|
||||||
files = [
|
files = [
|
||||||
{file = "sentry-sdk-1.12.1.tar.gz", hash = "sha256:5bbe4b72de22f9ac1e67f2a4e6efe8fbd595bb59b7b223443f50fe5802a5551c"},
|
{file = "sentry-sdk-1.13.0.tar.gz", hash = "sha256:72da0766c3069a3941eadbdfa0996f83f5a33e55902a19ba399557cfee1dddcc"},
|
||||||
{file = "sentry_sdk-1.12.1-py2.py3-none-any.whl", hash = "sha256:9f0b960694e2d8bb04db4ba6ac2a645040caef4e762c65937998ff06064f10d6"},
|
{file = "sentry_sdk-1.13.0-py2.py3-none-any.whl", hash = "sha256:b7ff6318183e551145b5c4766eb65b59ad5b63ff234dffddc5fb50340cad6729"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
@ -1379,6 +1379,7 @@ rq = ["rq (>=0.6)"]
|
|||||||
sanic = ["sanic (>=0.8)"]
|
sanic = ["sanic (>=0.8)"]
|
||||||
sqlalchemy = ["sqlalchemy (>=1.2)"]
|
sqlalchemy = ["sqlalchemy (>=1.2)"]
|
||||||
starlette = ["starlette (>=0.19.1)"]
|
starlette = ["starlette (>=0.19.1)"]
|
||||||
|
starlite = ["starlite (>=1.48)"]
|
||||||
tornado = ["tornado (>=5)"]
|
tornado = ["tornado (>=5)"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1700,14 +1701,14 @@ test = ["pytest (>=4.3)", "pytest-mock (>=3.3)"]
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "urllib3"
|
name = "urllib3"
|
||||||
version = "1.26.13"
|
version = "1.26.14"
|
||||||
description = "HTTP library with thread-safe connection pooling, file post, and more."
|
description = "HTTP library with thread-safe connection pooling, file post, and more."
|
||||||
category = "main"
|
category = "main"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
|
||||||
files = [
|
files = [
|
||||||
{file = "urllib3-1.26.13-py2.py3-none-any.whl", hash = "sha256:47cc05d99aaa09c9e72ed5809b60e7ba354e64b59c9c173ac3018642d8bb41fc"},
|
{file = "urllib3-1.26.14-py2.py3-none-any.whl", hash = "sha256:75edcdc2f7d85b137124a6c3c9fc3933cdeaa12ecb9a6a959f22797a0feca7e1"},
|
||||||
{file = "urllib3-1.26.13.tar.gz", hash = "sha256:c083dd0dce68dbfbe1129d5271cb90f9447dea7d52097c6e0126120c521ddea8"},
|
{file = "urllib3-1.26.14.tar.gz", hash = "sha256:076907bf8fd355cde77728471316625a4d2f7e713c125f51953bb5b3eecf4f72"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
@ -1770,4 +1771,4 @@ testing = ["flake8 (<5)", "func-timeout", "jaraco.functools", "jaraco.itertools"
|
|||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "2.0"
|
||||||
python-versions = "^3.7"
|
python-versions = "^3.7"
|
||||||
content-hash = "55c532d6efbba349d32200a9c181141efd8242f0f9a20223cac14f433e4d059e"
|
content-hash = "986b9cfc1e566b769ed3eda035cc3b1c25eb7c8b1b278cbe054be801f68d75cf"
|
||||||
|
@ -29,7 +29,7 @@ class AnimeUltime(Bridge):
|
|||||||
(
|
(
|
||||||
f"{self.base_url}/"
|
f"{self.base_url}/"
|
||||||
f"{'search' if query else 'history'}-0-1/"
|
f"{'search' if query else 'history'}-0-1/"
|
||||||
f"{page_date.strftime('%m%Y') if query else ''}"
|
f"{page_date.strftime('%m%Y') if not query else ''}"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -62,13 +62,14 @@ class AnimeUltime(Bridge):
|
|||||||
|
|
||||||
tds = tr.find_all("td")
|
tds = tr.find_all("td")
|
||||||
|
|
||||||
|
if tds:
|
||||||
torrents.append(
|
torrents.append(
|
||||||
RemoteFile(
|
RemoteFile(
|
||||||
bridge=self.__class__.__name__,
|
bridge=self.__class__.__name__,
|
||||||
id=tds[0].a["href"].split("/")[1].split("-")[0],
|
id=tds[0].a["href"].split("/")[1].split("-")[0],
|
||||||
category=tds[1].get_text(),
|
category=tds[1].get_text(),
|
||||||
name=tds[0].get_text(),
|
name=tds[0].get_text(),
|
||||||
link=f"{self.base_url}{tds[0].a['href']}",
|
link=f"{self.base_url}/{tds[0].a['href']}",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif history and "Historique" in history.get_text():
|
elif history and "Historique" in history.get_text():
|
||||||
@ -87,7 +88,7 @@ class AnimeUltime(Bridge):
|
|||||||
id=tds[0].a["href"].split("/")[-2],
|
id=tds[0].a["href"].split("/")[-2],
|
||||||
category=tds[4].get_text(),
|
category=tds[4].get_text(),
|
||||||
name=tds[0].get_text(),
|
name=tds[0].get_text(),
|
||||||
link=f"{self.base_url}{tds[0].a['href']}",
|
link=f"{self.base_url}/{tds[0].a['href']}",
|
||||||
date=parse(h3s[i].get_text()[:-3], ["%A %d %B %Y"]),
|
date=parse(h3s[i].get_text()[:-3], ["%A %d %B %Y"]),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -98,7 +99,7 @@ class AnimeUltime(Bridge):
|
|||||||
id=player["data-serie"],
|
id=player["data-serie"],
|
||||||
category=title.get_text(),
|
category=title.get_text(),
|
||||||
name=history.get_text(),
|
name=history.get_text(),
|
||||||
link=f"{self.base_url}file-0-1/{player['data-serie']}",
|
link=f"{self.base_url}/file-0-1/{player['data-serie']}",
|
||||||
date=tables[0].find_all("tr")[1].find_all("td")[1].get_text(),
|
date=tables[0].find_all("tr")[1].find_all("td")[1].get_text(),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -16,7 +16,7 @@ pynyaata = 'pynyaata:run'
|
|||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.7"
|
python = "^3.7"
|
||||||
beautifulsoup4 = "4.11.1"
|
beautifulsoup4 = "4.11.1"
|
||||||
dateparser = "1.1.5"
|
dateparser = "1.1.6"
|
||||||
flask = "2.2.2"
|
flask = "2.2.2"
|
||||||
flask-httpauth = "4.7.0"
|
flask-httpauth = "4.7.0"
|
||||||
flask-sqlalchemy = "3.0.2"
|
flask-sqlalchemy = "3.0.2"
|
||||||
@ -24,9 +24,9 @@ flask-wtf = "1.0.1"
|
|||||||
pg8000 = "1.29.4"
|
pg8000 = "1.29.4"
|
||||||
pydantic = "1.10.4"
|
pydantic = "1.10.4"
|
||||||
pymysql = "1.0.2"
|
pymysql = "1.0.2"
|
||||||
redis = "4.4.0"
|
redis = "4.4.2"
|
||||||
requests = "2.28.1"
|
requests = "2.28.1"
|
||||||
sentry-sdk = {extras = ["flask"], version = "1.12.1"}
|
sentry-sdk = {extras = ["flask"], version = "1.13.0"}
|
||||||
|
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
|
135
tests/bridge/test_animeultime.py
Normal file
135
tests/bridge/test_animeultime.py
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
# flake8: noqa: E501
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
from pynyaata.bridge.animeultime import AnimeUltime
|
||||||
|
from pynyaata.types import RemoteFile
|
||||||
|
|
||||||
|
from pytest import mark
|
||||||
|
|
||||||
|
|
||||||
|
def test_search_url():
|
||||||
|
previous_month = datetime.now() - timedelta(days=30)
|
||||||
|
|
||||||
|
assert (
|
||||||
|
AnimeUltime().search_url()
|
||||||
|
== f"http://www.anime-ultime.net/history-0-1/{datetime.now().strftime('%m%Y')}"
|
||||||
|
)
|
||||||
|
|
||||||
|
assert (
|
||||||
|
AnimeUltime().search_url("", 2)
|
||||||
|
== f"http://www.anime-ultime.net/history-0-1/{previous_month.strftime('%m%Y')}"
|
||||||
|
)
|
||||||
|
|
||||||
|
assert (
|
||||||
|
AnimeUltime().search_url("test", 1) == "http://www.anime-ultime.net/search-0-1/"
|
||||||
|
)
|
||||||
|
|
||||||
|
assert (
|
||||||
|
AnimeUltime().search_url("test", 2) == "http://www.anime-ultime.net/search-0-1/"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@mark.asyncio
|
||||||
|
async def test_search():
|
||||||
|
remotes = [
|
||||||
|
RemoteFile(
|
||||||
|
bridge="AnimeUltime",
|
||||||
|
id=4631,
|
||||||
|
category="OAV",
|
||||||
|
name="Akuma no Riddle: Shousha wa Dare? Nukiuchi Test",
|
||||||
|
link="http://www.anime-ultime.net/file-0-1/4631-Akuma-no-Riddle-Shousha-wa-Dare-Nukiuchi-Test",
|
||||||
|
),
|
||||||
|
RemoteFile(
|
||||||
|
bridge="AnimeUltime",
|
||||||
|
id=4250,
|
||||||
|
category="OAV",
|
||||||
|
name="Baka to Test to shoukanjuu (spécial Noël)",
|
||||||
|
link="http://www.anime-ultime.net/file-0-1/4250-Baka-to-Test-to-shoukanjuu-special-Noel",
|
||||||
|
),
|
||||||
|
RemoteFile(
|
||||||
|
bridge="AnimeUltime",
|
||||||
|
id=3057,
|
||||||
|
category="OAV",
|
||||||
|
name="Baka to Test to shoukanjuu (spéciaux)",
|
||||||
|
link="http://www.anime-ultime.net/file-0-1/3057-Baka-to-Test-to-shoukanjuu-speciaux",
|
||||||
|
),
|
||||||
|
RemoteFile(
|
||||||
|
bridge="AnimeUltime",
|
||||||
|
id=5453,
|
||||||
|
category="OAV",
|
||||||
|
name="Baka to Test to Shoukanjuu Mini Anime",
|
||||||
|
link="http://www.anime-ultime.net/file-0-1/5453-Baka-to-Test-to-Shoukanjuu-Mini-Anime",
|
||||||
|
),
|
||||||
|
RemoteFile(
|
||||||
|
bridge="AnimeUltime",
|
||||||
|
id=2458,
|
||||||
|
category="Episode",
|
||||||
|
name="Baka to Test to shoukanjuu ni! [Saison 2]",
|
||||||
|
link="http://www.anime-ultime.net/file-0-1/2458-Baka-to-Test-to-shoukanjuu-ni-Saison-2",
|
||||||
|
),
|
||||||
|
RemoteFile(
|
||||||
|
bridge="AnimeUltime",
|
||||||
|
id=1887,
|
||||||
|
category="Episode",
|
||||||
|
name="Baka to Test to shoukanjuu [Saison 1]",
|
||||||
|
link="http://www.anime-ultime.net/file-0-1/1887-Baka-to-Test-to-shoukanjuu-Saison-1",
|
||||||
|
),
|
||||||
|
RemoteFile(
|
||||||
|
bridge="AnimeUltime",
|
||||||
|
id=2320,
|
||||||
|
category="OAV",
|
||||||
|
name="Baka to Test to Shoukanjuu: Matsuri",
|
||||||
|
link="http://www.anime-ultime.net/file-0-1/2320-Baka-to-Test-to-Shoukanjuu-Matsuri",
|
||||||
|
),
|
||||||
|
RemoteFile(
|
||||||
|
bridge="AnimeUltime",
|
||||||
|
id=4463,
|
||||||
|
category="OAV",
|
||||||
|
name="Baka to Test to Shoukanjuu: Spinout! Sore ga Bokura no Nichijou",
|
||||||
|
link="http://www.anime-ultime.net/file-0-1/4463-Baka-to-Test-to-Shoukanjuu-Spinout-Sore-ga-Bokura-no-Nichijou",
|
||||||
|
),
|
||||||
|
RemoteFile(
|
||||||
|
bridge="AnimeUltime",
|
||||||
|
id=5069,
|
||||||
|
category="OAV",
|
||||||
|
name="Shinmai Maou no Testament Burst OAV [Interdit -16 ans]",
|
||||||
|
link="http://www.anime-ultime.net/file-0-1/5069-Shinmai-Maou-no-Testament-Burst-OAV-Interdit--16-ans",
|
||||||
|
),
|
||||||
|
RemoteFile(
|
||||||
|
bridge="AnimeUltime",
|
||||||
|
id=5487,
|
||||||
|
category="OAV",
|
||||||
|
name="Shinmai Maou no Testament Departures [Interdit -16 ans]",
|
||||||
|
link="http://www.anime-ultime.net/file-0-1/5487-Shinmai-Maou-no-Testament-Departures-Interdit--16-ans",
|
||||||
|
),
|
||||||
|
RemoteFile(
|
||||||
|
bridge="AnimeUltime",
|
||||||
|
id=4830,
|
||||||
|
category="OAV",
|
||||||
|
name="Shinmai Maou no Testament OAD [Interdit -16 ans]",
|
||||||
|
link="http://www.anime-ultime.net/file-0-1/4830-Shinmai-Maou-no-Testament-OAD-Interdit--16-ans",
|
||||||
|
),
|
||||||
|
RemoteFile(
|
||||||
|
bridge="AnimeUltime",
|
||||||
|
id=3449,
|
||||||
|
category="Film",
|
||||||
|
name="Robot Contest [J-Film]",
|
||||||
|
link="http://www.anime-ultime.net/file-0-1/3449-Robot-Contest-J-Film",
|
||||||
|
),
|
||||||
|
RemoteFile(
|
||||||
|
bridge="AnimeUltime",
|
||||||
|
id=2879,
|
||||||
|
category="OST",
|
||||||
|
name="Baka to Test to shoukanjuu ni! [Saison 2]",
|
||||||
|
link="http://www.anime-ultime.net/file-0-1/2879-Baka-to-Test-to-shoukanjuu-ni-Saison-2",
|
||||||
|
),
|
||||||
|
RemoteFile(
|
||||||
|
bridge="AnimeUltime",
|
||||||
|
id=1926,
|
||||||
|
category="OST",
|
||||||
|
name="Baka to Test to shoukanjuu [Saison 1]",
|
||||||
|
link="http://www.anime-ultime.net/file-0-1/1926-Baka-to-Test-to-shoukanjuu-Saison-1",
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
assert await AnimeUltime().search("test") == remotes
|
@ -1,7 +1,7 @@
|
|||||||
# flake8: noqa: E501
|
# flake8: noqa: E501
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from pynyaata.bridge.nyaa import Nyaa
|
from pynyaata.bridge.nyaa import Nyaa, EraiRaws
|
||||||
from pynyaata.types import Color, RemoteFile
|
from pynyaata.types import Color, RemoteFile
|
||||||
|
|
||||||
from pytest import mark
|
from pytest import mark
|
||||||
@ -39,6 +39,26 @@ def test_search_url():
|
|||||||
== "https://nyaa.si?f=0&c=1_3&q=%28test+vf%29%7C%28test+vostfr%29%7C%28test+multi%29%7C%28test+fre%29&s=size&o=desc&p=2"
|
== "https://nyaa.si?f=0&c=1_3&q=%28test+vf%29%7C%28test+vostfr%29%7C%28test+multi%29%7C%28test+fre%29&s=size&o=desc&p=2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
assert (
|
||||||
|
EraiRaws().search_url()
|
||||||
|
== "https://nyaa.si/user/Erai-raws?f=0&c=1_2&q=+fre&s=id&o=desc&p=1"
|
||||||
|
)
|
||||||
|
|
||||||
|
assert (
|
||||||
|
EraiRaws().search_url("", 2)
|
||||||
|
== "https://nyaa.si/user/Erai-raws?f=0&c=1_2&q=+fre&s=id&o=desc&p=2"
|
||||||
|
)
|
||||||
|
|
||||||
|
assert (
|
||||||
|
EraiRaws().search_url("test", 1)
|
||||||
|
== "https://nyaa.si/user/Erai-raws?f=0&c=1_2&q=test+fre&s=size&o=desc&p=1"
|
||||||
|
)
|
||||||
|
|
||||||
|
assert (
|
||||||
|
EraiRaws().search_url("test", 2)
|
||||||
|
== "https://nyaa.si/user/Erai-raws?f=0&c=1_2&q=test+fre&s=size&o=desc&p=2"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@mark.asyncio
|
@mark.asyncio
|
||||||
async def test_search(requests_mock: Mocker):
|
async def test_search(requests_mock: Mocker):
|
||||||
@ -47,7 +67,7 @@ async def test_search(requests_mock: Mocker):
|
|||||||
Nyaa().search_url(), text=requests.get("https://nyaa.si/user/Chaussette33").text
|
Nyaa().search_url(), text=requests.get("https://nyaa.si/user/Chaussette33").text
|
||||||
)
|
)
|
||||||
|
|
||||||
remotes: List[RemoteFile] = [
|
remotes = [
|
||||||
RemoteFile(
|
RemoteFile(
|
||||||
bridge="Nyaa",
|
bridge="Nyaa",
|
||||||
id=1080919,
|
id=1080919,
|
||||||
|
Reference in New Issue
Block a user