Gotosocial 通过API获取用户Timeline
Gotosocial 通过API获取用户Timeline时,发现需要提供token才能访问数据,而Mastodon和Pleroma则无需token。为解决此问题,使用Vercel部署Python代码,通过设置环境变量(HOST、USER_ID、TOKEN)来获取数据。相关代码和演示可在GitHub和提供的链接中找到。
在测试Gotosocial 时发现
通过链接${Host}/api/v1/accounts/${userId}/statuses?limit=${limit}&exclude_replies=true&only_public=true
访问不到数据,提示Unauthorized: token not supplied
需要提供token
.
而mastodon
和 pleroma
还是可以正常访问的.
为了更好的解决这个问题(其实之前通过cloudflare workers已经可以解决了)
参见 https://www.imsun.org/archives/1643.html#%E9%80%9A%E8%BF%87Cloudflare-Workers%E8%8E%B7%E5%8F%96json%E6%95%B0%E6%8D%AE
这次使用vercel
拿到数据.
https://github.com/jkjoy/Gotosocial-API-Vercel
主要代码是python
直接部署在vercel
环境变量
HOST=Gotosocial实例地址
USER_ID=Gotosocial用户ID
TOKEN=access_token
关闭

复制链接
https://www.imsun.org/archives/1695.html