From 53c9884e94e7eea6a57ad04e8983b4763c121ad7 Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Wed, 26 Apr 2023 14:39:02 +0800 Subject: [PATCH] Fix from url get token --- src/module/conf/const.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/module/conf/const.py b/src/module/conf/const.py index bfe6c3cf..39516187 100644 --- a/src/module/conf/const.py +++ b/src/module/conf/const.py @@ -1,4 +1,6 @@ # -*- encoding: utf-8 -*- +from urllib.parse import urlparse, parse_qs + DEFAULT_SETTINGS = { "program": { @@ -65,7 +67,7 @@ ENV_TO_ATTR = { }, "rss_parser": { "AB_RSS_COLLECTOR": ("enable", lambda e: e.lower() in ("true", "1", "t")), - "AB_RSS": ("token", lambda e: e.replace("https://mikanani.me/RSS/MyBangumi?token=", "")), + "AB_RSS": ("token", lambda e: parse_qs(urlparse(e).query).get("token", [None])[0]), "AB_NOT_CONTAIN": ("filter", lambda e: e.split("|")), "AB_LANGUAGE": "language", "AB_ENABLE_TMDB": ("enable_tmdb", lambda e: e.lower() in ("true", "1", "t")),