Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
修复 下载报错 9019 问题 #225 #227
Browse files Browse the repository at this point in the history
  • Loading branch information
yuantuo666 committed Nov 24, 2022
1 parent ae24800 commit 5fa0db6
Show file tree
Hide file tree
Showing 7 changed files with 209 additions and 193 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PanDownload 网页复刻版,PHP 语言版<br/>

由于百度网盘修改分享页面JavaScript代码,导致 `2.1.3` 及以前版本失效。详细信息参见[#93](https://github.com/yuantuo666/baiduwp-php/issues/93)

由于百度网盘修改分享下载接口参数,导致所有旧版本失效,请更新至 `2.2.4.1` 或更新版本体验本项目。<br/>
由于百度网盘修改分享下载接口,导致所有旧版本失效,请更新至 `2.2.5` 或更新版本体验本项目。<br/>

<div align="center"><a href="https://www.bilibili.com/video/BV1N5411A77n"><img src="https://i.loli.net/2021/04/04/9NJ2lC4T78o1XmZ.png" width="500"><br /><b>点此查看本项目安装、配置、使用视频教程</b></a></div>

Expand Down Expand Up @@ -67,13 +67,11 @@ PanDownload 网页复刻版,PHP 语言版<br/>
**SVIP账号**中可设置**SVIP账号****BDUSS****STOKEN**,添加账号后记得进入**会员账号切换模式**将模式改成**顺序模式****轮换模式**。<br />

## 📦New Changes
- 当前版本: `2.2.4.1` (2.2.4版本未更新版本号)
- 更新日期:2022-10-24
- 当前版本: `2.2.5`
- 更新日期:2022-11-24
- 修改内容:
- ⚠错误修复
- 修复 因百度对下载接口调整导致的失效问题 #224
- ♻代码优化
- 可发送下载任务至文件蜈蚣下载 #187
- 修复 下载报错 9019 问题 #225 #227

[查看更多](Update.md)

Expand Down
365 changes: 182 additions & 183 deletions common/download.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ function getDlink(string $fs_id, string $timestamp, string $sign, string $randsk
$data = "encrypt=0" . "&extra=" . urlencode('{"sekey":"' . $randsk . '"}') . "&fid_list=[$fs_id]" . "&primaryid=$share_id" . "&uk=$uk" . "&product=share&type=nolimit";
$header = array(
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.514.1919.810 Safari/537.36",
"Cookie: BDUSS=" . BDUSS . ";BDCLND=" . $randsk . ";",
"Cookie: " . Cookie,
"Referer: https://pan.baidu.com/disk/home"
);
$result = json_decode(post($url, $data, $header), true);
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @link https://space.bilibili.com/88197958
*
*/
$programVersion_Index = "2.2.4.1";
$programVersion_Index = "2.2.5";
session_start();
define('init', true);
if (version_compare(PHP_VERSION, '7.0.0', '<')) {
Expand Down
18 changes: 18 additions & 0 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ function getConfig(&$var, string $name, $default = '')
getConfig($IsConfirmDownload, 'IsConfirmDownload', true);
getConfig($Footer, 'Footer');

getConfig($Cookie, 'Cookie');
getConfig($BDUSS, 'BDUSS');
getConfig($STOKEN, 'STOKEN');
getConfig($SVIP_BDUSS, 'SVIP_BDUSS');
Expand Down Expand Up @@ -228,6 +229,7 @@ function getDbConfig(&$var, string $key)
<h4 class="alert-heading">安装提示</h4>
<hr>
<p>为减少一些不必要的错误,请仔细阅读此安装提示。</p>
<p style="color: red;">因百度对 API 进行修改,更新版本后需要设置完整的 Cookie 参数,可通过 抓包 获取。</p>
<p>建议小白使用宝塔面板,保证 PHP 版本 ≥ 7.0.0 即可,其他保持默认设置即可完美使用本项目。</p>

<h5>初次安装时请检查:</h5>
Expand Down Expand Up @@ -363,6 +365,15 @@ function getDbConfig(&$var, string $key)
<hr />
<h5 class="card-title">解析账号设置</h5>
<p>需要在此设置账号的 cookie ,获取 cookie 方法见 <a href="https://pandownload.com/faq/cookie.html">PD官网</a></p>
<div class="form-group row">
<label class="col-sm-2 col-form-label" style="color: red;">普通账号完整 Cookie</label>
<div class="col-sm-10">
<input class="form-control" name="Cookie" placeholder="例:PANWEB=1; newlogin=1; BIDUPSID=326C4AD1E1521*********7151;……" value="<?php echo $Cookie; ?>">
<small class="form-text">因百度对 API 进行修改,更新版本后需要设置完整的 Cookie 参数,可通过 网页版抓包 获取。</small>
<small class="form-text">获取方法:使用 Edge 浏览器打开百度网盘网页版,按下 F12 打开开发者工具,选择 网络 选项卡,刷新页面,找到一个 请求 URL 为 pan.baidu.com 开头的请求,在请求的详细信息页面往下滑找到 Cookie 参数,右键复制值后粘贴到此处即可。</small>
<small><a href="https://blog.imwcr.cn/2022/11/24/%e5%a6%82%e4%bd%95%e6%8a%93%e5%8c%85%e8%8e%b7%e5%8f%96%e7%99%be%e5%ba%a6%e7%bd%91%e7%9b%98%e7%bd%91%e9%a1%b5%e7%89%88%e5%ae%8c%e6%95%b4-cookie/">图文教程</a></small>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">普通账号BDUSS</label>
<div class="col-sm-10">
Expand Down Expand Up @@ -616,7 +627,12 @@ function CheckForm() {
Swal.showLoading();
USING_DB = $("input[name='USING_DB']:checked").val();
ADMIN_PASSWORDLength = $("input[name='ADMIN_PASSWORD']").val().length;
Cookie = $("input[name='Cookie']").val().length;

if (Cookie < 6) {
Swal.fire("普通账号完整 Cookie 设置错误", "因百度对 API 进行修改,更新版本后需要设置完整的 Cookie 参数,可通过 网页版抓包 获取。", "warning");
return 0;
}
if (ADMIN_PASSWORDLength < 6) {
// 密码过短
Swal.fire("密码过短", "请检查你设置的密码,为保证站点安全,管理员密码必须为6位或6位以上。", "warning");
Expand Down Expand Up @@ -662,6 +678,7 @@ function CheckForm() {
$IsConfirmDownload = (!empty($_POST["IsConfirmDownload"])) ? $_POST["IsConfirmDownload"] : "true";
$Footer = (!empty($_POST["Footer"])) ? $_POST["Footer"] : "";

$Cookie = (!empty($_POST["Cookie"])) ? $_POST["Cookie"] : "";
$BDUSS = (!empty($_POST["BDUSS"])) ? $_POST["BDUSS"] : "";
$STOKEN = (!empty($_POST["STOKEN"])) ? $_POST["STOKEN"] : "";
$SVIP_BDUSS = (!empty($_POST["SVIP_BDUSS"])) ? $_POST["SVIP_BDUSS"] : "";
Expand Down Expand Up @@ -727,6 +744,7 @@ function CheckForm() {
$update_config = str_replace('<IsConfirmDownload>', $IsConfirmDownload, $update_config);
$update_config = str_replace('<Footer>', $Footer, $update_config);

$update_config = str_replace('<Cookie>', $Cookie, $update_config);
$update_config = str_replace('<BDUSS>', $BDUSS, $update_config);
$update_config = str_replace('<STOKEN>', $STOKEN, $update_config);
$update_config = str_replace('<SVIP_BDUSS>', $SVIP_BDUSS, $update_config);
Expand Down
3 changes: 2 additions & 1 deletion install/config_raw
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @link https://imwcr.cn/
* @link https://space.bilibili.com/88197958
*/
const programVersion = '2.2.4.1';
const programVersion = '2.2.5';
if (!defined('init')) {
http_response_code(403); header('Content-Type: text/plain; charset=utf-8'); header('Refresh: 3;url=./');
die("HTTP 403 禁止访问!\r\n此文件是 PanDownload 网页复刻版 PHP 语言版项目版本 " . programVersion . " 的配置文件!\r\n禁止直接访问!");
Expand All @@ -20,6 +20,7 @@ if (!function_exists('curl_init')) {

const Sitename = '<Sitename>';

const Cookie = '<Cookie>';
const BDUSS = '<BDUSS>';
const STOKEN = '<STOKEN>';
const SVIP_BDUSS = '<SVIP_BDUSS>';
Expand Down
2 changes: 1 addition & 1 deletion updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
*
*/

$programVersion_Updater = "2.2.4.1";
$programVersion_Updater = "2.2.5";

0 comments on commit 5fa0db6

Please sign in to comment.