28 lines
727 B
Python

import os
import re
pattern = re.compile(r'Maimai2Servlet/(.*?)MaimaiChn')
# 获取目录
dir = 'C:/Users/remik1r3n/Workspace/maimaiDX-Api/HashEntertainment'
known_hashes = []
for filename in os.listdir(dir):
# 只处理.txt文件
if filename.endswith('.txt'):
file_path = os.path.join(dir, filename)
with open(file_path, 'r', encoding='utf-8') as file:
content = file.read()
# 搜索匹配的模式
matches = pattern.findall(content)
# 输出每个匹配中的不定内容
for match in matches:
known_hashes.append(match)
# 去重
known_hashes = list(set(known_hashes))
# 输出
for hash in known_hashes:
print(hash)