手动获取有道云笔记的文件直链(PHP代码获取)

手动拼接

  1. 得到p参数:http://note.youdao.com/yws/public/note/{分享id}?editorType=0&cstk=cGtjFpHb
  2. 拼接下载地址:http://note.youdao.com/yws/api/personal/file/{p参数}?method=download&inline=true&shareKey={分享id}

PHP代码



$id = $_GET['id'] ?? '';

if (empty($id)) {
    exit('缺少有道云分享id');
}

$url = "http://note.youdao.com/yws/public/note/{$id}?editorType=0&cstk=cGtjFpHb";
$res = file_get_contents($url);
$resArr = json_decode($res, true);
$p = trim($resArr['p'], '/');

$downUrl = "http://note.youdao.com/yws/api/personal/file/{$p}?method=download&inline=true&shareKey={$id}";

echo $downUrl;

你可能感兴趣的:(php)