23 lines
613 B
Python
23 lines
613 B
Python
from urllib.parse import urlparse, parse_qs
|
|
|
|
|
|
def extract_id(url, field):
|
|
parsed_url = urlparse(url)
|
|
query_params = parse_qs(parsed_url.query)
|
|
return query_params.get(field, [None])[0]
|
|
|
|
|
|
def contains_alpha_or_chinese(input_str):
|
|
s = input_str.strip()
|
|
# 判断是否包含字母
|
|
has_alpha = any(char.isalpha() for char in s)
|
|
# 判断是否包含汉字
|
|
has_chinese = any('\u4e00' <= char <= '\u9fff' for char in s)
|
|
# 返回结果
|
|
return s if has_alpha or has_chinese else None
|
|
|
|
|
|
def check_seed_status(status):
|
|
s = ["%", "Free", "free"]
|
|
return status if any(keyword in status for keyword in s) else None
|