Archived
1
0
Fork 0

Revert "Revert "force to use mobile domain when querying moegirlpedia""

This reverts commit ed76a54725.
This commit is contained in:
yzhh 2023-02-04 14:39:12 +08:00
parent ed76a54725
commit 12185aaa63

View file

@ -134,6 +134,7 @@ class WikiLib:
self.headers = headers
async def get_json_from_api(self, api, **kwargs) -> dict:
api = re.sub('https://zh.moegirl.org.cn/', 'https://mzh.moegirl.org.cn/', api) # 萌娘百科强制使用移动版 API
if kwargs is not None:
api = api + '?' + urllib.parse.urlencode(kwargs) + '&format=json'
Logger.debug(api)
@ -196,6 +197,7 @@ class WikiLib:
async def check_wiki_available(self):
try:
self.url = re.sub('https://zh.moegirl.org.cn/', 'https://mzh.moegirl.org.cn/', self.url) # 萌娘百科强制使用移动版 API
api_match = re.match(r'(https?://.*?/api.php$)', self.url)
wiki_api_link = api_match.group(1)
except Exception: