简体   繁体   English

如何使用Java解析JavaScript的链接?

[英]How to parse javascript for links with java?

I'm writing a program (in Java) that needs to extract links from webpages. 我正在编写一个程序(用Java),该程序需要从网页中提取链接。 I'm using htmlParser ( http://htmlparser.sourceforge.net/ ) but I'm only able to extract html links (defined with <a href="..."> ) and I don't know how to handle javascript code to extract links from... can you help me?? 我使用的是htmlParser( http://htmlparser.sourceforge.net/ ),但是我只能提取html链接(用<a href="...">定义),而且我不知道该如何处理从...提取链接的JavaScript代码...能帮我吗?

You can use Rhino with DOM environment, written in JavaScript . 您可以将Rhino与以JavaScript编写的DOM环境一起使用
By the way it is written by John Resig. 顺便说一下,它是由约翰·雷西格(John Resig)编写的。

This is probally the most comprehensive tool out there. 这可能是那里最全面的工具。 Rhino . 犀牛 Everything you want to do can be done with Rhino. Rhino可以完成您想做的所有事情。

HTML Parser from sourceforge is useful. sourceforge的HTML解析器很有用。 I have used it to parse a whole bunch of HTML already. 我已经使用它来解析一大堆HTML。 However, parsing JS is different. 但是,解析JS是不同的。 Cheers. 干杯。

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

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