javascript - 如何从 github API 返回 atom/xml 提要
问题描述
我正在从 github API 获取 atom/xml 格式的公共提要。然而,我似乎只能得到 url 而没有任何数据。
我尝试在 fetch 标头中请求不同的内容,但它总是以 json 的形式返回。端点只显示 URL,我不确定如何从该 URL 中提取该数据以将其显示在我的应用程序中。
fetch("https://api.github.com/feeds", {
mode: 'cors',
headers: {
'Content-Type': 'application/atom+xml'
}})
.then((res) => {
console.log(res);
return res.json();
})
.then((data) => {
console.log(data._links.timeline.href);
console.log(data);
// this.setState( {feed: text});
return data;
})
解决方案
推荐阅读
- c# - 无法在面向 .Net Standard 2.0 的项目中加载 Revit API
- pyinstaller - 未使用 pyinstaller 加载的软件包
- java - 基于 LinkedHashMap 的字符串可能排列?
- c++ - 矩阵类内存分配和重载
- python - 测试两个pathlib.Paths的casefolded相等性的最简单方法?
- java - 如何在底部导航栏中删除标题标题 - Android Studio
- python - 创建一个接受两个整数参数的python函数,查找它们之间的所有素数并在列表中返回这些素数
- assembly - 减小 NASM 汇编可执行文件大小
- google-sheets - 将 gatsby-source-google-spreadsheet 插件与 GatsBy 一起使用时,数字在 GraphQL 中被转换为字符串
- json - 回调 URL 未接收 JSON 数据