Last active
October 12, 2016 03:43
-
-
Save xcodebuild/c2b4fbf7bee58046f70f35e6d9058598 to your computer and use it in GitHub Desktop.
Update MEOW config with free shadowsocks provider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import urllib | |
import re | |
import os | |
from os.path import expanduser | |
url = "http://freevpnss.cc/" | |
page = urllib.urlopen(url).read() | |
r = re.compile('码:\d+') | |
sspw = r.findall(page)[3].lstrip('码:') | |
configfile = open(expanduser('~/.meow/rc'), 'r+') | |
lines = configfile.readlines() | |
config = 'proxy = ss://aes-256-cfb:%[email protected]:443' % sspw | |
lines = ['' if line.startswith('proxy') else line for line in lines] | |
lines.append(config) | |
configfile.seek(0) | |
configfile.truncate() | |
configfile.writelines(lines) | |
configfile.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment