Giter VIP home page Giter VIP logo

cclient / sina_multi_account_login Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 76 KB

新浪账号批量刷新工具,phantomjs不支持官方npm包(需重新编译),因此以server/client模式实现,web模拟操作外的逻辑都在client中,新版以electron实现,简单清晰很多,这是过时的phantomjs版

JavaScript 45.00% TypeScript 40.27% HTML 14.72%
phantomjs sina sina-login spider clawler

sina_multi_account_login's Introduction

Sina Refresh Token

Stack

Quick Start

start server

  1. cd ./server
  2. npm install
  3. npm run server

start client

  • 单项刷新(server目录下 cd server/)

  • npm run test [email] [passwd]

  • 批量刷新(client目录下 cd client/)

  1. 修改client/src/cron/sinaRefreshToken.ts accountObj
  2. 修改client/src/config/index.ts
  3. npm install
  4. gulp build
  5. 执行
    • 执行一次 node lib/cron/sinaRefreshToken.js
    • 作为后台定时服务 node lib/cron/index.js

补充说明

账号刷新token受限于io,以串行方式运行,如需并行,需要修改server的cookies清除策略,和client。

验证码识别服务采用阿里的here. 同服务只需修改client/src/config内appcode,若要变更,则需重写getCodeImgB64fromImgB64方法

utils

  • tool/html/drag/ImgGetLayout.html 列出选中区域坐标(列出验证码部分坐标)
  • tool/gmcropimg.js 截图测试
  • tool/showimage.html 输入base64查看img

server

  • server/server.js 新浪小号刷新token server
  • server/client.js 新浪小号刷新token client 单项账号

client

  • client/src/cron/sinaRefreshToken.ts 批量刷新(在客户端作100%保证,每执行一次检查所有账号状态,所有成功都则退出,否则一直执行)
  • client/src/cron/index.ts 定时后台(如果上次的任务还未运行完,则下次定时不会新启任务,以任务名标识)

遇到的问题

  1. 计划通过canvas 拿验证码图片转为base64,但toDataURL方法无法跨域,失败
  2. 先拿html页,再单独打开验证码,用新页的验证码验证,chrome里成功,但phantomjs设cookies依然失败,失败,应是不同page的跨域cookies有问题。
  3. 拿html,整页截图,按坐标,截取出验证验部分,成功。

现项目采用方案3。

若使用或测试有疑问

可以联系邮箱 [email protected]

sina_multi_account_login's People

Contributors

cclient avatar

Watchers

 avatar  avatar

Forkers

devopsmi

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.