By 苏剑林 | Jan 20, 2016
When working on Windows, I often use Xunlei to download things. If the speed is slow or there are no resources, especially for some relatively niche videos, Xunlei's VIP member service can always be a big help. Later, I accidentally discovered a software called "Xunlei VIP Account Getter," which can obtain some temporary VIP accounts for use. This is a great tool because while opening a Xunlei membership isn't expensive, I don't download things frequently, so it always felt like a bit of a waste. With this, I can use it for free whenever I need to download something.
Recently, I moved to Mac, and while Mac also has a Xunlei client, that account getter is an .exe file and cannot run on Mac. I originally thought the construction of the getter would be very complex, but as it turns out, after some packet sniffing research, I found that the principle behind the account getter is extremely simple. To put it bluntly, it is just a simple crawler. It merely goes to the following two websites that provide accounts and crawls them accordingly:
http://yunbo.xinjipin.com/
http://www.fenxs.com
Based on this, I also wrote a simple one in Python, mainly for my convenience on Mac. Readers can also download and use it if needed; the code is compatible with both 2.x and 3.x versions. The main libraries used are requests and re; the use of pandas and sys is just to make it more user-friendly. I originally thought about writing a simple GUI with Tkinter, but then I realized it probably wasn't necessary~~
# -*- coding:utf-8 -*-
'''
2016.01.21 Update: Modified the regular expression writing to make it more general; added an account source.
'''
import requests as rq
import re
def get1():
source = 'http://yunbo.xinjipin.com/articlelist/?33.html'
web = rq.get(source).text
url = re.findall(' ', web)
def get2():
source = 'http://www.fenxs.com'
web = rq.get(source).text
url = re.findall(u' ', web)[0]
web = rq.get(url).text
return re.findall(u'迅雷.*?([a-zA-z0-9\:]+?)[密码]+?([a-zA-z0-9]+?) ', web)
def get3():
source = 'http://xlfans.com'
web = rq.get(source).text
url = re.findall(u' ', web)[0]
web = rq.get(url).text
return re.findall(u'迅雷.*?([a-zA-z0-9\:]+?)[密码]+?([a-zA-z0-9]+?) ', web)
if __name__ == '__main__':
import pandas as pd # For convenient output display
import sys # To determine system version
print u'\n============Simple Xunlei Account Getter============\n By http://kexue.fm\n'
while True:
if sys.version_info[0] < 3:
s = raw_input(u'Please select data source (input s1, s2, or s3; input anything else to exit): ')
else:
s = input(u'Please select data source (input s1, s2, or s3; input anything else to exit): ')
if s == 's1':
print pd.DataFrame(get1(), columns=[u'Account', u'Password'])
elif s == 's2':
print pd.DataFrame(get2(), columns=[u'Account', u'Password'])
elif s == 's3':
print pd.DataFrame(get3(), columns=[u'Account', u'Password'])
else:
break