web-scraping 相关问题

Web抓取是从不易提供API或其他自动数据检索方法的网站中提取特定信息的过程。关于“如何开始使用刮擦”(例如使用Excel VBA)的问题应该*进行彻底的研究*,因为有许多功能代码示例可供使用。 Web抓取方法包括第三方应用程序,定制软件的开发,甚至是标准化方式的手动数据收集。

如何在scrapy中修复Crawled(403)禁止?

def start_requests(自我): 网址 = [ 'https://www.irrawaddy.com/category/business/feed' ] 对于 url 中的 url: 产量 scrapy.Request(url, headers=self.headers,callback=self.pa...

回答 1 投票 0

尝试使用requests_html在python中抓取动态网站

当我尝试抓取此网站时,我遇到了问题,但我不知道出了什么问题。我尝试使用 Htmlsession 但 python 告诉我使用 AsyncHTMLSession 因为前者无法执行 l...

回答 1 投票 0

在网络抓取中故意轮换和保留IP地址

我不是抓取专家。我有一个有趣的小型 Python 项目,使用 Tor、Privoxy 和自定义 Python 类从一个戒备森严的网站上抓取数据,至少看起来是这样。虽然有一些洞穴...

回答 1 投票 0

Selenium 未通过类名、CSS 选择器、XPATH 查找特定元素

我上个月问了这个问题,但尚未找到解决方案,所以我决定切换到 Selenium 看看是否有帮助。 我正在尝试抓取这个网站,但我只能抓取...

回答 1 投票 0

Python 硒。抓取网页

我想从网址“https://www.morningstar.co.uk/uk/funds/snapshot/snapshot.aspx?id=F00000NF9P&tab=3”的“Stock Style - Weight”内的框中获取数据' 使用硒 该数据位于...

回答 3 投票 0

为什么 espn.com 不允许某些年份被抓取?

我正在使用 scrapy 从 ESPN 抓取数据,并注意到在 2009 年及之前,我被阻止了,因为他们的 robots.txt 文件中包含 Disallow: */season/200 。 为什么E...

回答 1 投票 0

html_element 返回 NA,我可以理解为什么

我正在使用 R 进行网络抓取,并尝试为 IMDB 的前 250 部电影提取数据帧。到目前为止我的代码很短: 图书馆(tidyverse) 图书馆(rvest) 页面 = read_html('https://www.i...

回答 1 投票 0

如何使用 Python 和 Beautiful Soup 从 BBC 文章中抓取标题?

我之前构建过一个 BBC 抓取工具,除其他外,它还可以从给定的文章(例如本文)中抓取标题。然而,BBC 最近更改了他们的网站,所以我需要修改我的抓取工具,

回答 1 投票 0

如何从 Fast.com 获取网速结果

我想定期检查我的互联网速度,如果它下降到某个阈值,则重置我的路由器,这似乎可以修复我的 ISP“提供”的糟糕连接。 尽管可能有更简单的方法...

回答 4 投票 0

Cheerio 获取类的多个匹配项中的第一个元素

我有这个 HTML: ... 我有这个 HTML: <div class="flex__col--md-2 flex__col--xs-4 color-box color-box--orange color-box--no-pad text-center"> <p class="u-text-white"> <strong> 208,00 Euro </strong> </p> </div> 第二部分如下所示: <div class="flex__col--md-2 flex__col--xs-4 color-box color-box--orange color-box--no-pad text-center"> <p class="u-text-white"> <strong>1.978,00 Euro</strong> </p> </div> 类“flex__col--md-2 flex__col--xs-4 col...”和类“u-text-white”可以在html中找到两次。我想从第一个条目“208,00 Euro”中选择值。 var parsedHTML = $.load(body); console.log("the value"); 有人可以帮我使用cheerio 将 208 欧元存入控制台日志吗? 您应该能够像这样访问数据。 var firstEl = parsedHTML .find('.flex__col--md-2.flex__col--xs-4') .first() .find('.u-text-white'); var data = firstEl.find('strong').text(); 改进现有答案,您可以使用自然的 CSS 链接,而无需多次 .find() 调用: const cheerio = require("cheerio"); // ^1.0.0-rc.12 const html = `<div class="flex__col--md-2 flex__col--xs-4 color-box color-box--orange color-box--no-pad text-center"> <p class="u-text-white"> <strong>208,00 Euro</strong> </p> </div> <div class="flex__col--md-2 flex__col--xs-4 color-box color-box--orange color-box--no-pad text-center"> <p class="u-text-white"> <strong>1.978,00 Euro</strong> </p> </div>`; const $ = cheerio.load(html); const text = $(".flex__col--md-2.flex__col--xs-4 p.u-text-white") .first() .text() .trim(); console.log(text); // => 208,00 Euro 这里答案的关键部分是.first()。 .last() 和 .nth(0) 是 .first() 上有用的变体函数。 其他选项包括: const text = $(".flex__col--md-2.flex__col--xs-4 p.u-text-white:nth(0)") .text() .trim(); 和 const text = $(".flex__col--md-2.flex__col--xs-4 p.u-text-white:first") .text() .trim();

回答 2 投票 0

从 dom 获取课程 -->cheerio

我有这个 HTML: ... 我有这个 HTML: <div class="flex__col--md-2 flex__col--xs-4 color-box color-box--orange color-box--no-pad text-center"> <p class="u-text-white"> <strong> 208,00 Euro </strong> </p> </div> 第二部分如下所示: <div class="flex__col--md-2 flex__col--xs-4 color-box color-box--orange color-box--no-pad text-center"> <p class="u-text-white"> <strong>1.978,00 Euro</strong> </p> </div> 类“flex__col--md-2 flex__col--xs-4 col...”和类“u-text-white”可以在html中找到两次。我想从第一个条目“208,00 Euro”中选择值。 var parsedHTML = $.load(body); console.log("the value"); 有人可以帮我使用cheerio 将 208 欧元存入控制台日志吗? 您应该能够像这样访问数据。 var firstEl = parsedHTML .find('.flex__col--md-2.flex__col--xs-4') .first() .find('.u-text-white'); var data = firstEl.find('strong').text(); 改进现有答案,您可以使用自然 CSS 链接,而无需多次 .find() 调用: const cheerio = require("cheerio"); // ^1.0.0-rc.12 const html = `<div class="flex__col--md-2 flex__col--xs-4 color-box color-box--orange color-box--no-pad text-center"> <p class="u-text-white"> <strong>208,00 Euro</strong> </p> </div> <div class="flex__col--md-2 flex__col--xs-4 color-box color-box--orange color-box--no-pad text-center"> <p class="u-text-white"> <strong>1.978,00 Euro</strong> </p> </div>`; const $ = cheerio.load(html); const text = $(".flex__col--md-2.flex__col--xs-4 p.u-text-white") .first() .text() .trim(); console.log(text); // => 208,00 Euro 这里答案的关键部分是.first()。

回答 2 投票 0

使用 Fetch 和 Cheerio 清空结果抓取站点

出于兴趣,我决定为自己从该网站收集数据(名称、每晚价格、评级),但遇到了误解。我没有得到任何输出。我在其他 Libra 上重写了...

回答 2 投票 0

如何使用 Python 从 javascript 网站抓取数据?

我有几个月的 Python 编程经验,并且想承担一个更大的学术项目,收集和分析足球运动员的伤病历史。 d...

回答 1 投票 0

如何网络抓取特定年份的谷歌新闻标题(例如2020年的新闻)

我一直在使用 Python 和 RSS feed 探索网络抓取技术,但我不确定如何将搜索结果缩小到 Google 新闻上的特定年份。理想情况下,我想取回头......

回答 1 投票 0

提取雅虎财经社区论坛的所有评论

我正在使用 Python Selenium 从雅虎财经对话页面抓取特定股票(如 TSLA)的评论和回复。提取所有评论及其回复是

回答 1 投票 0

如何使用BeautifulSoup从多个页面提取数据

我正在尝试从网站上抓取数据,但有点陷入多页面问题。不知何故,我的迭代总是导致“所有数组必须具有相同的长度”有人可以帮助我吗...

回答 1 投票 0

使用 Selenium 缓慢抓取

我正在尝试使用selenium抓取网站。但是它非常慢。每条记录需要一分钟。 网页为 https://jamabandi.nic.in/land%20records/NakalRecord。我正在努力抓取每一条记录...

回答 1 投票 0

从动态加载的页面中抓取网页内容(无限滚动)

我正在尝试从该网站收集所有图像文件名:https://www.shipspotting.com/ 我已经收集了所有类别名称及其 ID 号的 python 字典 cat_dict。所以我的力量...

回答 3 投票 0

为什么我的 chrome.storage.session 对象从未更新过?

我需要一些帮助来改进我的 scraper chrome 扩展。 我尝试总结一下该扩展的作用: 单击 popup.html 中的按钮会打开 10 个选项卡: 弹出窗口.js scrapeRiassunto.addEventListener(&q...

回答 1 投票 0

初学者问题网页抓取(需要帮助)

我只是想问你是否可以告诉我这个网站是否可以废弃。 我尝试了很多方法但没有结果。 所以我只是想知道。 https://www.enterprise.com/en/car-rental.html?icid=header.

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.