Fix hidden_url
This commit is contained in:
parent
e95e3fd631
commit
8a01893406
@ -21,7 +21,7 @@ class YggTorrent(Bridge):
|
||||
color = Color.SUCCESS
|
||||
title = "YggTorrent"
|
||||
base_url = parse_obj_as(HttpUrl, f"https://{YGG_DOMAIN}")
|
||||
hidden_url = parse_obj_as(HttpUrl, f"http://{YGG_IP}")
|
||||
hidden_url = parse_obj_as(HttpUrl, f"http://{YGG_IP}") if YGG_IP else base_url
|
||||
favicon = parse_obj_as(HttpUrl, f"{base_url}/favicon.ico")
|
||||
category = "Animation Série"
|
||||
sub_category = 2179
|
||||
@ -38,19 +38,17 @@ class YggTorrent(Bridge):
|
||||
}
|
||||
)
|
||||
|
||||
return parse_obj_as(HttpUrl, f"{self.base_url}?{params}")
|
||||
return parse_obj_as(HttpUrl, f"{self.base_url}/engine/search?{params}")
|
||||
|
||||
@log_async
|
||||
@cache_data
|
||||
@filter_data
|
||||
async def search(self, query: str = "", page: int = 1) -> List[RemoteFile]:
|
||||
if YGG_IP:
|
||||
params = self.search_url(query, page).split("?")
|
||||
search_url = self.search_url(query, page)
|
||||
response = requests.get(
|
||||
f"{self.hidden_url}?{params[1]}", headers={"Host": YGG_DOMAIN}
|
||||
f"{self.hidden_url}/{search_url.path}?{search_url.query}",
|
||||
headers={"Host": YGG_DOMAIN},
|
||||
)
|
||||
else:
|
||||
response = requests.get(self.search_url(query, page))
|
||||
|
||||
if response.status_code != 200:
|
||||
raise requests.HTTPError(response)
|
||||
|
Reference in New Issue
Block a user