本帖最后由 ShiratoriAira 于 2021-8-4 23:52 编辑
没有8个链接,只有6个
[Python] 纯文本查看 复制代码 #!/usr/bin/env python3
import re
from pathlib import Path
from urllib.parse import unquote
s = (Path.cwd() / '待匹配.txt').read_text(encoding='utf-8')
p = re.compile(r'https?://.+?\.45yun\.net/[^"]+')
url_list = [unquote(x).replace('&', '&') for x in p.findall(s)]
print('\n'.join(url_list))
print(len(url_list))
[Bash shell] 纯文本查看 复制代码 https://vip5.45yun.net/file/2021/07/27/a31c15aa32bed807f9cc564b36607023.7z/ijfns4517.7z?t=282663&e=1628090682&st=sfDD1l9TLenF6bQHvna-aA
https://us5.45yun.net/file/2021/07/27/a31c15aa32bed807f9cc564b36607023.7z/ijfns4517.7z?t=282663&e=1628090682&st=sfDD1l9TLenF6bQHvna-aA
https://vip5.45yun.net/file/2021/07/27/a31c15aa32bed807f9cc564b36607023.7z/ijfns4517.7z?t=282663&e=1628090682&st=sfDD1l9TLenF6bQHvna-aA
https://vip5.45yun.net/file/2021/07/27/a31c15aa32bed807f9cc564b36607023.7z/ijfns4517.7z?t=282663&e=1628090682&st=sfDD1l9TLenF6bQHvna-aA
https://us5.45yun.net/file/2021/07/27/a31c15aa32bed807f9cc564b36607023.7z/ijfns4517.7z?t=282663&e=1628090682&st=sfDD1l9TLenF6bQHvna-aA
https://vip5.45yun.net/file/2021/07/27/a31c15aa32bed807f9cc564b36607023.7z/ijfns4517.7z?t=282663&e=1628090682&st=sfDD1l9TLenF6bQHvna-aA
6
P.S.代码里的replace 【&】被过滤了,请自行替换。 |