<bdo id='7M2r1'></bdo><ul id='7M2r1'></ul>
    <tfoot id='7M2r1'></tfoot>

      <small id='7M2r1'></small><noframes id='7M2r1'>

      <i id='7M2r1'><tr id='7M2r1'><dt id='7M2r1'><q id='7M2r1'><span id='7M2r1'><b id='7M2r1'><form id='7M2r1'><ins id='7M2r1'></ins><ul id='7M2r1'></ul><sub id='7M2r1'></sub></form><legend id='7M2r1'></legend><bdo id='7M2r1'><pre id='7M2r1'><center id='7M2r1'></center></pre></bdo></b><th id='7M2r1'></th></span></q></dt></tr></i><div id='7M2r1'><tfoot id='7M2r1'></tfoot><dl id='7M2r1'><fieldset id='7M2r1'></fieldset></dl></div>
      <legend id='7M2r1'><style id='7M2r1'><dir id='7M2r1'><q id='7M2r1'></q></dir></style></legend>
    1. Google Chrome 扩展中的网页抓取(JavaScript + Chrome AP

      时间:2023-10-14
      <tfoot id='qAGUi'></tfoot>

              <tbody id='qAGUi'></tbody>

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

              <bdo id='qAGUi'></bdo><ul id='qAGUi'></ul>
            • <small id='qAGUi'></small><noframes id='qAGUi'>

                本文介绍了Google Chrome 扩展中的网页抓取(JavaScript + Chrome API)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                使用 JavaScript 和任何其他可用技术执行 从 Google Chrome 扩展程序中对当前未打开的标签页进行网页抓取 的最佳选项是什么?也接受其他 JavaScript 库.

                What are the best options for performing Web Scraping of a not currently open tab from within a Google Chrome Extension with JavaScript and whatever more technologies are available. Other JavaScript-libraries are also accepted.

                重要的是掩盖抓取行为,使其表现得像正常的网络请求.没有 AJAX 或 XMLHttpRequest 的迹象,例如 X-Requested-With: XMLHttpRequestOrigin.

                The important thing is to mask the scraping to behave like a normal web-request. No indications of AJAX or XMLHttpRequest, like X-Requested-With: XMLHttpRequest or Origin.

                必须可以从 JavaScript 访问抓取的内容,以便在扩展程序中进行进一步操作和呈现,最有可能作为字符串.

                The scraped content must be accessible from JavaScript for further manipulation and presentation within the extension, most probably as a string.

                在任何 WebKit/Chrome 特定的 API 中是否有任何钩子可用于发出正常的网络请求并获取操作结果?

                Are there any hooks in any WebKit/Chrome-specific API:s that can be used to make a normal web-request and get the results for manipulation?

                var pageContent = getPageContent(url); // TODO: Implement
                var items = $(pageContent).find('.item');
                // Display items with further selections
                

                使用磁盘上的本地文件进行这项工作的奖励积分,用于初始调试.但如果这是唯一的一点就是停止解决方案,那么请忽略奖励积分.

                Bonus-points to make this work from a local file on disk, for initial debugging. But if that is the only point is stopping a solution, then disregard the bonus-points.

                推荐答案

                尝试使用 XHR2 responseType = "document" 并使用 (new DOMParser).parseFromString(responseText, getResponseHeader("Content-Type"))a href="https://gist.github.com/1129031" rel="noreferrer">我的 text/html 补丁.有关我如何检测 responseType 的示例,请参阅 https://gist.github.com/1138724= "document 支持(在从 text/html blob 创建的对象 URL 上同步检查 response === null).

                Attempt to use XHR2 responseType = "document" and fall back on (new DOMParser).parseFromString(responseText, getResponseHeader("Content-Type")) with my text/html patch. See https://gist.github.com/1138724 for an example of how I detect responseType = "document support (synchronously checking response === null on an object URL created from a text/html blob).

                使用 Chrome WebRequest API 隐藏 X-Requested-With 等标题.

                Use the Chrome WebRequest API to hide X-Requested-With, etc. headers.

                这篇关于Google Chrome 扩展中的网页抓取(JavaScript + Chrome API)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何使用 JSONP 克服 XSS 问题? 下一篇:http请求正文是什么意思?

                相关文章

                最新文章

              • <small id='ed80E'></small><noframes id='ed80E'>

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

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