mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-07-19 00:20:00 +00:00
Delete .site
This commit is contained in:
parent
c59502c1fd
commit
d51665f5ac
@ -1,8 +1,11 @@
|
||||
# 10.12.23
|
||||
|
||||
import json
|
||||
|
||||
|
||||
# External libraries
|
||||
import httpx
|
||||
from bs4 import BeautifulSoup
|
||||
from rich.console import Console
|
||||
|
||||
|
||||
@ -41,16 +44,34 @@ def title_search(query: str) -> int:
|
||||
media_search_manager.clear()
|
||||
table_show_manager.clear()
|
||||
|
||||
search_url = f"{site_constant.FULL_URL}/api/search?q={query}"
|
||||
try:
|
||||
response = httpx.get(
|
||||
site_constant.FULL_URL,
|
||||
headers={'user-agent': get_userAgent()},
|
||||
timeout=max_timeout
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
soup = BeautifulSoup(response.text, 'html.parser')
|
||||
version = json.loads(soup.find('div', {'id': "app"}).get("data-page"))['version']
|
||||
|
||||
except Exception as e:
|
||||
console.print(f"[red]Site: {site_constant.SITE_NAME} version, request error: {e}")
|
||||
return 0
|
||||
|
||||
search_url = f"{site_constant.FULL_URL}/search?q={query}"
|
||||
console.print(f"[cyan]Search url: [yellow]{search_url}")
|
||||
|
||||
try:
|
||||
response = httpx.get(
|
||||
search_url,
|
||||
headers={'user-agent': get_userAgent()},
|
||||
timeout=max_timeout,
|
||||
follow_redirects=True,
|
||||
verify=False
|
||||
headers = {
|
||||
'referer': site_constant.FULL_URL,
|
||||
'user-agent': get_userAgent(),
|
||||
'x-inertia': 'true',
|
||||
'x-inertia-version': version
|
||||
},
|
||||
timeout=max_timeout
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
@ -66,7 +87,7 @@ def title_search(query: str) -> int:
|
||||
|
||||
# Collect json data
|
||||
try:
|
||||
data = response.json().get('data', [])
|
||||
data = response.json().get('props').get('titles')
|
||||
except Exception as e:
|
||||
console.log(f"Error parsing JSON response: {e}")
|
||||
return 0
|
||||
|
@ -98,15 +98,14 @@ class GetSerieInfo:
|
||||
return
|
||||
|
||||
response = httpx.get(
|
||||
url=f'{self.url}/titles/{self.media_id}-{self.series_name}/stagione-{number_season}',
|
||||
url=f'{self.url}/titles/{self.media_id}-{self.series_name}/season-{number_season}',
|
||||
headers={
|
||||
'User-Agent': get_userAgent(),
|
||||
'User-Agent': self.headers['user-agent'],
|
||||
'x-inertia': 'true',
|
||||
'x-inertia-version': self.version,
|
||||
},
|
||||
timeout=max_timeout
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
# Extract episodes from JSON response
|
||||
json_response = response.json().get('props', {}).get('loadedSeason', {}).get('episodes', [])
|
||||
|
Loading…
x
Reference in New Issue
Block a user