简体   繁体   English

在JavaScript中存储web-scraping的输出

[英]Storing the output of web-scraping in JavaScript

I've got a small web-scraping utility in Perl that I am thinking of reimplementing in JavaScript to share with a couple of other people. 我在Perl中有一个小的web-scraping实用程序,我正在考虑重新实现JavaScript以与其他几个人共享。 Ideally I would like to send them a page with the complete JavaScript program embedded to run standalone on their own machines. 理想情况下,我想向他们发送一个嵌入了完整JavaScript程序的页面,以便在他们自己的机器上独立运行。 I need to be able to store results from run to run. 我需要能够存储运行结果。 I had expected to be able to find an interface to an RDBMS such as SQLite. 我本来希望能够找到一个RDBMS的接口,比如SQLite。 I am surprised that there doesn't seem to be anything like this for Firefox. 我很惊讶Firefox似乎没有这样的东西。 What am I looking for as far as a relational database storage solution from JavaScript? 就JavaScript的关系数据库存储解决方案而言,我在寻找什么?

You should consider sticking a RESTful API in front of a database server. 您应该考虑在数据库服务器前面放置RESTful API。 Chose your stack. 选择你的筹码。 If you are not married to a RDBMS consider CouchDB, which has a wonderful RESTful API out of the box. 如果您没有与RDBMS结婚,请考虑使用CouchDB,它具有开箱即用的精彩RESTful API。

A slightly more "inside-the-scope-of-your-question" answer is to use a DB API like Google's Gears API: Link to Gears 稍微多一点“问题范围内”的答案是使用像Google的Gears API这样的数据库API: 链接到Gears

This provides a local browser storage solution. 这提供了本地浏览器存储解决方案。

This is a slightly "outside-the-scope-of-your-question" answer, but it may be better to look at a free scraping utility that already handles XSS and RDBMS storage. 这是一个稍微“超出范围的问题”的答案,但是看一下已经处理XSS和RDBMS存储的免费抓取工具可能会更好。 Check out WSO2's mashup server. 查看WSO2的mashup服务器。

Link to Mashup Server Project Page 链接到Mashup Server Project页面

It uses X-family (XPath, XSLT, XML) acquisition and formatting and Javascript for any business logic. 它使用X-family(XPath,XSLT,XML)获取和格式化以及任何业务逻辑的Javascript。 You can save the results to a DB or expose them as a web-service. 您可以将结果保存到数据库或将其作为Web服务公开。 Pretty flexible Java-based solution. 非常灵活的基于Java的解决方案。 Just need a JVM to run. 只需要一个JVM就可以运行。

Best of luck! 祝你好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM