Git Product home page Git Product logo

baidu_tieba_auto_sign's Introduction

百度贴吧自动签到

功能

只需在配置文件conf.ini中保存用户名和密码

  • 网页版

模拟用网页批量签到

  • 客户端版(获得更多经验)

可以自动获取CookieBDUSS,并模拟客户端进行批量签到。

起因

帮侄女签到

开发环境

Python 2.7.9
Mac os 10.10.5

windows 平台没有测试过,应该可以使用

环境配置

# 下载源码
git clone [email protected]:chaonet/baidu_tieba_auto_sign.git
# 或者通过 HTTPS 下载:
git clone https://github.com/chaonet/baidu_tieba_auto_sign.git

cd baidu_tieba_auto_sign

# 安装依赖
virtualenv env/
. ./env/bin/activate
pip install -r requirements.txt

使用

  • 设置账号、密码

以便脚本运行时读取,用于登陆

baidu_tieba_auto_sign目录中创建conf.ini文件,内容如下:

[main]
username=账号
password=密码

或者

在系统的环境变量中设置,方法略……

  • 模拟网页进行百度贴吧批量签到
python sign.py
  • 模拟客户端进行百度贴吧批量签到
python baidu-tieba-auto-sign.py

提示:如果用错误的用户名或密码进行模拟客户端签到失败,改正后,需要过几个小时再次运行才能正常签到

参考代码

参考并整合了baidu-tieba-auto-signTieba-autoSign

过程

最初找到的是baidu-tieba-auto-sign,但要自己获取CookieBDUSS,门槛有点高,于是找到了Tieba-autoSign,可以顺利签到。

但是发现了一个问题,这是模拟网页签到,而手机客户端签到经验很多啊!禁不住诱惑,开始琢磨。baidu-tieba-auto-sign是可以模拟客户端的,关键是用脚本实现CookieBDUSS的获取,经过一番搜索,依然一头雾水。

无意中打印Tieba-autoSign登陆后的cookie,惊喜发现里面就有CookieBDUSS

于是,截取Tieba-autoSign从开始到登陆成功的代码,将函数修改为返回CookieBDUSS

baidu-tieba-auto-sign调用并获取返回的CookieBDUSS作为输入函数,并适当修改 HTTP 头部,测试,成功。

最终,实现只需在配置文件conf.ini中保存用户名和密码,可以自动获取CookieBDUSS,并模拟客户端进行批量签到。

== update 20160717 ==

有人提 issue 说,错误的密码也会提示登陆成功,并且进入死循环
于是直接改错密码,进行登陆,失败
接着用正确密码登陆,还是失败?!
以为获取 cookie 的方法不行了,折腾了几个小时

最后发现,用错误密码后,会有几个小时正确密码也无法登陆

baidu_tieba_auto_sign's People

Contributors

chaonet avatar

Watchers

James Cloos avatar Kevin Zhang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.