anilife update 2022.10.24(02.)
This commit is contained in:
@@ -114,31 +114,14 @@ class LogicAniLife(LogicModuleBase):
|
||||
@staticmethod
|
||||
def get_html(
|
||||
url: str, referer: str = None, stream: bool = False, timeout: int = 5
|
||||
) -> str:
|
||||
):
|
||||
data = ""
|
||||
try:
|
||||
print("cloudflare protection bypass ==================")
|
||||
# return LogicAniLife.get_html_cloudflare(url)
|
||||
return LogicAniLife.get_html_selenium(url, referer)
|
||||
# return LogicAniLife.get_html_playwright(url)
|
||||
# import browser_cookie3
|
||||
|
||||
# cj = browser_cookie3.chrome(domain_name="anilife.live")
|
||||
referer = "https://anilife.live/"
|
||||
|
||||
if LogicAniLife.session is None:
|
||||
LogicAniLife.session = requests.session()
|
||||
|
||||
# logger.debug('get_html :%s', url)
|
||||
LogicAniLife.headers["Referer"] = "" if referer is None else referer
|
||||
LogicAniLife.headers[
|
||||
"Cookie"
|
||||
] = "_ga=GA1.1.578607927.1660813724; __gads=ID=10abb8b98b6828ae-2281c943a9d500fd:T=1660813741:RT=1660813741:S=ALNI_MYU_iB2lBgSrEQUBwhKpNsToaqQ8A; sbtsck=javuwDzcOJqUyweM1OQeNGzHbjoHp7Cgw44XnPdM738c3E=; SPSI=e48379959d54a6a62cc7abdcafdb2761; SPSE=h5HfMGLJzLqzNafMD3YaOvHSC9xfh77CcWdKvexp/z5N5OsTkIiYSCudQhFffEfk/0pcOTVf0DpeV0RoNopzig==; anilife_csrf=b93b9f25a12a51cf185805ec4de7cf9d; UTGv2=h46b326af644f4ac5d0eb1502881136b3750; __gpi=UID=000008ba227e99e0:T=1660813741:RT=1660912282:S=ALNI_MaJHIVJIGpQ5nTE9lvypKQxJnn10A; DSR=SXPX8ELcRgh6N/9rNgjpQoNfaX2DRceeKYR0/ul7qTI9gApWQpZxr8jgymf/r0HsUT551vtOv2CMWpIn0Hd26A==; DCSS=89508000A76BBD939F6DDACE5BD9EB902D2212A; DGCC=Wdm; adOtr=7L4Xe58995d; spcsrf=6554fa003bf6a46dd9b7417acfacc20a; _ga_56VYJJ7FTM=GS1.1.1660912281.10.1.1660912576.0.0.0; PRLST=EO"
|
||||
|
||||
page_content = LogicAniLife.session.get(
|
||||
url, headers=headers, timeout=timeout, allow_redirects=True
|
||||
)
|
||||
data = page_content.text
|
||||
except Exception as e:
|
||||
logger.error("Exception:%s", e)
|
||||
logger.error(traceback.format_exc())
|
||||
@@ -1052,9 +1035,9 @@ class LogicAniLife(LogicModuleBase):
|
||||
logger.info("url:::> %s", url)
|
||||
data = {}
|
||||
response_data = LogicAniLife.get_html(url, timeout=10)
|
||||
print(response_data)
|
||||
# logger.debug(response_data)
|
||||
|
||||
logger.debug(f"wrapper_xath:: {wrapper_xpath}")
|
||||
# logger.debug(f"wrapper_xath:: {wrapper_xpath}")
|
||||
tree = html.fromstring(response_data)
|
||||
tmp_items = tree.xpath(wrapper_xpath)
|
||||
data["anime_count"] = len(tmp_items)
|
||||
|
||||
Reference in New Issue
Block a user