获取分享社最新一期的迅雷分享账号

#coding:utf-8

import urllib2
import re
import time
import datetime

print time.strftime('当前时间是:%Y年%m月%d日 %H:%M:%S',time.localtime(time.time())).decode('utf-8')
t = datetime.datetime.now()
month = t.month
day = t.day

url_home = 'http://www.fenxs.com/'

patt = 'www\.fenxs\.com\/\d+\.html" \S+ ' + str(month) + '\S\S\S' + str(day) + '\S\S\S'
#  www.fenxs.com/1540.html" title="分享社 7月15日
try:
    html_home = urllib2.urlopen(url_home,timeout=10).read()
except urllib2.URLError,e:
    print(e.reason)

search_url = re.search(patt,html_home)

print(u'正在查找资源...')

if search_url:
    print(u'找到资源...')
else:
    print(u'没有找到资源...')

resource_url = 'http://' + str( re.match(('www\.fenxs\.com\/\d+\.html'),search_url.group()).group() )
print(u'资源链接:%s' % resource_url)

try:
    html_resource = urllib2.urlopen(resource_url,timeout=10).read()
except urllib2.URLError,e:
    print(e.reason)

patt_resource = '[\\x80-\\xff]+\w{6,}:[12][\\x80-\\xff]+\w+<'

search_account_resource = re.findall(patt_resource,html_resource)

if t.month<10:
    _time = str(t.year)+'0'+str(t.month)
else:
    _time = str(t.year)+str(t.month)

if t.day<10:
    _time = _time+'0'+str(t.day)
else:
    _time = _time+str(t.day)

file_name = 'xunlei_'+_time+'.txt'
account_resource = open(file_name,'w')

for i in search_account_resource:
    print(i[:-1].decode('utf-8'))
    account_resource.write(i[:-1]+'\n')

account_resource.close()

print(u'账号已生成在本目录下的%s文件中...' % file_name)

这里写图片描述

这里写图片描述

稍微修改了一下:http://bbs.fishc.com/thread-57687-1-1.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值