Compare commits
22 Commits
1b76d36352
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| a8486726f6 | |||
| 391a0ee861 | |||
| 408be433f2 | |||
| c87e29f085 | |||
| b27cd39aa4 | |||
| 205c17ae4e | |||
| e101a02886 | |||
| 04c0e34db5 | |||
| f1d5f1db68 | |||
| f0eda8ef87 | |||
| d4fcc9a633 | |||
| 9ca8dcc3da | |||
| 301806a906 | |||
| eca29b6947 | |||
| d07cc820dc | |||
| 710d70dbfd | |||
| 6f2edeaf89 | |||
| 769d40e5bb | |||
| c53f1f50c9 | |||
| 9cae04584d | |||
| efcadde111 | |||
| 145e277895 |
205
logic_ohli24.py
205
logic_ohli24.py
@@ -67,8 +67,10 @@ logger = P.logger
|
|||||||
class LogicOhli24(LogicModuleBase):
|
class LogicOhli24(LogicModuleBase):
|
||||||
db_default = {
|
db_default = {
|
||||||
"ohli24_db_version": "1.1",
|
"ohli24_db_version": "1.1",
|
||||||
"ohli24_url": "https://ohli24.org",
|
"ohli24_url": "https://a21.ohli24.com",
|
||||||
"ohli24_download_path": os.path.join(path_data, P.package_name, "ohli24"),
|
"ohli24_download_path": os.path.join(
|
||||||
|
path_data, P.package_name, "ohli24"
|
||||||
|
),
|
||||||
"ohli24_auto_make_folder": "True",
|
"ohli24_auto_make_folder": "True",
|
||||||
"ohli24_auto_make_season_folder": "True",
|
"ohli24_auto_make_season_folder": "True",
|
||||||
"ohli24_finished_insert": "[완결]",
|
"ohli24_finished_insert": "[완결]",
|
||||||
@@ -106,7 +108,9 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, P):
|
def __init__(self, P):
|
||||||
super(LogicOhli24, self).__init__(P, "setting", scheduler_desc="ohli24 자동 다운로드")
|
super(LogicOhli24, self).__init__(
|
||||||
|
P, "setting", scheduler_desc="ohli24 자동 다운로드"
|
||||||
|
)
|
||||||
self.name = "ohli24"
|
self.name = "ohli24"
|
||||||
self.queue = None
|
self.queue = None
|
||||||
self.last_post_title = ""
|
self.last_post_title = ""
|
||||||
@@ -216,7 +220,9 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
try:
|
try:
|
||||||
if engine == "chrome":
|
if engine == "chrome":
|
||||||
browser = await p.chromium.launch(
|
browser = await p.chromium.launch(
|
||||||
channel="chrome", args=browser_args, headless=headless
|
channel="chrome",
|
||||||
|
args=browser_args,
|
||||||
|
headless=headless,
|
||||||
)
|
)
|
||||||
elif engine == "webkit":
|
elif engine == "webkit":
|
||||||
browser = await p.webkit.launch(
|
browser = await p.webkit.launch(
|
||||||
@@ -232,9 +238,9 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
# user_agent=ua,
|
# user_agent=ua,
|
||||||
# )
|
# )
|
||||||
|
|
||||||
LogicOhli24.headers[
|
LogicOhli24.headers["Referer"] = (
|
||||||
"Referer"
|
"https://anilife.com/detail/id/471"
|
||||||
] = "https://anilife.live/detail/id/471"
|
)
|
||||||
# print(LogicAniLife.headers)
|
# print(LogicAniLife.headers)
|
||||||
|
|
||||||
LogicOhli24.headers["Referer"] = LogicOhli24.episode_url
|
LogicOhli24.headers["Referer"] = LogicOhli24.episode_url
|
||||||
@@ -244,7 +250,8 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
|
|
||||||
# logger.debug(f"LogicAniLife.headers::: {LogicOhli24.headers}")
|
# logger.debug(f"LogicAniLife.headers::: {LogicOhli24.headers}")
|
||||||
context = await browser.new_context(
|
context = await browser.new_context(
|
||||||
extra_http_headers=LogicOhli24.headers, ignore_https_errors=True
|
extra_http_headers=LogicOhli24.headers,
|
||||||
|
ignore_https_errors=True,
|
||||||
)
|
)
|
||||||
# await context.add_cookies(LogicOhli24.cookies)
|
# await context.add_cookies(LogicOhli24.cookies)
|
||||||
|
|
||||||
@@ -338,7 +345,9 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
),
|
),
|
||||||
arg=arg,
|
arg=arg,
|
||||||
)
|
)
|
||||||
return render_template("sample.html", title="%s - %s" % (P.package_name, sub))
|
return render_template(
|
||||||
|
"sample.html", title="%s - %s" % (P.package_name, sub)
|
||||||
|
)
|
||||||
|
|
||||||
# @staticmethod
|
# @staticmethod
|
||||||
def process_ajax(self, sub, req):
|
def process_ajax(self, sub, req):
|
||||||
@@ -423,7 +432,8 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
count += 1
|
count += 1
|
||||||
notify = {
|
notify = {
|
||||||
"type": "success",
|
"type": "success",
|
||||||
"msg": "%s 개의 에피소드를 큐에 추가 하였습니다." % count,
|
"msg": "%s 개의 에피소드를 큐에 추가 하였습니다."
|
||||||
|
% count,
|
||||||
}
|
}
|
||||||
socketio.emit(
|
socketio.emit(
|
||||||
"notify", notify, namespace="/framework", broadcast=True
|
"notify", notify, namespace="/framework", broadcast=True
|
||||||
@@ -514,7 +524,8 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
whitelist_program = P.ModelSetting.get("ohli24_auto_code_list")
|
whitelist_program = P.ModelSetting.get("ohli24_auto_code_list")
|
||||||
|
|
||||||
whitelist_programs = [
|
whitelist_programs = [
|
||||||
str(x.strip()) for x in whitelist_program.replace("\n", "|").split("|")
|
str(x.strip())
|
||||||
|
for x in whitelist_program.replace("\n", "|").split("|")
|
||||||
]
|
]
|
||||||
|
|
||||||
if code not in whitelist_programs:
|
if code not in whitelist_programs:
|
||||||
@@ -541,7 +552,7 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
ret["ret"] = False
|
ret["ret"] = False
|
||||||
ret["log"] = "이미 추가되어 있습니다."
|
ret["log"] = "이미 추가되어 있습니다."
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Exception:%s", e)
|
logger.error(f"Exception: {str(e)}")
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
ret["ret"] = False
|
ret["ret"] = False
|
||||||
ret["log"] = str(e)
|
ret["log"] = str(e)
|
||||||
@@ -559,15 +570,25 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
# Todo: 스케쥴링 함수 미구현
|
# Todo: 스케쥴링 함수 미구현
|
||||||
logger.debug(f"ohli24 scheduler_function::=========================")
|
logger.debug(f"ohli24 scheduler_function::=========================")
|
||||||
|
|
||||||
content_code_list = P.ModelSetting.get_list("ohli24_auto_code_list", "|")
|
content_code_list = P.ModelSetting.get_list(
|
||||||
|
"ohli24_auto_code_list", "|"
|
||||||
|
)
|
||||||
logger.debug(f"content_code_list::: {content_code_list}")
|
logger.debug(f"content_code_list::: {content_code_list}")
|
||||||
url_list = ["https://www.naver.com/", "https://www.daum.net/"]
|
url_list = ["https://www.naver.com/", "https://www.daum.net/"]
|
||||||
|
|
||||||
week = ["월요일", "화요일", "수요일", "목요일", "금요일", "토요일", "일요일"]
|
week = [
|
||||||
|
"월요일",
|
||||||
|
"화요일",
|
||||||
|
"수요일",
|
||||||
|
"목요일",
|
||||||
|
"금요일",
|
||||||
|
"토요일",
|
||||||
|
"일요일",
|
||||||
|
]
|
||||||
today = date.today()
|
today = date.today()
|
||||||
print(today)
|
# print(today)
|
||||||
print()
|
# print()
|
||||||
print(today.weekday())
|
# print(today.weekday())
|
||||||
|
|
||||||
url = f'{P.ModelSetting.get("ohli24_url")}/bbs/board.php?bo_table=ing&sca={week[today.weekday()]}'
|
url = f'{P.ModelSetting.get("ohli24_url")}/bbs/board.php?bo_table=ing&sca={week[today.weekday()]}'
|
||||||
|
|
||||||
@@ -598,8 +619,10 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
elif len(content_code_list) > 0:
|
elif len(content_code_list) > 0:
|
||||||
for item in content_code_list:
|
for item in content_code_list:
|
||||||
url = P.ModelSetting.get("ohli24_url") + "/c/" + item
|
url = P.ModelSetting.get("ohli24_url") + "/c/" + item
|
||||||
print("scheduling url: %s", url)
|
logger.debug(f"scheduling url: {url}")
|
||||||
# ret_data = LogicOhli24.get_auto_anime_info(self, url=url)
|
# ret_data = LogicOhli24.get_auto_anime_info(self, url=url)
|
||||||
|
print("debug===")
|
||||||
|
print(item)
|
||||||
content_info = self.get_series_info(item, "", "")
|
content_info = self.get_series_info(item, "", "")
|
||||||
|
|
||||||
# logger.debug(content_info)
|
# logger.debug(content_info)
|
||||||
@@ -628,6 +651,7 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
|
|
||||||
def get_series_info(self, code, wr_id, bo_table):
|
def get_series_info(self, code, wr_id, bo_table):
|
||||||
code_type = "c"
|
code_type = "c"
|
||||||
|
code = urllib.parse.quote(code)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if (
|
if (
|
||||||
@@ -699,6 +723,8 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
"_total_chapter",
|
"_total_chapter",
|
||||||
"_show_time",
|
"_show_time",
|
||||||
"_release_year",
|
"_release_year",
|
||||||
|
"_drawing",
|
||||||
|
"_character_design"
|
||||||
]
|
]
|
||||||
description_dict = {
|
description_dict = {
|
||||||
"원제": "_otit",
|
"원제": "_otit",
|
||||||
@@ -719,8 +745,11 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
"개봉년도": "_release_year",
|
"개봉년도": "_release_year",
|
||||||
"개봉일": "_opening_date",
|
"개봉일": "_opening_date",
|
||||||
"런타임": "_run_time",
|
"런타임": "_run_time",
|
||||||
|
"작화": "_drawing",
|
||||||
|
"캐릭터디자인": "_character_design"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
list_body_li = tree.xpath('//ul[@class="list-body"]/li')
|
list_body_li = tree.xpath('//ul[@class="list-body"]/li')
|
||||||
# logger.debug(f"list_body_li:: {list_body_li}")
|
# logger.debug(f"list_body_li:: {list_body_li}")
|
||||||
episodes = []
|
episodes = []
|
||||||
@@ -852,9 +881,9 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
entity = {}
|
entity = {}
|
||||||
entity["link"] = item.xpath(".//a/@href")[0]
|
entity["link"] = item.xpath(".//a/@href")[0]
|
||||||
entity["code"] = entity["link"].split("/")[-1]
|
entity["code"] = entity["link"].split("/")[-1]
|
||||||
entity["title"] = item.xpath(".//div[@class='post-title']/text()")[
|
entity["title"] = item.xpath(
|
||||||
0
|
".//div[@class='post-title']/text()"
|
||||||
].strip()
|
)[0].strip()
|
||||||
# logger.debug(item.xpath(".//div[@class='img-item']/img/@src")[0])
|
# logger.debug(item.xpath(".//div[@class='img-item']/img/@src")[0])
|
||||||
# logger.debug(item.xpath(".//div[@class='img-item']/img/@data-ezsrc")[0])
|
# logger.debug(item.xpath(".//div[@class='img-item']/img/@data-ezsrc")[0])
|
||||||
# entity["image_link"] = item.xpath(".//div[@class='img-item']/img/@src")[
|
# entity["image_link"] = item.xpath(".//div[@class='img-item']/img/@src")[
|
||||||
@@ -894,12 +923,12 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
entity = {}
|
entity = {}
|
||||||
entity["link"] = item.xpath(".//a/@href")[0]
|
entity["link"] = item.xpath(".//a/@href")[0]
|
||||||
entity["code"] = entity["link"].split("/")[-1]
|
entity["code"] = entity["link"].split("/")[-1]
|
||||||
entity["title"] = item.xpath(".//div[@class='post-title']/text()")[
|
entity["title"] = item.xpath(
|
||||||
0
|
".//div[@class='post-title']/text()"
|
||||||
].strip()
|
)[0].strip()
|
||||||
entity["image_link"] = item.xpath(".//div[@class='img-item']/img/@src")[
|
entity["image_link"] = item.xpath(
|
||||||
0
|
".//div[@class='img-item']/img/@src"
|
||||||
].replace("..", P.ModelSetting.get("ohli24_url"))
|
)[0].replace("..", P.ModelSetting.get("ohli24_url"))
|
||||||
data["ret"] = "success"
|
data["ret"] = "success"
|
||||||
data["anime_list"].append(entity)
|
data["anime_list"].append(entity)
|
||||||
|
|
||||||
@@ -938,24 +967,28 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
entity["title"] = "".join(
|
entity["title"] = "".join(
|
||||||
item.xpath(".//div[@class='post-title']/text()")
|
item.xpath(".//div[@class='post-title']/text()")
|
||||||
).strip()
|
).strip()
|
||||||
entity["image_link"] = item.xpath(".//div[@class='img-item']/img/@src")[
|
entity["image_link"] = item.xpath(
|
||||||
0
|
".//div[@class='img-item']/img/@src"
|
||||||
].replace("..", P.ModelSetting.get("ohli24_url"))
|
)[0].replace("..", P.ModelSetting.get("ohli24_url"))
|
||||||
|
|
||||||
entity["code"] = item.xpath(".//div[@class='img-item']/img/@alt")[0]
|
entity["code"] = item.xpath(
|
||||||
|
".//div[@class='img-item']/img/@alt"
|
||||||
|
)[0]
|
||||||
|
|
||||||
data["ret"] = "success"
|
data["ret"] = "success"
|
||||||
data["anime_list"].append(entity)
|
data["anime_list"].append(entity)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
P.logger.error("Exception:%s", e)
|
P.logger.error(f"Exception: {str(e)}")
|
||||||
P.logger.error(traceback.format_exc())
|
P.logger.error(traceback.format_exc())
|
||||||
return {"ret": "exception", "log": str(e)}
|
return {"ret": "exception", "log": str(e)}
|
||||||
|
|
||||||
def check_for_new_post(self):
|
def check_for_new_post(self):
|
||||||
# Get the HTML content of the page
|
# Get the HTML content of the page
|
||||||
res = requests.get("https://ohli24.org/bbs/board.php?bo_table=ing")
|
res = requests.get(
|
||||||
|
f'{P.ModelSetting.get("ohli24_url")}/bbs/board.php?bo_table=ing'
|
||||||
|
)
|
||||||
soup = BeautifulSoup(res.content, "html.parser")
|
soup = BeautifulSoup(res.content, "html.parser")
|
||||||
|
|
||||||
# Find the latest post on the page
|
# Find the latest post on the page
|
||||||
@@ -964,7 +997,7 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
soup.find("div", class_="img-item")
|
soup.find("div", class_="img-item")
|
||||||
.find("img", class_="wr-img")
|
.find("img", class_="wr-img")
|
||||||
.get("src")
|
.get("src")
|
||||||
.replace("..", "https://ohli24.org")
|
.replace("..", P.ModelSetting.get("ohli24_url"))
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.debug(f"latest_post:: {latest_post}")
|
logger.debug(f"latest_post:: {latest_post}")
|
||||||
@@ -987,7 +1020,9 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
# discord_client.close()
|
# discord_client.close()
|
||||||
|
|
||||||
webhook = DiscordWebhook(url=self.discord_webhook_url)
|
webhook = DiscordWebhook(url=self.discord_webhook_url)
|
||||||
embed = DiscordEmbed(title=self.discord_title, color=self.discord_color)
|
embed = DiscordEmbed(
|
||||||
|
title=self.discord_title, color=self.discord_color
|
||||||
|
)
|
||||||
embed.set_timestamp()
|
embed.set_timestamp()
|
||||||
path = self.last_post_title
|
path = self.last_post_title
|
||||||
embed.set_image(url=latest_post_image)
|
embed.set_image(url=latest_post_image)
|
||||||
@@ -1047,6 +1082,7 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
# global response_data
|
# global response_data
|
||||||
data = ""
|
data = ""
|
||||||
# response_date = ""
|
# response_date = ""
|
||||||
|
logger.debug(f"url: {url}")
|
||||||
try:
|
try:
|
||||||
|
|
||||||
print("cloudflare protection bypass ==================P")
|
print("cloudflare protection bypass ==================P")
|
||||||
@@ -1074,6 +1110,7 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
if LogicOhli24.session is None:
|
if LogicOhli24.session is None:
|
||||||
LogicOhli24.session = requests.session()
|
LogicOhli24.session = requests.session()
|
||||||
|
|
||||||
|
LogicOhli24.session.verify = False
|
||||||
# logger.debug('get_html :%s', url)
|
# logger.debug('get_html :%s', url)
|
||||||
# LogicOhli24.headers["Referer"] = "" if referer is None else referer
|
# LogicOhli24.headers["Referer"] = "" if referer is None else referer
|
||||||
# logger.debug(f"referer:: {referer}")
|
# logger.debug(f"referer:: {referer}")
|
||||||
@@ -1082,8 +1119,17 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
|
|
||||||
# logger.info(headers)
|
# logger.info(headers)
|
||||||
# logger.debug(f"LogicOhli24.headers:: {LogicOhli24.headers}")
|
# logger.debug(f"LogicOhli24.headers:: {LogicOhli24.headers}")
|
||||||
|
|
||||||
|
proxies = {
|
||||||
|
"http": "http://192.168.0.2:3138",
|
||||||
|
"https": "http://192.168.0.2:3138",
|
||||||
|
}
|
||||||
|
|
||||||
page_content = LogicOhli24.session.get(
|
page_content = LogicOhli24.session.get(
|
||||||
url, headers=LogicOhli24.headers, timeout=timeout
|
url,
|
||||||
|
headers=LogicOhli24.headers,
|
||||||
|
timeout=timeout,
|
||||||
|
proxies=proxies,
|
||||||
)
|
)
|
||||||
response_data = page_content.text
|
response_data = page_content.text
|
||||||
# logger.debug(response_data)
|
# logger.debug(response_data)
|
||||||
@@ -1165,7 +1211,8 @@ class Ohli24QueueEntity(FfmpegQueueEntity):
|
|||||||
# Get episode info from OHLI24 site
|
# Get episode info from OHLI24 site
|
||||||
def make_episode_info(self):
|
def make_episode_info(self):
|
||||||
try:
|
try:
|
||||||
base_url = "https://ohli24.org"
|
base_url = "https://a24.ohli24.com"
|
||||||
|
base_url = P.ModelSetting.get("ohli24_url")
|
||||||
iframe_url = ""
|
iframe_url = ""
|
||||||
|
|
||||||
# https://ohli24.org/e/%EB%85%B9%EC%9D%84%20%EB%A8%B9%EB%8A%94%20%EB%B9%84%EC%8A%A4%EC%BD%94%206%ED%99%94
|
# https://ohli24.org/e/%EB%85%B9%EC%9D%84%20%EB%A8%B9%EB%8A%94%20%EB%B9%84%EC%8A%A4%EC%BD%94%206%ED%99%94
|
||||||
@@ -1188,30 +1235,27 @@ class Ohli24QueueEntity(FfmpegQueueEntity):
|
|||||||
)
|
)
|
||||||
# logger.debug(text)
|
# logger.debug(text)
|
||||||
soup1 = BeautifulSoup(text, "lxml")
|
soup1 = BeautifulSoup(text, "lxml")
|
||||||
pattern = re.compile(r"url : \"\.\.(.*)\"")
|
# pattern = re.compile(r"url : \"\.\.(.*)\"")
|
||||||
script = soup1.find("script", text=pattern)
|
# script = soup1.find("script", text=pattern)
|
||||||
|
|
||||||
if script:
|
|
||||||
match = pattern.search(script.text)
|
|
||||||
if match:
|
|
||||||
iframe_url = match.group(1)
|
|
||||||
logger.info("iframe_url::> %s", iframe_url)
|
|
||||||
|
|
||||||
# try:
|
|
||||||
# iframe_url = soup1.find("iframe")["src"]
|
|
||||||
# except:
|
|
||||||
#
|
#
|
||||||
# pattern = r"\.\.\/(.*stream.php.*)"
|
# if script:
|
||||||
#
|
# match = pattern.search(script.text)
|
||||||
# match = re.search(pattern, text, re.MULTILINE)
|
|
||||||
# if match:
|
# if match:
|
||||||
# print(match)
|
# iframe_url = match.group(1)
|
||||||
# matched_line = match.group(0)
|
# logger.info("iframe_url::> %s", iframe_url)
|
||||||
# print(matched_line)
|
pattern = r"<iframe src=\"(.*?)\" allowfullscreen>"
|
||||||
# iframe_url = "https://ohli24.org/"
|
|
||||||
iframe_src = f"https://ohli24.org{iframe_url}"
|
|
||||||
|
|
||||||
iframe_html = LogicOhli24.get_html(iframe_src, headers=headers, timeout=600)
|
match = re.search(pattern, text)
|
||||||
|
if match:
|
||||||
|
iframe_src = match.group(1)
|
||||||
|
logger.debug(f"iframe_src:::> {iframe_src}")
|
||||||
|
|
||||||
|
|
||||||
|
# iframe_src = f'{P.ModelSetting.get("ohli24_url")}{iframe_url}'
|
||||||
|
|
||||||
|
iframe_html = LogicOhli24.get_html(
|
||||||
|
iframe_src, headers=headers, timeout=600
|
||||||
|
)
|
||||||
|
|
||||||
# print(iframe_html)
|
# print(iframe_html)
|
||||||
pattern = r"<iframe src=\"(.*?)\" allowfullscreen>"
|
pattern = r"<iframe src=\"(.*?)\" allowfullscreen>"
|
||||||
@@ -1224,7 +1268,9 @@ class Ohli24QueueEntity(FfmpegQueueEntity):
|
|||||||
logger.debug(f"iframe_src:::> {iframe_src}")
|
logger.debug(f"iframe_src:::> {iframe_src}")
|
||||||
|
|
||||||
# resp1 = requests.get(iframe_src, headers=headers, timeout=600).text
|
# resp1 = requests.get(iframe_src, headers=headers, timeout=600).text
|
||||||
resp1 = LogicOhli24.get_html(iframe_src, headers=headers, timeout=600)
|
resp1 = LogicOhli24.get_html(
|
||||||
|
iframe_src, headers=headers, timeout=600
|
||||||
|
)
|
||||||
# logger.info("resp1::>> %s", resp1)
|
# logger.info("resp1::>> %s", resp1)
|
||||||
soup3 = BeautifulSoup(resp1, "lxml")
|
soup3 = BeautifulSoup(resp1, "lxml")
|
||||||
# packed_pattern = re.compile(r'\\{*(eval.+)*\\}', re.MULTILINE | re.DOTALL)
|
# packed_pattern = re.compile(r'\\{*(eval.+)*\\}', re.MULTILINE | re.DOTALL)
|
||||||
@@ -1246,7 +1292,9 @@ class Ohli24QueueEntity(FfmpegQueueEntity):
|
|||||||
logger.debug(type(packed_script))
|
logger.debug(type(packed_script))
|
||||||
unpack_script = jsbeautifier.beautify(str(packed_script))
|
unpack_script = jsbeautifier.beautify(str(packed_script))
|
||||||
|
|
||||||
p1 = re.compile(r"(\"tracks\".*\])\,\"captions\"", re.MULTILINE | re.DOTALL)
|
p1 = re.compile(
|
||||||
|
r"(\"tracks\".*\])\,\"captions\"", re.MULTILINE | re.DOTALL
|
||||||
|
)
|
||||||
m2 = re.search(
|
m2 = re.search(
|
||||||
r"(\"tracks\".*\]).*\"captions\"",
|
r"(\"tracks\".*\]).*\"captions\"",
|
||||||
unpack_script,
|
unpack_script,
|
||||||
@@ -1264,7 +1312,10 @@ class Ohli24QueueEntity(FfmpegQueueEntity):
|
|||||||
video_hash = iframe_src.split("/")
|
video_hash = iframe_src.split("/")
|
||||||
video_hashcode = re.sub(r"index\.php\?data=", "", video_hash[-1])
|
video_hashcode = re.sub(r"index\.php\?data=", "", video_hash[-1])
|
||||||
self._vi = video_hashcode
|
self._vi = video_hashcode
|
||||||
|
|
||||||
|
logger.debug(f"video_hash::> {video_hash}")
|
||||||
video_info_url = f"{video_hash[0]}//{video_hash[2]}/player/index.php?data={video_hashcode}&do=getVideo"
|
video_info_url = f"{video_hash[0]}//{video_hash[2]}/player/index.php?data={video_hashcode}&do=getVideo"
|
||||||
|
# video_info_url = f"{video_hash[0]}//michealcdn.com/player/index.php?data={video_hashcode}&do=getVideo"
|
||||||
# print('hash:::', video_hash)
|
# print('hash:::', video_hash)
|
||||||
logger.debug(f"video_info_url::: {video_info_url}")
|
logger.debug(f"video_info_url::: {video_info_url}")
|
||||||
|
|
||||||
@@ -1273,10 +1324,11 @@ class Ohli24QueueEntity(FfmpegQueueEntity):
|
|||||||
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) "
|
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) "
|
||||||
"Chrome/96.0.4664.110 Whale/3.12.129.46 Safari/537.36"
|
"Chrome/96.0.4664.110 Whale/3.12.129.46 Safari/537.36"
|
||||||
"Mozilla/5.0 (Macintosh; Intel "
|
"Mozilla/5.0 (Macintosh; Intel "
|
||||||
"Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 "
|
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) "
|
||||||
|
"Chrome/116.0.0.0 Safari/537.36"
|
||||||
"Whale/3.12.129.46 Safari/537.36",
|
"Whale/3.12.129.46 Safari/537.36",
|
||||||
"X-Requested-With": "XMLHttpRequest",
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
"Cookie": "PHPSESSID=hhhnrora8o9omv1tljq4efv216; 2a0d2363701f23f8a75028924a3af643=NDkuMTYzLjExMS4xMDk=; e1192aefb64683cc97abb83c71057733=aW5n",
|
"Cookie": "PHPSESSID=b6hnl2crfvtg36sm6rjjkso4p0; 2a0d2363701f23f8a75028924a3af643=MTgwLjY2LjIyMi4xODk%3D; _ga=GA1.1.586565509.1695135593; __gads=ID=60e47defb3337e02-227f0fc9e3e3009a:T=1695135593:RT=1695135593:S=ALNI_MagY46XGCbx9E4Et2DRzfUHdTAKsg; __gpi=UID=00000c4bb3d077c8:T=1695135593:RT=1695135593:S=ALNI_MYvj_8OjdhtGPEGoXhPsQWq1qye8Q; _ga_MWWDFMDJR0=GS1.1.1695135593.1.1.1695135599.0.0.0",
|
||||||
}
|
}
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
@@ -1312,7 +1364,9 @@ class Ohli24QueueEntity(FfmpegQueueEntity):
|
|||||||
if "crazypatutu.com" in self.url:
|
if "crazypatutu.com" in self.url:
|
||||||
self.headers["Referer"] = iframe_src
|
self.headers["Referer"] = iframe_src
|
||||||
|
|
||||||
match = re.compile(r'NAME="(?P<quality>.*?)"').search(stream_info[0])
|
match = re.compile(r'NAME="(?P<quality>.*?)"').search(
|
||||||
|
stream_info[0]
|
||||||
|
)
|
||||||
self.quality = "720P"
|
self.quality = "720P"
|
||||||
if match is not None:
|
if match is not None:
|
||||||
self.quality = match.group("quality")
|
self.quality = match.group("quality")
|
||||||
@@ -1328,7 +1382,10 @@ class Ohli24QueueEntity(FfmpegQueueEntity):
|
|||||||
|
|
||||||
if match:
|
if match:
|
||||||
self.content_title = match.group("title").strip()
|
self.content_title = match.group("title").strip()
|
||||||
if "season" in match.groupdict() and match.group("season") is not None:
|
if (
|
||||||
|
"season" in match.groupdict()
|
||||||
|
and match.group("season") is not None
|
||||||
|
):
|
||||||
self.season = int(match.group("season"))
|
self.season = int(match.group("season"))
|
||||||
|
|
||||||
# epi_no = 1
|
# epi_no = 1
|
||||||
@@ -1361,7 +1418,9 @@ class Ohli24QueueEntity(FfmpegQueueEntity):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
folder_name = self.content_title
|
folder_name = self.content_title
|
||||||
folder_name = Util.change_text_for_use_filename(folder_name.strip())
|
folder_name = Util.change_text_for_use_filename(
|
||||||
|
folder_name.strip()
|
||||||
|
)
|
||||||
self.savepath = os.path.join(self.savepath, folder_name)
|
self.savepath = os.path.join(self.savepath, folder_name)
|
||||||
if P.ModelSetting.get_bool("ohli24_auto_make_season_folder"):
|
if P.ModelSetting.get_bool("ohli24_auto_make_season_folder"):
|
||||||
self.savepath = os.path.join(
|
self.savepath = os.path.join(
|
||||||
@@ -1391,7 +1450,9 @@ class Ohli24QueueEntity(FfmpegQueueEntity):
|
|||||||
|
|
||||||
|
|
||||||
class ModelOhli24Item(db.Model):
|
class ModelOhli24Item(db.Model):
|
||||||
__tablename__ = "{package_name}_ohli24_item".format(package_name=P.package_name)
|
__tablename__ = "{package_name}_ohli24_item".format(
|
||||||
|
package_name=P.package_name
|
||||||
|
)
|
||||||
__table_args__ = {"mysql_collate": "utf8_general_ci"}
|
__table_args__ = {"mysql_collate": "utf8_general_ci"}
|
||||||
__bind_key__ = P.package_name
|
__bind_key__ = P.package_name
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
@@ -1476,20 +1537,26 @@ class ModelOhli24Item(db.Model):
|
|||||||
conditions = []
|
conditions = []
|
||||||
for tt in tmp:
|
for tt in tmp:
|
||||||
if tt != "":
|
if tt != "":
|
||||||
conditions.append(cls.filename.like("%" + tt.strip() + "%"))
|
conditions.append(
|
||||||
|
cls.filename.like("%" + tt.strip() + "%")
|
||||||
|
)
|
||||||
query = query.filter(or_(*conditions))
|
query = query.filter(or_(*conditions))
|
||||||
elif search.find(",") != -1:
|
elif search.find(",") != -1:
|
||||||
tmp = search.split(",")
|
tmp = search.split(",")
|
||||||
for tt in tmp:
|
for tt in tmp:
|
||||||
if tt != "":
|
if tt != "":
|
||||||
query = query.filter(cls.filename.like("%" + tt.strip() + "%"))
|
query = query.filter(
|
||||||
|
cls.filename.like("%" + tt.strip() + "%")
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
query = query.filter(cls.filename.like("%" + search + "%"))
|
query = query.filter(cls.filename.like("%" + search + "%"))
|
||||||
if option == "completed":
|
if option == "completed":
|
||||||
query = query.filter(cls.status == "completed")
|
query = query.filter(cls.status == "completed")
|
||||||
|
|
||||||
query = (
|
query = (
|
||||||
query.order_by(desc(cls.id)) if order == "desc" else query.order_by(cls.id)
|
query.order_by(desc(cls.id))
|
||||||
|
if order == "desc"
|
||||||
|
else query.order_by(cls.id)
|
||||||
)
|
)
|
||||||
return query
|
return query
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user