Giter Club home page Giter Club logo

Comments (10)

beetcb avatar beetcb commented on May 28, 2024

目前版本的 API 有些 Breaking Changes:
我的 repo 里有个现成的更好的例子:

cea/TEST/dcampus.js

Lines 1 to 25 in 730481c

const cea = require('../src/index')
;(async () => {
// Log in and save cookie to cea, using cea.get('cookie') to get them (this function resolve with an users array)
const usersWithTask = await cea.handleCookie()
// Sign in
const logs = await signIn(usersWithTask)
// Log out sign in result
console.table(logs)
})()
async function signIn(usersWithTask) {
const logs = {}
// sign in asynchronizedly with promise all and diff instance of signApp class
await Promise.all(
usersWithTask.map(async i => {
await i.sign.signWithForm()
logs[i.alias || i.id] = i.sign.result
// Fix circular object
delete i.sign
})
)
cea.close()
return logs
}

@CncCbz

from cea.

CncCbz avatar CncCbz commented on May 28, 2024

目前版本的 API 有些 Breaking Changes:
我的 repo 里有个现成的更好的例子:

cea/TEST/dcampus.js

Lines 1 to 25 in 730481c

const cea = require('../src/index')
;(async () => {
// Log in and save cookie to cea, using cea.get('cookie') to get them (this function resolve with an users array)
const usersWithTask = await cea.handleCookie()
// Sign in
const logs = await signIn(usersWithTask)
// Log out sign in result
console.table(logs)
})()
async function signIn(usersWithTask) {
const logs = {}
// sign in asynchronizedly with promise all and diff instance of signApp class
await Promise.all(
usersWithTask.map(async i => {
await i.sign.signWithForm()
logs[i.alias || i.id] = i.sign.result
// Fix circular object
delete i.sign
})
)
cea.close()
return logs
}

@CncCbz

我尝试使用这个demo,但是好像加密密码阶段的key获取不到,是undefined,请问是我哪里没有设置对吗?
image

from cea.

beetcb avatar beetcb commented on May 28, 2024

具体要看学校登录页面了,不同学校不一样 (~ ̄▽ ̄)~

这是(也就是你 Debug 的代码)是登录的核心代码:

cea/crawler/casLogIn.js

Lines 48 to 51 in a39a9a2

password: new AES(
user.password,
$('#pwdEncryptSalt', form).attr('value')
).encrypt(),

你看看你们学校是什么元素,还有需不需要加密密码 @CncCbz

from cea.

beetcb avatar beetcb commented on May 28, 2024

@CncCbz 忘说了,也可以贴一下学校名字,我明天看看 🦄

from cea.

CncCbz avatar CncCbz commented on May 28, 2024

@CncCbz 忘说了,也可以贴一下学校名字,我明天看看 🦄

宁波大学o(╥﹏╥)o,我比较菜,谢谢大佬

from cea.

beetcb avatar beetcb commented on May 28, 2024

@CncCbz 害,不是大佬,其实多花点时间看看应该就可以成功。这是开源项目,随时欢迎交流(贡献)

from cea.

beetcb avatar beetcb commented on May 28, 2024

@CncCbz 更新到 [email protected],适配性更强,你使用你的账号测试一下,看看有没有问题

如果登录失败,看看登录提交的表单和下面是否类似:

image

from cea.

CncCbz avatar CncCbz commented on May 28, 2024

@beetcb 表单没有问题(图1),但是返回的执行recook判断时,返回的是false(图二)我用手动post了一下,response headers也是没有set-cookies的
image
image

from cea.

beetcb avatar beetcb commented on May 28, 2024

如果登录失败,看看登录提交的表单和下面是否类似:

这里是说去浏览器手动成功登录一下看看表单是什么样子的,再和本地对比下 @CncCbz

愿意的话也可以把账号发我邮箱,帮你看看 [email protected]

from cea.

beetcb avatar beetcb commented on May 28, 2024

@CncCbz 最新版本已修复,先 close 掉了!

from cea.

Related Issues (11)

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.