<legend id='Dq0ht'><style id='Dq0ht'><dir id='Dq0ht'><q id='Dq0ht'></q></dir></style></legend>
      <i id='Dq0ht'><tr id='Dq0ht'><dt id='Dq0ht'><q id='Dq0ht'><span id='Dq0ht'><b id='Dq0ht'><form id='Dq0ht'><ins id='Dq0ht'></ins><ul id='Dq0ht'></ul><sub id='Dq0ht'></sub></form><legend id='Dq0ht'></legend><bdo id='Dq0ht'><pre id='Dq0ht'><center id='Dq0ht'></center></pre></bdo></b><th id='Dq0ht'></th></span></q></dt></tr></i><div id='Dq0ht'><tfoot id='Dq0ht'></tfoot><dl id='Dq0ht'><fieldset id='Dq0ht'></fieldset></dl></div>

      <small id='Dq0ht'></small><noframes id='Dq0ht'>

        <bdo id='Dq0ht'></bdo><ul id='Dq0ht'></ul>
      <tfoot id='Dq0ht'></tfoot>

    1. 如何调用媒体 RSS 提要

      How To Call Medium RSS Feed(如何调用媒体 RSS 提要)

      <small id='CMVY1'></small><noframes id='CMVY1'>

      <legend id='CMVY1'><style id='CMVY1'><dir id='CMVY1'><q id='CMVY1'></q></dir></style></legend>

        <bdo id='CMVY1'></bdo><ul id='CMVY1'></ul>
      • <i id='CMVY1'><tr id='CMVY1'><dt id='CMVY1'><q id='CMVY1'><span id='CMVY1'><b id='CMVY1'><form id='CMVY1'><ins id='CMVY1'></ins><ul id='CMVY1'></ul><sub id='CMVY1'></sub></form><legend id='CMVY1'></legend><bdo id='CMVY1'><pre id='CMVY1'><center id='CMVY1'></center></pre></bdo></b><th id='CMVY1'></th></span></q></dt></tr></i><div id='CMVY1'><tfoot id='CMVY1'></tfoot><dl id='CMVY1'><fieldset id='CMVY1'></fieldset></dl></div>
          <tfoot id='CMVY1'></tfoot>

                <tbody id='CMVY1'></tbody>

                本文介绍了如何调用媒体 RSS 提要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                Medium 在 https://medium.com/feed/[@username] 上有一个 RSS 提要].我正在尝试使用 XMLHTTPRequest 获取我的所有博客文章.当我在本地测试时,我遇到了 CORs 错误.当我打开 CORs Chrome 扩展程序时,我收到 401 错误.有任何想法吗?有人成功调用 Medium RSS 了吗?

                Medium has an RSS feed available at https://medium.com/feed/[@username]. I'm trying to fetch all my blog posts using an XMLHTTPRequest. When I test on local, I run into CORs errors. When I turn on CORs Chrome extension, I get a 401 error. Any ideas? Has anyone succeeded in calling Medium RSS?

                推荐答案

                要使用 XHR 获取 https://medium.com/feed/[@username] 内容,您可以发出 XHR 请求通过某种代理.例如,尝试为您当前的 XHR 代码提供此 URL:

                To get https://medium.com/feed/[@username] content using XHR, you can make the XHR request through a proxy of some kind. For example, trying giving your current XHR code this URL:

                https://cors-anywhere.herokuapp.com/https://medium.com/feed/@sideshowbarker
                

                这将导致请求转到 https://cors-anywhere.herokuapp.com,这是一个开放/公共 CORS 代理,然后将请求发送到 https://medium.com/feed/@sideshowbarker.

                That’ll cause the request to go to https://cors-anywhere.herokuapp.com, a open/public CORS proxy which then sends the request on to https://medium.com/feed/@sideshowbarker.

                当该代理收到响应时,它会接受它并向其添加 Access-Control-Allow-Origin 响应标头,然后将其作为响应传递回您的请求前端代码.

                And when that proxy gets the response, it takes it and adds the Access-Control-Allow-Origin response header to it and then passes that back to your requesting frontend code as the response.

                带有 Access-Control-Allow-Origin 响应标头的响应是浏览器看到的,因此浏览器现在向您显示的错误消息消失了,浏览器允许您的前端 JavaScript 代码访问响应.

                That response with the Access-Control-Allow-Origin response header is what the browser sees, so the error message the browser is showing you now goes away, and the browser allows your frontend JavaScript code to access the response.

                或使用 https://github.com/Rob--W/中的代码cors-anywhere/ 等来设置您自己的代理.

                Or use the code from https://github.com/Rob--W/cors-anywhere/ or such to set up your own proxy.

                您需要代理的原因是,来自 https://medium.com/feed/[@username] 的响应不包含 Access-Control-Allow-Origin 响应标头,因此您的浏览器将拒绝让您的前端 JavaScript 代码跨域访问这些响应.

                The reason you need a proxy is, responses from https://medium.com/feed/[@username] don’t include the Access-Control-Allow-Origin response header, so your browser will refuse to let your frontend JavaScript code access those responses cross-origin.

                https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS 有更多详细信息.

                这篇关于如何调用媒体 RSS 提要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Pause youtube video, youtube api(暂停 youtube 视频,youtube api)
                Youtube iframe api not triggering onYouTubeIframeAPIReady(Youtube iframe api 未触发 onYouTubeIframeAPIReady)
                How can I stop a video with Javascript in Youtube?(如何在 Youtube 中停止使用 Javascript 的视频?)
                How to call Greasemonkey#39;s GM_ functions from code that must run in the target page scope?(如何从必须在目标页面范围内运行的代码中调用 Greasemonkey 的 GM_ 函数?)
                How do you mute an embedded Youtube player?(如何使嵌入式 Youtube 播放器静音?)
                How to get number of video views with YouTube API?(如何使用 YouTube API 获取视频观看次数?)

                <legend id='66hzk'><style id='66hzk'><dir id='66hzk'><q id='66hzk'></q></dir></style></legend><tfoot id='66hzk'></tfoot>

                <small id='66hzk'></small><noframes id='66hzk'>

                    <bdo id='66hzk'></bdo><ul id='66hzk'></ul>
                        <tbody id='66hzk'></tbody>

                        <i id='66hzk'><tr id='66hzk'><dt id='66hzk'><q id='66hzk'><span id='66hzk'><b id='66hzk'><form id='66hzk'><ins id='66hzk'></ins><ul id='66hzk'></ul><sub id='66hzk'></sub></form><legend id='66hzk'></legend><bdo id='66hzk'><pre id='66hzk'><center id='66hzk'></center></pre></bdo></b><th id='66hzk'></th></span></q></dt></tr></i><div id='66hzk'><tfoot id='66hzk'></tfoot><dl id='66hzk'><fieldset id='66hzk'></fieldset></dl></div>