인프런 검색 추가

This commit is contained in:
2022-05-19 19:36:53 +09:00
parent bc191caff1
commit 3b6da67a17
2 changed files with 15 additions and 9 deletions

View File

@@ -350,6 +350,7 @@ class LogicInflearn(object):
logger.error(traceback.format_exc())
@staticmethod
@yommi_logger(logging_type="debug")
def get_search_result(query):
try:
# query = query.encode("utf-8")
@@ -359,8 +360,10 @@ class LogicInflearn(object):
html_content = LogicInflearn.get_html(url)
download_path = ModelSetting.get("download_path")
tree = html.fromstring(html_content)
tmp_items = tree.xpath('//div[contains(class, "column")]')
# logger.info('tmp_items:::', tmp_items)
tmp_items = tree.xpath(
'//div[contains(@class, "courses_card_list_body")]/div[contains(@class, "column")]'
)
# logger.info(f"tmp_items::: {tmp_items}")
data = {"ret": "success", "query": query}
@@ -386,7 +389,9 @@ class LogicInflearn(object):
entity["teacher"] = item.xpath('.//div[@class="instructor"]/text()')[
0
].strip()
entity["image_link"] = item.xpath('.//img[@class="photo"]/@src')[0]
entity["image_link"] = item.xpath('.//img[@class="swiper-lazy"]/@src')[
0
]
# logger.info('entity:::', entity['title'])
data["episode"].append(entity)
@@ -953,7 +958,7 @@ class LogicInflearn(object):
)
# print(api_url)
# print('type::::', type(m3u8_url))
logger.debug(m3u8_info)
# logger.debug(m3u8_info)
# temp1['title'] = title
temp1["save_folder"] = Util.change_text_for_use_filename(data["save_folder"])