问题标签 [scrape]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
5138 浏览

debugging - Facebook 无法抓取我的页面,并且 linter 工具说文档没有返回数据

谁能告诉我为什么 Facebook 不抓取我的页面,而且调试/linter 工具也不能抓取它?我已经搜索和搜索,找不到修复它的方法。据我所知,所有 og:tags 和脚本都已正确实现。

该页面位于http://www.coincident.dk

调试网址是这样的:http: //developers.facebook.com/tools/debug/og/object ?q=http%3A%2F%2Fwww.coincident.dk

0 投票
3 回答
20815 浏览

php - 如何使用 cURL 抓取 iframe 内容

目标:我想使用 cURL 在 iframe 中抓取单词“Paris”。

假设您有一个包含 iframe 的简单页面:

iframe 页面:

我的卷曲脚本:

结果=没有!

谁能帮我找出法国的首都?!;)

我需要以下示例:

  1. 解析/抓取 iframe url
  2. 卷曲网址(就像我对 index.html 页面所做的那样)
  3. 解析字符串“Paris”

谢谢!

0 投票
1 回答
308 浏览

php - PHP 抓取嵌套页面

我是网络爬虫的新手,需要快速学习才能工作。我在抓取客户网页时遇到问题,因为我需要获取的内容唯一地嵌套在主页上的每条记录中(300 多次),子页面上的某些字段不在标签中,而且有点乱。获取以下信息的最佳逻辑是什么。(另外,如果有人知道任何更新的免费且值得研究的抓取工具,那就太棒了。我能够获取父页面上的所有记录。我只是不知道如何通过每条记录进行访问它是子页面信息,并在移动到父页面的下一行之前抓取它。

0 投票
3 回答
665 浏览

iphone - 尝试使用 NSLog() 时出现意外错误

我是 iOS 开发的新手,我正在尝试编写一个可以抓取网站 (HTML) 的应用程序。抓取谷歌只是一个例子 - 我打算抓取一些更复杂的东西......

我的代码如下:

问题是当我尝试写入控制台(通过NSLog)以查看是否有任何工作时出现错误。我得到的错误是“格式字符串未使用数据参数”

我在互联网上搜索了所有内容,但无济于事。如果我注释掉 NSLog 以查看我之前的代码是否正确,我会收到一个关于紧邻声明但未使用的 NSlog (h3Tag) 上方的变量的错误。

任何帮助将不胜感激...

我也对任何其他抓取 HTML 的方法持开放态度......

0 投票
1 回答
739 浏览

php - Xpath 反向搜索

有没有办法,当使用 DOM_Document Xpath 反向搜索(从页面末尾向上移动而不是从上向下移动?)如果是这样,我会怎么做?

我正在浏览一个网站。(下面链接)。 http://www.sturmfh.com/obit-display.jhtml?DB=update/obits/dbase&DO=display&ID=1189477693_24578

我只想刮掉3个讣告段落。所以我认为从最后开始向上移动是最容易的。

0 投票
1 回答
222 浏览

php - php抓取但html没有换行符

在 html 中,它将显示以下内容:

当我使用 php 抓取该内容时,它会在 mysql db 中显示以下内容:

它将显示在一行中并且没有任何字符串 /n 或 /r 并且希望它在 mysql db 中显示正确的间距/换行符。很高兴知道如何验证换行符的每一步,并从 html 到 string,然后从 string 到 mysql。

0 投票
1 回答
524 浏览

php - php mysql连接并创建没有错误但没有数据的表

我能够连接到 mysql db 并创建一个表,但没有数据,想知道我遗漏了什么或做错了什么?我在下面发布了我的功能代码。我的回声计数得到确认,我还检查了我的 Poems.csv 以确保它们不是空白的。

0 投票
3 回答
241 浏览

php - php抓取写入mysql数据库错误

第一个功能是这个

最后一个功能是

我收到一个像这样的错误示例

'Salve magna parens frugum Saturnia tellus,Magna virm!tibi res antiqu laudis et artis Aggredior, sanctos ausus recludere fontes。处女。乔治。2. 1 当你,我的主,乡下人羡慕, 2 从不列颠尼亚的公共职位退休, 3 不再取悦她忘恩负义的儿子, 4 为了他们的利益牺牲你的安逸;5 我进入我的命运所传达的异域, 6 穿过多产不朽的国家, 7 柔软的海洋

Britannia 中的 ' 没有逃脱

我不确定它是否需要是 '' 或 \'

但我想知道如何解决这个错误并能够完成在sql db中写入所有内容

0 投票
1 回答
2383 浏览

facebook - How to scrape Facebook advertising data?

Facebook provides data about demographics via their advertising platform. How to scrape it (using Python)?

1.) go to http://www.facebook.com/ads/create/

2.) fill in the forms

3.) now, there is data

See sample image: http:// www.webdistortion.com/wp-content/uploads/2010/10/fb4.jpg (i am a new user, so I can't post a image)

Problem: how to scrape it?

My ideas:

1.) use mechanize - maybe it is possible to fill in the forms, but the estimated number (112,960 in the example) is not visible in the source code and therefore you cannot parse it => we should do some other tricks, but what?

2.) use selenium (or windmill) - my recording was: open facebook.com --> click advertising --> click create ad --> ...

Unfortunately, this already failed. Log:

[info] Executing: |clickAndWait | link=Advertising | | [error] isNewPageLoaded found an old pageLoadError: Error: Permission denied for >> to get property Location.href [error] Permission denied for to get property Location.href [info] Executing: |clickAndWait | css=span.uiButtonText | | [error] Unexpected Exception: fileName -> chrome://selenium-ide/content/selenium-core/scripts/selenium-browserbot.js, lineNumber -> 840

There is evidence that it is possible to scrape this data: http://www.checkfacebook.com/

Solving the problem is more interesting than the data itself (ofc, this data is certainly interesting). I know that there are solutions, but I cannot come up with any. It is killing me, please help.

0 投票
1 回答
244 浏览

php - PHP 从字符串中抓取图像 - 如何?

我是一个 PHP 菜鸟......无论如何 - 我如何从这个字符串中获取所有图像链接?(成一个数组)

我已经尝试过使用 preg_match_all() 但我无法让它工作....我只想要像 /images/nature/flowers/0112880pic092655.jpg 这样的字符串

顺便说一句,我已经从脚本标签中抓取了上述数据......

提前致谢