-
Notifications
You must be signed in to change notification settings - Fork 144
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
[求助]怎样使用js在获取mvHash的条件下获取mv的url #67
Comments
js的代码能不能发出来看一下 |
问gpt说是js没有powershell的语法糖:
|
你可以打印 response.data 出来看一下内容,有可能数据获取失败了 |
从错误来看,数据中不存在 backupdownurl 这个参数 |
你也可以把 |
试过了, 不行的, 那个是动态对象, powershell是动态语言, 那个语法糖是独家的 |
有内容, 您使用powershell看一下那个内容就知道了, 它是根据hash动态生成的对象, 用当前最牛b的grok3, 对话了几十轮都没有解决 |
可以的,js也是支持,只要不是用ie浏览器 |
如果还报错改成 |
也不行, |
行吧,完整一点的代码能不能发出来,等我有时间帮你看一下 |
|
大佬我是在n8n中使用的, 下面是n8n中代码节点中的js代码
|
const axios = require('axios');
const cookie = "token=???;userid=???";
const baseUrl = "http://localhost:3000";
const mvHash = '996EF3EEF3F09DE547C83C7E051E2BFB';
// 使用 async/await 的方式
async function getVideoUrl() {
try {
const response = await axios.get(`${baseUrl}/video/url?hash=${mvHash}&cookie=${cookie}`);
const mvUrl = response.data.data[mvHash.toLowerCase()]?.backupdownurl;
console.log(mvUrl);
return mvUrl;
} catch (error) {
console.error('Error fetching video URL:', error);
}
}
// 调用函数
getVideoUrl().then();
// 或者使用 Promise 的方式
/*
axios.get(`${baseUrl}/video/url?hash=${mvHash}&cookie=${cookie}`)
.then(response => {
const mvUrl = response.data.data[mvHash].backupdownurl;
console.log(mvUrl);
})
.catch(error => {
console.error('Error fetching video URL:', error);
});
*/ 改成 |
Cannot read properties of undefined (reading 'backupdownurl')
使用下面的powershell代码可以完美的获取mv的url, 但是我用gpt把下面的代码转成js代码后, 始终报上面的错误, 对js不太懂,再次求助大佬, 先感谢.
The text was updated successfully, but these errors were encountered: