오류 수정
This commit is contained in:
@@ -16,19 +16,24 @@ import requests
|
|||||||
from lxml import html
|
from lxml import html
|
||||||
from urllib import parse
|
from urllib import parse
|
||||||
import urllib
|
import urllib
|
||||||
|
import asyncio
|
||||||
|
|
||||||
|
# import aiohttp
|
||||||
|
|
||||||
# third-party
|
# third-party
|
||||||
from flask import request, render_template, jsonify
|
from flask import request, render_template, jsonify
|
||||||
from sqlalchemy import or_, and_, func, not_, desc
|
from sqlalchemy import or_, and_, func, not_, desc
|
||||||
from pip._internal import main
|
from pip._internal import main
|
||||||
|
|
||||||
pkgs = ["beautifulsoup4", "jsbeautifier"]
|
pkgs = ["beautifulsoup4", "jsbeautifier", "aiohttp"]
|
||||||
for pkg in pkgs:
|
for pkg in pkgs:
|
||||||
try:
|
try:
|
||||||
import pkg
|
import pkg
|
||||||
except ImportError:
|
except ImportError:
|
||||||
main(["install", pkg])
|
main(["install", pkg])
|
||||||
|
|
||||||
|
import aiohttp
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
import jsbeautifier
|
import jsbeautifier
|
||||||
|
|
||||||
@@ -89,7 +94,7 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, P):
|
def __init__(self, P):
|
||||||
super(LogicOhli24, self).__init__(P, "setting", scheduler_desc="ani365 자동 다운로드")
|
super(LogicOhli24, self).__init__(P, "setting", scheduler_desc="ohli24 자동 다운로드")
|
||||||
self.name = "ohli24"
|
self.name = "ohli24"
|
||||||
self.queue = None
|
self.queue = None
|
||||||
default_route_socketio(P, self)
|
default_route_socketio(P, self)
|
||||||
@@ -223,6 +228,32 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
P.ModelSetting.get_int("ohli24_max_ffmpeg_process_count")
|
P.ModelSetting.get_int("ohli24_max_ffmpeg_process_count")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def scheduler_function(self):
|
||||||
|
# Todo: 스케쥴링 함수 미구현
|
||||||
|
logger.debug(f"scheduler_function::=========================")
|
||||||
|
url = P.ModelSetting.get("ohli24_url") + "/bbs/board.php?bo_table=ing"
|
||||||
|
|
||||||
|
content_code_list = P.ModelSetting.get_list("ohli24_auto_code_list", "|")
|
||||||
|
logger.debug(f"content_code_list::: {content_code_list}")
|
||||||
|
url_list = ["https://www.naver.com/", "https://www.daum.net/"]
|
||||||
|
# result = asyncio.run(LogicOhli24.main(url_list))
|
||||||
|
# logger.debug(f"result:: {result}")
|
||||||
|
pass
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
async def get_data(url):
|
||||||
|
async with aiohttp.ClientSession() as session:
|
||||||
|
async with session.get(url) as response:
|
||||||
|
content = await response.text()
|
||||||
|
# print(response)
|
||||||
|
return content
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
async def main(url_list):
|
||||||
|
input_coroutines = [LogicOhli24.get_data(url_) for url_ in url_list]
|
||||||
|
res = await asyncio.gather(*input_coroutines)
|
||||||
|
return res
|
||||||
|
|
||||||
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"
|
||||||
|
|
||||||
@@ -316,21 +347,23 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
}
|
}
|
||||||
|
|
||||||
list_body_li = tree.xpath('//ul[@class="list-body"]/li')
|
list_body_li = tree.xpath('//ul[@class="list-body"]/li')
|
||||||
logger.info(list_body_li)
|
# logger.debug(f"list_body_li:: {list_body_li}")
|
||||||
episodes = []
|
episodes = []
|
||||||
vi = None
|
vi = None
|
||||||
for li in list_body_li:
|
for li in list_body_li:
|
||||||
|
# logger.debug(li)
|
||||||
title = li.xpath(".//a/text()")[0].strip()
|
title = li.xpath(".//a/text()")[0].strip()
|
||||||
thumbnail = image
|
thumbnail = image
|
||||||
logger.info(li.xpath('//a[@class="item-subject"]/@href'))
|
# logger.info(li.xpath('//a[@class="item-subject"]/@href'))
|
||||||
link = (
|
link = (
|
||||||
P.ModelSetting.get("ohli24_url")
|
P.ModelSetting.get("ohli24_url")
|
||||||
+ li.xpath('//a[@class="item-subject"]/@href')[0]
|
+ li.xpath('.//a[@class="item-subject"]/@href')[0]
|
||||||
)
|
)
|
||||||
|
# logger.debug(f"link:: {link}")
|
||||||
date = li.xpath('.//div[@class="wr-date"]/text()')[0]
|
date = li.xpath('.//div[@class="wr-date"]/text()')[0]
|
||||||
m = hashlib.md5(title.encode("utf-8"))
|
m = hashlib.md5(title.encode("utf-8"))
|
||||||
# _vi = hashlib.md5(title.encode('utf-8').hexdigest())
|
# _vi = hashlib.md5(title.encode('utf-8').hexdigest())
|
||||||
logger.info(m.hexdigest())
|
# logger.info(m.hexdigest())
|
||||||
_vi = m.hexdigest()
|
_vi = m.hexdigest()
|
||||||
episodes.append(
|
episodes.append(
|
||||||
{
|
{
|
||||||
@@ -350,16 +383,16 @@ class LogicOhli24(LogicModuleBase):
|
|||||||
for idx, item in enumerate(des_items):
|
for idx, item in enumerate(des_items):
|
||||||
# key = des_key[idx]
|
# key = des_key[idx]
|
||||||
span = item.xpath(".//span//text()")
|
span = item.xpath(".//span//text()")
|
||||||
logger.info(span)
|
# logger.info(span)
|
||||||
key = description_dict[span[0]]
|
key = description_dict[span[0]]
|
||||||
try:
|
try:
|
||||||
des[key] = item.xpath(".//span/text()")[1]
|
des[key] = item.xpath(".//span/text()")[1]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
des[key] = ""
|
des[key] = ""
|
||||||
|
|
||||||
logger.info(f"des::>> {des}")
|
# logger.info(f"des::>> {des}")
|
||||||
image = image.replace("..", P.ModelSetting.get("ohli24_url"))
|
image = image.replace("..", P.ModelSetting.get("ohli24_url"))
|
||||||
logger.info("images:: %s", image)
|
# logger.info("images:: %s", image)
|
||||||
logger.info("title:: %s", title)
|
logger.info("title:: %s", title)
|
||||||
|
|
||||||
ser_description = tree.xpath(
|
ser_description = tree.xpath(
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
{{ macros.setting_input_text('ohli24_finished_insert', '완결 표시', col='3', value=arg['ohli24_finished_insert'], desc=['완결된 컨텐츠 폴더명 앞에 넣을 문구입니다.']) }}
|
{{ macros.setting_input_text('ohli24_finished_insert', '완결 표시', col='3', value=arg['ohli24_finished_insert'], desc=['완결된 컨텐츠 폴더명 앞에 넣을 문구입니다.']) }}
|
||||||
{{ macros.setting_checkbox('ohli24_auto_make_season_folder', '시즌 폴더 생성', value=arg['ohli24_auto_make_season_folder'], desc=['On : Season 번호 폴더를 만듭니다.']) }}
|
{{ macros.setting_checkbox('ohli24_auto_make_season_folder', '시즌 폴더 생성', value=arg['ohli24_auto_make_season_folder'], desc=['On : Season 번호 폴더를 만듭니다.']) }}
|
||||||
</div>
|
</div>
|
||||||
{# {{ macros.setting_checkbox('ani365_incompleted_auto_enqueue', '자동으로 다시 받기', value=arg['ani365_incompleted_auto_enqueue'], desc=['On : 플러그인 로딩시 미완료인 항목은 자동으로 다시 받습니다.']) }}#}
|
<!--{# {{ macros.setting_checkbox('ani365_incompleted_auto_enqueue', '자동으로 다시 받기', value=arg['ani365_incompleted_auto_enqueue'], desc=['On : 플러그인 로딩시 미완료인 항목은 자동으로 다시 받습니다.']) }}#}-->
|
||||||
{{ macros.setting_checkbox('ohli24_uncompleted_auto_enqueue', '자동으로 다시 받기', value=arg['ohli24_uncompleted_auto_enqueue'], desc=['On : 플러그인 로딩시 미완료인 항목은 자동으로 다시 받습니다.']) }}
|
{{ macros.setting_checkbox('ohli24_uncompleted_auto_enqueue', '자동으로 다시 받기', value=arg['ohli24_uncompleted_auto_enqueue'], desc=['On : 플러그인 로딩시 미완료인 항목은 자동으로 다시 받습니다.']) }}
|
||||||
{{ macros.m_tab_content_end() }}
|
{{ macros.m_tab_content_end() }}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user