syhyz1990 / baiduyun

油猴脚本 - 一个免费开源的网盘下载助手
https://www.youxiaohou.com/install.html
GNU Affero General Public License v3.0
3.23k stars 396 forks source link

关于百度网盘网页版不能调用助手的问题 #373

Closed willxing8 closed 2 months ago

willxing8 commented 3 months ago

目前发现几个问题: 1.百度网盘网页版调用下载助手均不能正常使用。出现提示:调用失败,请重新刷新页面! 2.初步怀疑是浏览器问题:用chrome 版本 113.0.5672.127(正式版本) (64 位)可以正常调用下载助手。但使用高版本不能使用助手下载,如chrome 版本 126.0.6478.115(正式版本) (64 位),同样125版本也试过,不能用,不知道是不是兼容问题。

请大佬抽空解决或优化。

ahdung commented 3 months ago

我也是前两天突然发现百度网盘出不来下载助手了

dfvips commented 3 months ago

一样,用不了了

Tianyi16 commented 3 months ago

我的是在所有网盘上也没有按钮,不能使用了, 自从更新打开开发者模式后整个脚本都失效了。 大神看看吧,没有它好不习惯啊

Gentran commented 3 months ago
        async initPanLinker() {
            pt = this.detectPage();
            let res = await base.post
            (`https://api.youxiaohou.com/config/v2?ver=${version}&a=${author}`, {}, {}, 'text');
            pan = JSON.parse(base.d(res));
>           pan.btn.main = '.wp-s-agile-tool-bar__header'
            Object.freeze && Object.freeze(pan);
            this.addButton()
        }
    };

    let ali = {

Add a line like above will make the button appear in baidu netdisk

tangkunyin commented 3 months ago

开发模式打开,多刷几次能出来。但是下载不了,比如cURL点了之后提示:获取下载链接失败!请刷新网页后重试!

但无论怎么刷都不好使,百度这货也是真的服。。。

dfvips commented 3 months ago

大佬修复一下百度网盘吧 image

Dragon1573 commented 3 months ago

Add a line like above will make the button appear in baidu netdisk

Added but still unable to show the button. 😞

Gentran commented 2 months ago

Baidu changed access token implicit grant returning method recently. The access token will be return in final url like this: https://openapi.baidu.com/oauth/2.0/login_success#expires_in=2592000&access_token=xxxxxx. And any string follwing the # symbol in the URL will lost. This method is not suitable for the script any more.

Dragon1573 commented 2 months ago

And any string follwing the symbol in the URL will lost. This method is not suitable for the script any more.

Why is that? The URL response from Baidu OAuth Server is a callback URL for developer's client. Client parse the URL and extract access token from it.

Maybe parser should be upgraded instead of just switching to another method?

Gentran commented 2 months ago

Maybe parser should be upgraded instead of just switching to another method?

There already exist a function base.getFinalUrl in this script that can exact the callback URL but unfortunately as I described above the access token after # can not be obtained.

Actually Baidu will return a 302 redirection after a implicit grant request. But with pure javascript the Location header is not visible to the developer.

I already tried using Fetch API and XMLHttpRequest to get the final url and redirection Location header but both didn't work.

Maybe the Device Code mode and Authorization Code mode will work but developer must update the token grant URL to add AppKey. And add addition code to display grant page and store the refresh_token.

lvzhenbo commented 2 months ago

我在写完这个issue https://github.com/syhyz1990/baiduyun/issues/383 后,想到了比较简单的解决方式,直接打开链接,然后通过window.location.hash获得access_token然后存起来,这样的话唯一的问题就是需要点两次下载

syhyz1990 commented 2 months ago

已修复,升级到6.2.5