Fix for animeworld Movies
This commit is contained in:
+27
-21
@@ -21,20 +21,22 @@ showname_replace = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async def get_mp4(anime_url,ismovie,episode,client):
|
async def get_mp4(anime_url,ismovie,episode,client):
|
||||||
response = await client.get(anime_url,allow_redirects=True, impersonate = "chrome120")
|
response = await client.get(anime_url,allow_redirects=True, impersonate = "chrome120")
|
||||||
soup = BeautifulSoup(response.text,'lxml')
|
soup = BeautifulSoup(response.text,'lxml')
|
||||||
episode_page = soup.find('a', {'data-episode-num':episode })
|
if ismovie == 0:
|
||||||
if episode_page is None:
|
episode_page = soup.find('a', {'data-episode-num':episode })
|
||||||
return None
|
if episode_page is None:
|
||||||
episode_page = f'https://animeworld.{AW_DOMAIN}{episode_page["href"]}'
|
return None
|
||||||
response = await client.get(episode_page,allow_redirects=True, impersonate = "chrome120")
|
episode_page = f'https://animeworld.{AW_DOMAIN}{episode_page["href"]}'
|
||||||
soup = BeautifulSoup(response.text,'lxml')
|
response = await client.get(episode_page,allow_redirects=True, impersonate = "chrome120")
|
||||||
a_tag = soup.find('a', {'id': 'alternativeDownloadLink', 'class': 'm-1 btn btn-sm btn-primary'})
|
soup = BeautifulSoup(response.text,'lxml')
|
||||||
url = a_tag['href']
|
|
||||||
response = await client.head(url)
|
a_tag = soup.find('a', {'id': 'alternativeDownloadLink', 'class': 'm-1 btn btn-sm btn-primary'})
|
||||||
if response.status_code == 404:
|
url = a_tag['href']
|
||||||
|
response = await client.head(url)
|
||||||
|
if response.status_code == 404:
|
||||||
url = None
|
url = None
|
||||||
return url
|
return url
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -136,8 +138,11 @@ async def animeworld(id,client):
|
|||||||
try:
|
try:
|
||||||
print(id)
|
print(id)
|
||||||
kitsu_id = id.split(":")[1]
|
kitsu_id = id.split(":")[1]
|
||||||
episode = id.split(":")[2]
|
|
||||||
ismovie = 1 if len(id.split(":")) == 2 else 0
|
ismovie = 1 if len(id.split(":")) == 2 else 0
|
||||||
|
if ismovie == 1:
|
||||||
|
episode = None
|
||||||
|
else:
|
||||||
|
episode = id.split(":")[2]
|
||||||
showname,date = await get_info_kitsu(kitsu_id,client)
|
showname,date = await get_info_kitsu(kitsu_id,client)
|
||||||
for key in showname_replace:
|
for key in showname_replace:
|
||||||
if key in showname: # Check if the key is a substring of showname
|
if key in showname: # Check if the key is a substring of showname
|
||||||
@@ -149,15 +154,16 @@ async def animeworld(id,client):
|
|||||||
except:
|
except:
|
||||||
print("Animeworld failed")
|
print("Animeworld failed")
|
||||||
return None
|
return None
|
||||||
|
'''
|
||||||
#async def test_animeworld():
|
async def test_animeworld():
|
||||||
async with httpx.AsyncClient() as client:
|
async with AsyncSession() as client:
|
||||||
# Replace with actual id, for example 'anime_id:episode' format
|
# Replace with actual id, for example 'anime_id:episode' format
|
||||||
test_id = "kitsu:1555:1" # This is an example ID format
|
test_id = "kitsu:11407" # This is an example ID format
|
||||||
results = await animeworld(test_id, client)
|
results = await animeworld(test_id, client)
|
||||||
print(results)
|
print(results)
|
||||||
|
|
||||||
#if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import httpx
|
from curl_cffi.requests import AsyncSession
|
||||||
import asyncio
|
import asyncio
|
||||||
asyncio.run(test_animeworld())
|
asyncio.run(test_animeworld())
|
||||||
|
'''
|
||||||
Reference in New Issue
Block a user