2022年 11月 8日

python获取飞讯免费ss账号

ss账号除了ss-link比较便宜,其他的都比较贵,贵的对于大众网友来说,有点离谱了。看到飞讯有免费的ss,但是手动拷贝太麻烦,索性用最近学的python写的小程序,直接生成配置

#coding=utf-8
import sys, urllib,codecs
from lxml import etree
url = "http://www.feixunvpn.com/page/testss.html"
sslist =[]
iplist=[]
for i in range(30):
    wp = urllib.urlopen(url)
    content = wp.read()
    tree=etree.HTML(content)
    ip=tree.xpath("//div[@class='testvpnitem']")[0][2].text
    port=tree.xpath("//div[@class='testvpnitem']/text()")[2].strip()[-4:]
    passwd=tree.xpath("//div[@class='testvpnitem']/text()")[3].strip()[-6:]
    ss=[ip,str(port),str(passwd)]
    if(ss[0] not in iplist):
        iplist.append(ss[0])
        sslist.append(ss)
print("获得"+str(len(sslist))+"个ss测试账号")
conf='{\n"configs" : [\n'
for ss in sslist:
    conf=conf +'{\n"server" : "'+ss[0]+'",\n"server_port" : '+ss[1]+',\n"password" : "'+ss[2]+'",' \
            '\n"method" : "aes-256-cfb",\n"remarks" : ""}'
conf=conf+'],\n"strategy" : "com.shadowsocks.strategy.ha",\n"index" : -1,\n"global" : false,\n' \
          '"enabled" : true,\n"shareOverLan" : false,\n"isDefault" : false,\n"localPort" : 1081,' \
          '\n"pacUrl" : null,\n"useOnlinePac" : false,\n"availabilityStatistics" : false}'
print conf
ssf = open("gui-config.json","w")
ssf.write(conf)
ssf.close()
  • 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