Comments (4)
I found another question:
fetch data is working with nodejs but not working as expected in the browser .
var myHeaders = new Headers();
myHeaders.append(
"User-Agent",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.68"
);
myHeaders.append("Cookie", "buvid3=321321312");
var requestOptions = {
method: "GET",
headers: myHeaders,
redirect: "follow",
};
fetch(
"https://api.bilibili.com/x/space/wbi/acc/info?mid=2132180406",
requestOptions
)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
from biliscope.
oh, I got the answer from stackoverflow ,
add the credentials: 'include'
, and it make sense . no need to add header and cookie.
just change one line code and it works.
fetch(`${BILIBILI_API_URL}/x/space/wbi/acc/info?mid=${userId}`,{credentials: "include"})
from biliscope.
这个大概率是爬得频率太高被block了一小下,和credential没关系。你后面又work了是因为block的时间过去了……如果和credential有关,那这个API肯定所有的情况下没有credential都有问题。
from biliscope.
哈哈哈哈 好玄学, 就我刚点开的一个打不开
不过就我观察到的关于这个api 的issue来看 它的返回是-401
{"code":-401,"message":"非法访问"}
不是大家所说的-509 {"code":-509,"message":"请求过于频繁,请稍后再试","ttl":1}
,我从网页能看是因为我当时还有登陆的cookie
为了避免cookie影响, 我重现了一下这个场景,在safari浏览器上,我删除了所有bilibili的cookie
访问id为2的:
另外我在bilibili-API-collect
项目文档里面找到一些关于4011的说明,大部分issue2提到如何解决这个问题都是关于加ua和cookie的方式, 之所以加credential是为了解决cookie共享问题 .
Footnotes
from biliscope.
Related Issues (20)
- [FR] 增加候选标签至信息卡片的备注框下方 HOT 2
- [FR] 移除词云中的 aid, bvid 和年份 HOT 1
- [FR] 视频标签也按权重加入词云并辅助分词 HOT 1
- [FR] 重构 `UserProfileCard.prototype.updateData` 函数 HOT 4
- [BUG] 通过标签搜索用户搜不到时,永远无法显示出预设页面
- [BUG] 舰长的随机排列算法,并不完全随机。
- [BUG] 动态界面出现合集时,卡片对应的用户显示错误
- Load options before everything
- 希望增加的功能 HOT 9
- [FR] 增加关闭 up 主卡片的选项
- [FR] 为视频AI总结添加快捷键支持 HOT 5
- [FR] 在options里增加”反馈BUG“选项 HOT 1
- [FR] 增加评论历史记录和弹幕历史记录 HOT 1
- [FR] 增加收藏评论的功能 HOT 1
- [FIX] AI conclusion card could cover `view latter` button HOT 4
- 大大,好人做到底...写一个油管总结吧...油管那个怪怪的 HOT 1
- [bug report]搜索页搜索标签无法显示 HOT 2
- 关注后不会切换关注状态 HOT 1
- BUG: 有些视频无法显示AI总结(插件无法实现,但B站自带的按扭可以) HOT 1
- 增加依据标签实现动态视频过滤的功能 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from biliscope.