Skip to content

Instantly share code, notes, and snippets.

@enihsyou
Created September 4, 2019 17:50
Show Gist options
  • Save enihsyou/9dbcc8df273e7a7ae24cc0795f561438 to your computer and use it in GitHub Desktop.
Save enihsyou/9dbcc8df273e7a7ae24cc0795f561438 to your computer and use it in GitHub Desktop.
为梅林固件科学上网插件适配 N3RO 的 SIP002 URIs
from urllib.request import urlopen
from urllib.parse import unquote
import base64
import re
n3ro_rss_link = input("N3RO SIP002 URIs: ").strip()
data = urlopen(n3ro_rss_link).read()
links = base64.b64decode(data).decode()
for link in links.splitlines():
matcher = re.match(r"ss://(.+)@(.+)#(.+)", link)
a = base64.b64decode(matcher.group(1)).decode()
b = matcher.group(2)
c = unquote(matcher.group(3))
ss_link = base64.b64encode((a + '@' + b).encode()).decode()
remark = c[:c.index('#')].replace(' ', '')
print('ss://' + ss_link + '#' + remark)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment