webmagic icon indicating copy to clipboard operation
webmagic copied to clipboard

A scalable web crawler framework for Java.

Results 147 webmagic issues
Sort by recently updated
recently updated
newest added

在采集一个页面的时候,里面又一些数据是加密的,需要调用页面中的一个js方法,方法很复杂,嵌套,目前我使用的是用chromedriver来运行这个方法,但是采集慢了很多,请问有什么方法,直接用默认的downloader,然后获取page对象后,可以运行页面中的js方法

![image](https://user-images.githubusercontent.com/8244382/41191433-0d11169e-6c22-11e8-9543-32a9473e94f9.png) 比如单线程,执行步骤一的时候下边的线程还在解析,没有把新url放到队列中,去取的request是null,执行第二步的时候,下边的线程执行完成,判断生效直接break了。

使用FileCacheQueueScheduler时,可能会出现游标的值比URL的数量要大的情况,查看了一下源代码,发现问题在这里, `@Override public synchronized Request poll(Task task) { if (!inited.get()) { init(task); } fileCursorWriter.println(cursor.incrementAndGet()); return queue.poll(); }` 在public synchronized Request poll(Task task)方法中,每次queue.poll()前都要将游标自增1,但是queue.poll()得到可能是null,这就导致了游标比文件中URL数量要大的情况,这在多线程的时候很明显。 我觉得应该加一个非空判断更准确: `public synchronized Request poll(Task task) { if(!this.inited.get())...

MyProcessor tool = new MyProcessor(); Spider.create(tool).addUrl("http://10.27.129.105:8000/").addPipeline(collectorPipeline) .run(); System.out.println("Run takes1: "+new Date()); 在MyProcessor的方法process(Page page)最后打印系统时间:System.out.println("Run takes11: "+new Date()); 运行结果: Run takes11: Tue Jul 10 18:52:48 CST 2018 Run takes1: Tue Jul 10...

`Spider.create(new TestProcessor()) .addUrl("http://xxx.xxx") .thread(5) .run();` 我想在页面爬完之后,做下一步的操作,怎么样才能知道已经爬完了呢?

这个项目不更新了吗

# Problem Say there are multiple spiders distributed in different instances, and they are downloading web pages belonging to the same domain `www.example.com`. In the meanwhile, I expect each of...

使用ChromeDriver模拟浏览器抓取页面时,如果指定了多线程同时抓取多个url时(例如设置thread=5),不会关闭Chrome浏览器(只关闭最后一次打开的浏览器进程)。 ``` Spider.create(goodsProcess) .addUrl(urls) .addPipeline(goodsPipeline) .setDownloader(downloader) .thread(5) .run(); ``` 这是因为创建webDriverPool时线程不安全导致。需要双重验证,修改如下: 涉及方法:`SeleniumDownloader#checkInit()` ``` private void checkInit() { if (webDriverPool == null) { synchronized (this) { if (webDriverPool == null) { webDriverPool...

**RedisScheduler BUG** 在RedisScheduler的pushWhenNoDuplicate()方法中,有可能在lpush之后hset之前其他线程调用poll来hget,会出现空指针异常。建议把lpush和hset调换一下顺序。 @sutra