Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pikpak): add captcha_token generation function #6775

Merged
merged 1 commit into from
Jul 14, 2024

Conversation

Three-taile-dragon
Copy link
Contributor

改动

  • Link函数现在使用新的request函数发送请求
  • 初始化时获取UserID

新增功能

  • 自动生成 DeviceID
  • 自动生成 UserAgent
  • 自动生成 CaptchaToken
  • 添加了新的request函数,携带CaptchaTokenDeviceIDUserAgent

修复内容

  • 修复了Link函数返回下载地址无效的问题,现在可以正常播放和下载

@Three-taile-dragon
Copy link
Contributor Author

实现思路

  • 通过调试可知,在不携带x-captcha-tokenx-device-id、以及正确的User-Agent时,文件地址获取出来的链接是错误的
  • 携带上述参数后,返回的地址改变,此时的地址可以正常播放和下载

参数生成

  • DeviceID:生成略过
  • CaptchaToken:通过https://user.mypikpak.com/v1/shield/captcha/init接口获取,需要计算captcha_sign
  • captcha_sign:由ClientIDClientVersionPackageNameDeviceIDtimestamp拼接成的字符串,与Algorithms中的字符串不断拼接 进行MD5运算后,加上前缀1.得到

附上Algorithms值:

{
	"PAe56I7WZ6FCSkFy77A96jHWcQA27ui80Qy4",
	"SUbmk67TfdToBAEe2cZyP8vYVeN",
	"1y3yFSZVWiGN95fw/2FQlRuH/Oy6WnO",
	"8amLtHJpGzHPz4m9hGz7r+i+8dqQiAk",
	"tmIEq5yl2g/XWwM3sKZkY4SbL8YUezrvxPksNabUJ",
	"4QvudeJwgJuSf/qb9/wjC21L5aib",
	"D1RJd+FZ+LBbt+dAmaIyYrT9gxJm0BB",
	"1If",
	"iGZr/SJPUFRkwvC174eelKy",
}

算法函数

// GetCaptchaSign 获取验证码签名
func (c *Common) GetCaptchaSign() (timestamp, sign string) {
	timestamp = fmt.Sprint(time.Now().UnixMilli())
	str := fmt.Sprint(ClientID, ClientVersion, PackageName, c.DeviceID, timestamp)
	for _, algorithm := range Algorithms {
		str = utils.GetMD5EncodeStr(str + algorithm)
	}
	sign = "1." + str
	return
}

@Three-taile-dragon Three-taile-dragon changed the title fix(pikpak): add CaptchaToken generation function fix(pikpak): add captcha_token generation function Jul 14, 2024
@anwen-anyi
Copy link
Contributor

哈哈 这下实锤了Pikpak就是迅雷的😂😂

@xhofe xhofe merged commit a93937f into AlistGo:main Jul 14, 2024
3 checks passed
@zhuliang21
Copy link

在 Docker 中使用 这个更新的 的 main 9425a66
挂载 PikPak,刚启动时正常,不久后无法读取内容,只能看到目录。

@zhuliang21
Copy link

@Three-taile-dragon 可能是后续的请求有问题

@Three-taile-dragon
Copy link
Contributor Author

@Three-taile-dragon 可能是后续的请求有问题

#6788 发了新的PR,修复了这个问题

ForSourceCodeAnalysis pushed a commit to ForSourceCodeAnalysis/alist that referenced this pull request Aug 4, 2024
Three-taile-dragon added a commit to loognsss/blist that referenced this pull request Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants