Fixed Animeworld
This commit is contained in:
@@ -125,7 +125,7 @@ To host this project with Hugging Face, go to the [linked](https://huggingface.c
|
|||||||
|
|
||||||
8. Do not forget to add /manifest.json
|
8. Do not forget to add /manifest.json
|
||||||
|
|
||||||
9. To update the remote server, you can either upload files manually, or you can connect the [repository locally](https://huggingface.co/docs/hub/en/repositories-getting-started) and use your file manager to do so. If you know how a Dockerfile works you could even clone the repository every time, although you will need to modify the config.json (by disabling both load_dotenv and FILMPERTUTTI). Plus remember that the README.MD of Hugging Face MUST NOT be changed or the app won't run.
|
9. The Addon will update everytime you restart the service but you will need to change the config.json manually each time if there are any changes.
|
||||||
If you just want to syncronize with the public instance then there is a button in the settings to do so.
|
If you just want to syncronize with the public instance then there is a button in the settings to do so.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+31
-25
@@ -3,30 +3,21 @@ from bs4 import BeautifulSoup
|
|||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
from info import get_info_kitsu
|
from info import get_info_kitsu
|
||||||
|
import config
|
||||||
|
AW_DOMAIN = config.AW_DOMAIN
|
||||||
def get_mp4(anime_url,ismovie,episode):
|
def get_mp4(anime_url,ismovie,episode):
|
||||||
response = requests.get(anime_url)
|
response = requests.get(anime_url)
|
||||||
soup = BeautifulSoup(response.text,'lxml')
|
soup = BeautifulSoup(response.text,'lxml')
|
||||||
|
episode_page = soup.find('a', {'data-episode-num':episode })
|
||||||
|
episode_page = f'https://animeworld.{AW_DOMAIN}{episode_page["href"]}'
|
||||||
|
response = requests.get(episode_page)
|
||||||
|
soup = BeautifulSoup(response.text,'lxml')
|
||||||
a_tag = soup.find('a', {'id': 'alternativeDownloadLink', 'class': 'm-1 btn btn-sm btn-primary'})
|
a_tag = soup.find('a', {'id': 'alternativeDownloadLink', 'class': 'm-1 btn btn-sm btn-primary'})
|
||||||
url = a_tag['href']
|
url = a_tag['href']
|
||||||
if ismovie == 1:
|
|
||||||
response = requests.head(url)
|
response = requests.head(url)
|
||||||
if response.status_code == 404:
|
if response.status_code == 404:
|
||||||
url = None
|
url = None
|
||||||
return url
|
return url
|
||||||
elif ismovie == 0:
|
|
||||||
parts = url.split("_Ep_")
|
|
||||||
base = parts[0]
|
|
||||||
episode_part = parts[1]
|
|
||||||
episode_number, rest = episode_part.split("_", 1)
|
|
||||||
num_digits = len(episode_number)
|
|
||||||
episode = int(episode)
|
|
||||||
new_episode_number = str(episode).zfill(num_digits)
|
|
||||||
url = f"{base}_Ep_{new_episode_number}_{rest}"
|
|
||||||
response = requests.head(url)
|
|
||||||
if response.status_code == 404:
|
|
||||||
url = None
|
|
||||||
return url
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -40,14 +31,14 @@ def search(showname,date,ismovie,episode):
|
|||||||
}
|
}
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
'authority': 'www.animeworld.so',
|
'authority': f'www.animeworld.{AW_DOMAIN}',
|
||||||
'accept': 'application/json, text/javascript, */*; q=0.01',
|
'accept': 'application/json, text/javascript, */*; q=0.01',
|
||||||
'accept-language': 'it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7',
|
'accept-language': 'it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7',
|
||||||
# 'content-length': '0',
|
# 'content-length': '0',
|
||||||
# 'cookie': 'sessionId=s%3AtGSRfYcsIoaeV0nqFJgN69Zxixb_-uJU.fcNz%2FsJBiiP8v8TwthMN9%2FmynWFciI5gezZuz8CltyQ',
|
# 'cookie': 'sessionId=s%3AtGSRfYcsIoaeV0nqFJgN69Zxixb_-uJU.fcNz%2FsJBiiP8v8TwthMN9%2FmynWFciI5gezZuz8CltyQ',
|
||||||
'csrf-token': 'oKFK43s4-BzfqPX27RlAORUd-iyiAfXyfDAo',
|
'csrf-token': 'oKFK43s4-BzfqPX27RlAORUd-iyiAfXyfDAo',
|
||||||
'origin': 'https://www.animeworld.so',
|
'origin': f'https://www.animeworld.{AW_DOMAIN}',
|
||||||
'referer': 'https://www.animeworld.so/',
|
'referer': f'https://www.animeworld.{AW_DOMAIN}/',
|
||||||
'sec-ch-ua': '"Not-A.Brand";v="99", "Chromium";v="124"',
|
'sec-ch-ua': '"Not-A.Brand";v="99", "Chromium";v="124"',
|
||||||
'sec-ch-ua-mobile': '?0',
|
'sec-ch-ua-mobile': '?0',
|
||||||
'sec-ch-ua-platform': '"Android"',
|
'sec-ch-ua-platform': '"Android"',
|
||||||
@@ -62,7 +53,7 @@ def search(showname,date,ismovie,episode):
|
|||||||
'keyword': showname,
|
'keyword': showname,
|
||||||
}
|
}
|
||||||
|
|
||||||
response = requests.post('https://www.animeworld.so/api/search/v2', params=params, cookies=cookies, headers=headers)
|
response = requests.post(f'https://www.animeworld.{AW_DOMAIN}/api/search/v2', params=params, cookies=cookies, headers=headers)
|
||||||
months = {
|
months = {
|
||||||
"Gennaio": "January", "Febbraio": "February", "Marzo": "March",
|
"Gennaio": "January", "Febbraio": "February", "Marzo": "March",
|
||||||
"Aprile": "April", "Maggio": "May", "Giugno": "June",
|
"Aprile": "April", "Maggio": "May", "Giugno": "June",
|
||||||
@@ -71,10 +62,8 @@ def search(showname,date,ismovie,episode):
|
|||||||
}
|
}
|
||||||
data = json.loads(response.text)
|
data = json.loads(response.text)
|
||||||
final_urls = []
|
final_urls = []
|
||||||
i = 0
|
|
||||||
for anime in data["animes"]:
|
for anime in data["animes"]:
|
||||||
release_date = anime["release"]
|
release_date = anime["release"]
|
||||||
i+=1
|
|
||||||
for ita, eng in months.items():
|
for ita, eng in months.items():
|
||||||
release_date = release_date.replace(ita, eng)
|
release_date = release_date.replace(ita, eng)
|
||||||
release_date = datetime.datetime.strptime(release_date, "%d %B %Y")
|
release_date = datetime.datetime.strptime(release_date, "%d %B %Y")
|
||||||
@@ -82,13 +71,30 @@ def search(showname,date,ismovie,episode):
|
|||||||
if release_date == date:
|
if release_date == date:
|
||||||
identifier = anime["identifier"]
|
identifier = anime["identifier"]
|
||||||
link = anime["link"]
|
link = anime["link"]
|
||||||
anime_url = f'https://animeworld.so/play/{link}.{identifier}'
|
anime_url = f'https://animeworld.{AW_DOMAIN}/play/{link}.{identifier}'
|
||||||
final_url = get_mp4(anime_url,ismovie,episode)
|
final_url = get_mp4(anime_url,ismovie,episode)
|
||||||
final_urls.append(final_url)
|
final_urls.append(final_url)
|
||||||
if i == 2:
|
break
|
||||||
|
showname = showname + " (ITA)"
|
||||||
|
params = {
|
||||||
|
'keyword': showname,
|
||||||
|
}
|
||||||
|
response = requests.post(f'https://www.animeworld.{AW_DOMAIN}/api/search/v2', params=params, cookies=cookies, headers=headers)
|
||||||
|
data = json.loads(response.text)
|
||||||
|
for anime in data["animes"]:
|
||||||
|
release_date = anime["release"]
|
||||||
|
for ita, eng in months.items():
|
||||||
|
release_date = release_date.replace(ita, eng)
|
||||||
|
release_date = datetime.datetime.strptime(release_date, "%d %B %Y")
|
||||||
|
release_date = release_date.strftime("%Y-%m-%d")
|
||||||
|
if release_date == date:
|
||||||
|
identifier = anime["identifier"]
|
||||||
|
link = anime["link"]
|
||||||
|
anime_url = f'https://animeworld.{AW_DOMAIN}/play/{link}.{identifier}'
|
||||||
|
final_url = get_mp4(anime_url,ismovie,episode)
|
||||||
|
final_urls.append(final_url)
|
||||||
|
break
|
||||||
return final_urls
|
return final_urls
|
||||||
|
|
||||||
|
|
||||||
def animeworld(id):
|
def animeworld(id):
|
||||||
try:
|
try:
|
||||||
kitsu_id = id.split(":")[1]
|
kitsu_id = id.split(":")[1]
|
||||||
|
|||||||
Reference in New Issue
Block a user