mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 23:17:20 +08:00
fix(site): satisfy login fallback type ratchet
This commit is contained in:
@@ -109,7 +109,7 @@ class CookieHelper:
|
|||||||
return cookie_str
|
return cookie_str
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _find_login_page_url(html, current_url: str) -> Optional[str]:
|
def _find_login_page_url(html: etree._Element, current_url: str) -> Optional[str]:
|
||||||
"""从首页查找同源登录入口,避免把账号密码提交到跨域页面。"""
|
"""从首页查找同源登录入口,避免把账号密码提交到跨域页面。"""
|
||||||
login_hrefs = html.xpath(
|
login_hrefs = html.xpath(
|
||||||
"//a["
|
"//a["
|
||||||
@@ -123,7 +123,7 @@ class CookieHelper:
|
|||||||
target = urlparse(login_url)
|
target = urlparse(login_url)
|
||||||
if target.scheme in ("http", "https") and \
|
if target.scheme in ("http", "https") and \
|
||||||
target.scheme == current.scheme and target.netloc == current.netloc:
|
target.scheme == current.scheme and target.netloc == current.netloc:
|
||||||
return login_url
|
return str(login_url)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_site_cookie_ua(self,
|
def get_site_cookie_ua(self,
|
||||||
@@ -195,7 +195,7 @@ class CookieHelper:
|
|||||||
html = etree.HTML(html_text) if html_text else None
|
html = etree.HTML(html_text) if html_text else None
|
||||||
if html is None:
|
if html is None:
|
||||||
return None, None, "解析网页源码失败"
|
return None, None, "解析网页源码失败"
|
||||||
for xpath in self._SITE_LOGIN_XPATH.get("username"):
|
for xpath in self._SITE_LOGIN_XPATH["username"]:
|
||||||
if html.xpath(xpath):
|
if html.xpath(xpath):
|
||||||
username_xpath = xpath
|
username_xpath = xpath
|
||||||
break
|
break
|
||||||
|
|||||||
+1
-1
@@ -67,7 +67,7 @@
|
|||||||
"arg-type": 4,
|
"arg-type": 4,
|
||||||
"no-any-return": 2,
|
"no-any-return": 2,
|
||||||
"no-untyped-def": 1,
|
"no-untyped-def": 1,
|
||||||
"operator": 2,
|
"operator": 1,
|
||||||
"type-arg": 8,
|
"type-arg": 8,
|
||||||
"union-attr": 5,
|
"union-attr": 5,
|
||||||
"var-annotated": 2
|
"var-annotated": 2
|
||||||
|
|||||||
Reference in New Issue
Block a user