-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsub.py
25 lines (21 loc) · 804 Bytes
/
sub.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'''
用于生成订阅链接
'''
import requests
'''
base url
http://127.0.0.1:25500/sub?target=%TARGET%&url=%URL%&emoji=%EMOJI%····
doc: https://github.com/tindy2013/subconverter/blob/master/README-cn.md#%E8%BF%9B%E9%98%B6%E9%93%BE%E6%8E%A5
'''
def subconverter(subconverter_url: str, config_url: str, subs: list[str]):
return requests.Request("GET", subconverter_url, params={
'filename': 'MoleSub',
'target': 'clash',
'config': config_url,
'url': '||'.join(subs),
}).prepare()
if __name__ == '__main__' :
subconverter_url = 'http://127.0.0.1:25500/sub'
config_url = 'https://raw.githubusercontent.com/mole828/MoleRuleSwitcher/main/main_rule.ini'
subs = ['tag:test,http://xxx']
print(subconverter(subconverter_url,config_url,subs).url)