-
Notifications
You must be signed in to change notification settings - Fork 2
/
getv2ray.py
85 lines (66 loc) · 2.55 KB
/
getv2ray.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import requests
import base64
import json
import os
import re
servers = []
if not os.path.isfile('last_server.json'):
with open('last_server.json', 'w') as f:
f.write('[]')
last_server = json.loads(open('last_server.json', 'r').read())
outs = open('v2ray-servers.txt', 'wb')
def isNotSSR(c):
return not c.startswith('ssr')
def getTextFromUrl(u):
return requests.get(u).text
def getServerFromBase64(s):
for j in s.splitlines():
for i in base64.b64decode(j.strip()).decode().splitlines():
if isNotSSR(i):
servers.append(i)
def getServerFromUrl(u):
for i in getTextFromUrl(u).splitlines():
if isNotSSR(i.strip()):
servers.append(i)
def getServerWithPattern(u):
servers.extend(re.findall(r'(vmess|vless|trojan|ss)://.+', getTextFromUrl(u)))
simple_urls = [
'https://raw.githubusercontent.com/learnhard-cn/free_proxy_ss/main/free',
'https://raw.githubusercontent.com/mfuu/v2ray/master/v2ray',
'https://raw.githubusercontent.com/Pawdroid/Free-servers/main/sub',
'https://raw.githubusercontent.com/tbbatbb/Proxy/master/dist/v2ray.config.txt',
'https://raw.githubusercontent.com/freefq/free/master/v2',
'https://raw.githubusercontent.com/Leon406/SubCrawler/main/sub/share/all2',
'https://raw.githubusercontent.com/openRunner/clash-freenode/main/v2ray.txt',
'https://raw.githubusercontent.com/Jsnzkpg/Jsnzkpg/Jsnzkpg/Jsnzkpg',
'https://raw.githubusercontent.com/aiboboxx/v2rayfree/main/v2',
'https://raw.githubusercontent.com/peasoft/NoMoreWalls/master/list.txt',
'https://raw.githubusercontent.com/openRunner/clash-freenode/main/v2ray.txt',
'https://raw.githubusercontent.com/vpei/Free-Node-Merge/main/o/node.txt',
'https://raw.githubusercontent.com/ermaozi01/free_clash_vpn/main/subscribe/v2ray.txt',
'https://raw.githubusercontent.com/ripaojiedian/freenode/main/sub'
]
spl_urls = [
'https://raw.githubusercontent.com/IranianCypherpunks/sub/main/config',
'https://raw.githubusercontent.com/HakurouKen/free-node/main/public',
'https://raw.githubusercontent.com/Bardiafa/Free-V2ray-Config/main/configs.txt'
]
re_urls = [
'https://raw.githubusercontent.com/tolinkshare/freenode/main/README.md',
'https://raw.githubusercontent.com/mianfeifq/share/main/README.md'
]
for su in spl_urls:
getServerFromUrl(su)
for su in simple_urls:
getServerFromBase64(getTextFromUrl(su))
for ru in re_urls:
getServerWithPattern(ru)
servers = list(set(servers))
for server in servers:
if server not in last_server:
last_server.append(server)
outs.write((server + '\n').encode())
outs.close()
uls = open('last_server.json', 'w')
uls.write(json.dumps(last_server))
uls.close()