惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
V2EX
WordPress大学
WordPress大学
U
Unit 42
I
InfoQ
A
About on SuperTechFans
宝玉的分享
宝玉的分享
J
Java Code Geeks
博客园 - 司徒正美
爱范儿
爱范儿
Engineering at Meta
Engineering at Meta
G
Google Developers Blog
人人都是产品经理
人人都是产品经理
小众软件
小众软件
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Hugging Face - Blog
Hugging Face - Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
aimingoo的专栏
aimingoo的专栏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Last Week in AI
Last Week in AI
腾讯CDC
Recent Announcements
Recent Announcements

林中阴影

林中阴影 | 关于蓝光刻录的一些调查 林中阴影 | 与IPv6地址战斗 林中阴影 | 半年前的NAS升级 林中阴影 | “智能” 家居笔记:一→两年后的回顾 林中阴影 | 旧手机做RDP客户端的一些尝试 林中阴影 | 一些矿渣的耗电量 林中阴影 | 穷人的IP-KVM远程访问 林中阴影 | 内网访问第三季:在运营商的CGNAT网络下 林中阴影 | “智能”家居笔记,其之二 林中阴影 | “智能”家居笔记,其之一 林中阴影 | 仅IPv6家庭内网服务实现v6+v4双栈访问 林中阴影 | 下载装小蜜监理拍摄的图片 林中阴影 | 几物互联 林中阴影 | 整了个“新”平板 林中阴影 | 获取招商信用卡账单的另一种方法 林中阴影 | 我在GitHub的⭐ 林中阴影 | Python与光学计算,2021 林中阴影 | 你可能并不需要内网穿透 林中阴影 | 2020 林中阴影 | 和(基本上)什么也不能连的电脑传递信息 林中阴影 | 我将贻笑于大方之家 林中阴影 | 一个新主题 林中阴影 | 2019过去了,我…… 林中阴影 | Beancount试用,半年后 林中阴影 | 自动输入剪贴板中的内容 林中阴影 | Unicode与数学公式 林中阴影 | Python中光学计算相关的库/Awesome Python for Optics 林中阴影 | 一本厕纸小说 林中阴影 | 震惊!为了在Windows上访问EXT4分区,他竟然做出了这样的事! 林中阴影 | 我的2018
林中阴影 | phpwind论坛刷分脚本(可用于openwrt)
2012-09-11 · via 林中阴影

用Python2写成,为什么不用Lua?因为我不会

'''
Created on 2012-9-10
@author: hh
'''
import cookielib
import urllib2
import urllib
import time
username="Chetter.Hummin"
password="password"
def login(usr, pwd):
    'login function'
    cj = cookielib.CookieJar()
    opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
    opener.addheaders = [('User-agent','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1')]
    url_login = 'http://bbs.sarabalst.com/2b/login.php'
    body={"step":"2","pwuser":usr,"cktime":"31536000","pwpwd":pwd,"lgt":"0"}
    print 'login to get cookies'
    urllib2.install_opener(opener)
    req = urllib2.Request(url_login,urllib.urlencode(body))
    resp = urllib2.urlopen(req)
    #print (resp.read())

if __name__ == '__main__':
    login(username,password)
    print "login success"
    print (time.strftime('%Y-%m-%d %H:%M',time.localtime(time.time())))
    for i in range(0,23):
        try:
            str=urllib2.urlopen("http://bbs.sarabalst.com/2b/",timeout=100).read()
            #print "success"
        except:
            str=""
            #print "fail"
        if str!="":
            print str
            print "refresh success"
        else:
            print "refresh fail"
        print (time.strftime('%Y-%m-%d %H:%M',time.localtime(time.time())))
        time.sleep(300);

在openwrt上测试成功。理论上可以加入crontab,现在还没测试(时间不够)
update :鉴于论坛和路由器双重不给力,给urllib2设了超时