修复飞机消息中不包含空格的情况下链接更换问题
This commit is contained in:
parent
5f5ca320dd
commit
3f1bae6866
@ -91,7 +91,8 @@ def get_url_mapping(urls_with_context, template_type):
|
|||||||
|
|
||||||
|
|
||||||
def extract_urls(text):
|
def extract_urls(text):
|
||||||
pattern = r'(?:\n|^)\s*([^\n]*?)\s*(https?://[^\s]+)'
|
pattern = r'(?:\n|^)\s*([^\n]*?)\s*(https?://[\w\.-]+)'
|
||||||
|
# pattern = r'(?:\n|^)\s*([^\n]*?)\s*(https?://[^\s]+)'
|
||||||
url_list = re.findall(pattern, text)
|
url_list = re.findall(pattern, text)
|
||||||
url_type, is_agent = get_url_type(text, url_list)
|
url_type, is_agent = get_url_type(text, url_list)
|
||||||
|
|
||||||
@ -252,14 +253,15 @@ WEB https://www.as421r.vip:9520
|
|||||||
H5 https://www.c0azge.vip:7988 【新】
|
H5 https://www.c0azge.vip:7988 【新】
|
||||||
'''
|
'''
|
||||||
|
|
||||||
res = requests.post("http://127.0.0.1:8000/changeurl", json={'text': text})
|
# res = requests.post("http://127.0.0.1:8000/changeurl", json={'text': text})
|
||||||
if res.status_code == 200:
|
# if res.status_code == 200:
|
||||||
if res.json()['res']:
|
# if res.json()['res']:
|
||||||
msg = f'{res.json()["msg"]}修改成功'
|
# msg = f'{res.json()["msg"]}修改成功'
|
||||||
else:
|
# else:
|
||||||
msg = f'{res.json()["msg"]}修改失败'
|
# msg = f'{res.json()["msg"]}修改失败'
|
||||||
else:
|
# else:
|
||||||
msg = '请求发生错误,请检查服务是否正常'
|
# msg = '请求发生错误,请检查服务是否正常'
|
||||||
logger.debug(msg)
|
# logger.debug(msg)
|
||||||
|
change_url(text)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"An error occurred in the main program: {e}")
|
logger.debug(f"An error occurred in the main program: {e}")
|
||||||
|
Loading…
Reference in New Issue
Block a user