撸了个 V2EX 自动签到脚本

2016-05-17 19:28:50 +08:00
 nivan

casperjs 写签到脚本真是简单直观!!! http://i-ai.org/v2ex-autosign/

4924 次点击
所在节点    分享创造
45 条回复
EchoWhale
2016-05-18 11:29:52 +08:00
@weer0026 还是对 Ruby 念念不忘吧?(*^__^*)
写起来真的很舒服,对人脑太友好了
wq2016
2016-05-18 14:29:16 +08:00
我是用 CasperJS 写的
inmyfree
2016-05-18 14:55:13 +08:00
前天快 200 天刚断了。。。
gogobody
2016-05-18 15:11:50 +08:00
@atnoot 求 python 版分享!
bearqq
2016-05-18 16:11:44 +08:00
@gogobody python , 2.7 依赖 mechanize 。

"""
def make_br():
br = mechanize.Browser(history=NoHistory())
#cj = cookielib.LWPCookieJar()
#br.set_cookiejar(cj)
br.set_handle_equiv(True)
br.set_handle_gzip(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)

br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
br.set_debug_http(False)
br.addheaders = [('User-agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0')]
#br.set_proxies({"http":"username:password@proxy.com:8888"})
return br

class v2ex(object):
def __init__(self,v2expara,useproxy=0,proxyaddr='http://127.0.0.1:8580'):
self.name='v2ex'
self.br=make_br()
self.v2expara=v2expara #('name','pass')

def sign(self):
br=self.br
br.open('https://www.v2ex.com/signin')
#for f in br.forms():
br.select_form(nr=1)

for i in br.form.__dict__['controls']:
#print i.name,i.type
if i.type=='text':
br.form[i.name]=self.v2expara[0]
elif i.type=='password':
br.form[i.name]=self.v2expara[1]
br.submit()

br.open('https://www.v2ex.com/mission/daily')
if u'每日登录奖励已领取' in br.response().read():
return 1
else:
br.open(re.search(r'/mission/daily/redeem\?once=\d+', br.response().read()).group())
if u'请重新点击一次以领取每日登录' in response:
return 0
elif br.response().read():
return 1
return 0
"""
bearqq
2016-05-18 16:15:03 +08:00
suspended
2016-05-18 16:38:12 +08:00
@EchoWhale 不能这么说吧。去年做了个 300K 的小项目(一个数据归档系统),除了直接和磁带机打交道的部分是 C ,其余的执行器,调度,空间管理,管理界面,全部都是用 ruby 写的。
EchoWhale
2016-05-18 17:56:38 +08:00
@suspended 个人开发者?那的确可以选任何语言。或者你能影响到公司新项目采用的技术栈。
ruby 的就业范围很窄是个不争的事实,所以我才说 Ruby 不能当饭吃
atnoot
2016-05-18 19:22:07 +08:00
@gogobody github.com/davisqi/me.git 中 V2EX 可以参考一下
audi
2016-05-18 19:22:30 +08:00
签到有什么用
xiaomayi0323
2016-05-18 23:42:50 +08:00
@atnoot Python 版的来一发
gogobody
2016-05-19 08:27:27 +08:00
gogobody
2016-05-19 08:27:49 +08:00
@bearqq @atnoot 感谢 2 位!
Clarencep
2016-05-19 09:21:24 +08:00
@wex 你也遇到啦~ 原来不是我一个人遇到这个问题 我还以为出现幻觉了,后来就没再遇到过
suspended
2016-05-19 11:06:18 +08:00
@EchoWhale 国内不流行 Ruby ,哪怕在国外似乎也都局限于 Rails? 蛮可惜的。我个人从没用过 Rails 。
shulen
2016-05-20 08:35:52 +08:00
https://github.com/ForestCho/node-v2ex 之前也弄过一个,现在还挂着签到
nivan
2016-05-20 10:11:12 +08:00
@shulen 谢谢分享!
v2ex.js
62: console.log('登录中...\n 此过程你有被封 IP 的危险...');
话说 v 站会封 IP 的吗?
shulen
2016-05-20 13:05:38 +08:00
@nivan 多次错误登录会封 ip
nivan
2016-05-20 14:55:59 +08:00
@shulen 哦~好像很厉害,试试去.
nivan
2016-05-20 15:04:22 +08:00
@shulen 试了下!!!😳封 172800 秒

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/279329

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX