인프런 파일명 변경 테스트
This commit is contained in:
@@ -352,12 +352,12 @@ class LogicInflearn(object):
|
||||
try:
|
||||
# query = query.encode("utf-8")
|
||||
_query = urllib.parse.quote(query)
|
||||
url = f"{ModelSetting.get('inflearn_url')}/?s={_query}"
|
||||
url = f"{ModelSetting.get('inflearn_url')}/courses?s={_query}"
|
||||
logger.debug("search url::> %s", url)
|
||||
html_content = LogicInflearn.get_html(url)
|
||||
download_path = ModelSetting.get("download_path")
|
||||
tree = html.fromstring(html_content)
|
||||
tmp_items = tree.xpath('//div[@class="item"]')
|
||||
tmp_items = tree.xpath('//div[contains(class, "column")]')
|
||||
# logger.info('tmp_items:::', tmp_items)
|
||||
|
||||
data = {"ret": "success", "query": query}
|
||||
@@ -373,20 +373,27 @@ class LogicInflearn(object):
|
||||
|
||||
for item in tmp_items:
|
||||
entity = {}
|
||||
entity["link"] = item.xpath(".//a/@href")[0]
|
||||
entity["code"] = re.search(r"[0-9]+", entity["link"]).group()
|
||||
entity["title"] = item.xpath('.//span[@class="name-film"]//text()')[
|
||||
entity["link"] = item.xpath(".//a[@class='course_card_front']/@href")[0]
|
||||
entity["code"] = entity["link"].split("/")[-1]
|
||||
entity["_code"] = item.xpath("/div/@data-productid")
|
||||
|
||||
entity["title"] = item.xpath('.//div[@class="course_title"]//text()')[
|
||||
0
|
||||
].strip()
|
||||
|
||||
entity["teacher"] = item.xpath('.//div[@class="instructor"]/text()')[
|
||||
0
|
||||
].strip()
|
||||
entity["image_link"] = item.xpath('.//img[@class="photo"]/@src')[0]
|
||||
# logger.info('entity:::', entity['title'])
|
||||
|
||||
data["episode"].append(entity)
|
||||
|
||||
json_file_path = os.path.join(download_path, "airing_list.json")
|
||||
logger.debug("json_file_path:: %s", json_file_path)
|
||||
|
||||
with open(json_file_path, "w") as outfile:
|
||||
json.dump(data, outfile)
|
||||
# json_file_path = os.path.join(download_path, "airing_list.json")
|
||||
# logger.debug("json_file_path:: %s", json_file_path)
|
||||
#
|
||||
# with open(json_file_path, "w") as outfile:
|
||||
# json.dump(data, outfile)
|
||||
|
||||
return data
|
||||
|
||||
@@ -946,7 +953,7 @@ class LogicInflearn(object):
|
||||
title = res_data["course"]["_"]["current_unit"]["title"]
|
||||
if res_data["newBOX"]["video"]["name"] is not None:
|
||||
name = res_data["newBOX"]["video"]["name"]
|
||||
filename = f"{title}.{name.split('.')[0]}.S{season.zfill(2)}.E{str(idx).zfill(3)}.{name.split('.')[-1]}"
|
||||
filename = f"{title} - S{season.zfill(2)}.E{str(idx).zfill(3)} - {name.split('.')[0]}.{name.split('.')[-1]}"
|
||||
if res_data["newBOX"]["video"]["vod_info"]["hlsUrl"] is not None:
|
||||
# logger.debug(res_data["newBOX"]["video"]["vod_info"]["hlsUrl"])
|
||||
m3u8_url = res_data["newBOX"]["video"]["vod_info"]["hlsUrl"]
|
||||
|
||||
@@ -47,7 +47,20 @@ $("body").on("click", "#btn_search", function (e) {
|
||||
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
success: function (ret) {
|
||||
if (ret.ret) {
|
||||
make_screen_movie_list(ret);
|
||||
current_screen_movie_data = ret;
|
||||
total_page = ret.total_page;
|
||||
console.log("ret::>", ret);
|
||||
|
||||
if (current_screen_movie_data !== "") {
|
||||
make_screen_movie_list(ret, page);
|
||||
div_visible = true;
|
||||
// console.log(div_visible);
|
||||
// $("img.lazyload").lazyload({
|
||||
// threshold : 400,
|
||||
// effect : "fadeIn",
|
||||
// });
|
||||
}
|
||||
next_page = page + 1;
|
||||
} else {
|
||||
$.notify("<strong>분석 실패</strong><br>" + ret.log, {
|
||||
type: "warning",
|
||||
|
||||
Reference in New Issue
Block a user