是否有用于渲染使用JavaScript的网页的命令行或库工具? [英] Are there command line or library tools for rendering webpages that use JavaScript?

查看:111
本文介绍了是否有用于渲染使用JavaScript的网页的命令行或库工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

页面 - 在互联网上的抓取似乎已经对我有一点墙了,因为越来越多的网站依赖于JavaScript渲染屏幕的部分。



在我看来,有这么多开源布局和JavaScript渲染器发布(如 WebKit , a href =https://developer.mozilla.org/en/Gecko =nofollow noreferrer> Gecko 和 Chromium + V8 )一个用于下载页面并呈现其JavaScript而不必运行实际浏览器的工具。但是,我不会找到我的搜索查找 - 我发现了工具,如 Selenium-rc ,但它们依赖于正在运行的浏览器。我对任何可以执行以下操作的工具或库感兴趣:



  1. 集成支持,可以从命令行(* nix)运行,这些命令行在页面的源代码中返回页面的源代码。


$ b $

b

我认为#1在一般意义上是可取的,但是如果工具存在于我想要工作的语言中,#2会更有用。此外,我不关心特定的JS发动机 - 任何相对现代的将做。什么是?

解决方案

web kit html到pdf工作完美,它甚至可以产生jpg



http://wkhtmltopdf.googlecode.com


Page-scraping on the Internet has seem to have hit somewhat of a wall for me, as there are more and more sites that are dependent on JavaScript for rendering portions of the screen.

It seems to me that with so many open source layout and JavaScript renderers released (like WebKit, Gecko and Chromium + V8) that someone must have made a tool for downloading a page and rendering its JavaScript without having to run an actual browser. However, I'm not turning up what I'm looking for with my searches - I've found tools like Selenium-rc, but they depend on a running browser. I'm interested in any tool or library which can do one (or both) of the following:

  1. A program that can be run from the command line (*nix) which, given the source of a page, returns the page's source as rendered by some JS engine.

  2. Integrated support in a particular language that allows one to (easily) pass the source of a page to it and returns the page's source as rendered by some JS engine.

I think #1 is preferable in a general sense, but #2 would be more useful if the tool exists in the language I want to work in. Also, I'm not concerned with the particular JS engine - any relatively modern one will do. What is out there?

解决方案

web kit html to pdf works perfect, it can even produce jpg

http://wkhtmltopdf.googlecode.com

这篇关于是否有用于渲染使用JavaScript的网页的命令行或库工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆