Fix anime-ultime

This commit is contained in:
Michel Roux 2023-01-14 00:36:13 +01:00
parent 353ed7fb27
commit 5a1d0da33e
2 changed files with 30 additions and 4 deletions

View File

@ -49,6 +49,7 @@ class AnimeUltime(Bridge):
torrents: List[RemoteFile] = [] torrents: List[RemoteFile] = []
html = BeautifulSoup(response.content, "html.parser") html = BeautifulSoup(response.content, "html.parser")
title = html.select_one("div.title") title = html.select_one("div.title")
titre = html.select_one("div.titre")
history = html.select_one("h1") history = html.select_one("h1")
player = html.select_one("div.AUVideoPlayer") player = html.select_one("div.AUVideoPlayer")
tables = html.select("table.jtable") tables = html.select("table.jtable")
@ -93,15 +94,18 @@ class AnimeUltime(Bridge):
date=parse(h3s[i].get_text()[:-3], ["%A %d %B %Y"]), date=parse(h3s[i].get_text()[:-3], ["%A %d %B %Y"]),
) )
) )
elif player and title and history and tables: elif player and titre and history:
torrents.append( torrents.append(
RemoteFile( RemoteFile(
bridge=self.__class__.__name__, bridge=self.__class__.__name__,
id=player["data-serie"], id=player["data-serie"],
category=title.get_text(), category=titre.get_text().split("(")[0].strip(),
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=datetime.strptime(
tables[0].find_all("tr")[1].find_all("td")[1].get_text(),
"%d/%m/%y",
),
) )
) )

View File

@ -148,6 +148,28 @@ async def test_history(requests_mock: Mocker):
category="Film", category="Film",
name="Crayon Shin-chan - Arashi wo Yobu Appare! Sengoku Dai Kassen", name="Crayon Shin-chan - Arashi wo Yobu Appare! Sengoku Dai Kassen",
link="http://www.anime-ultime.net/file-0-1/167/Crayon-Shin-chan---Arashi-wo-Yobu-Appare-Sengoku-Dai-Kassen-vostfr", link="http://www.anime-ultime.net/file-0-1/167/Crayon-Shin-chan---Arashi-wo-Yobu-Appare-Sengoku-Dai-Kassen-vostfr",
date="2006-04-10 00:00:00" date="2006-04-10 00:00:00",
),
]
@mark.asyncio
async def test_search_one(requests_mock: Mocker):
requests_mock.real_http = True
requests_mock.post(
AnimeUltime().search_url("akuma"),
text=requests.get(
"http://www.anime-ultime.net/file-0-1/4631/Akuma-no-Riddle-Shousha-wa-Dare-Nukiuchi-Test-vostfr"
).text,
)
assert await AnimeUltime().search("akuma") == [
RemoteFile(
bridge="AnimeUltime",
id=4631,
category="OAV",
name="Akuma no Riddle: Shousha wa Dare? Nukiuchi Test vostfr",
link="http://www.anime-ultime.net/file-0-1/4631",
date="2014-12-27 00:00:00",
), ),
] ]