使用Java解析javascript生成的内容 [英] Parse javascript generated content using Java
问题描述
http://support.xbox.com/en-us/contact-us 使用javascript创建一些列表.我希望能够解析这些列表的文本.因此,对于以上页面,我想返回以下内容:
http://support.xbox.com/en-us/contact-us uses javascript to create some lists. I want to be able to parse these lists for their text. So for the above page I want to return the following:
Billing and Subscriptions
Xbox 360
Xbox LIVE
Kinect
Apps
Games
我曾尝试使用JSoup一段时间,然后才注意到它是使用javascript生成的.我不知道如何去解析页面的javascript生成的内容.
I was trying to use JSoup for a while before noticing it was generated using javascript. I have no idea how to go about parsing a page for its javascript generated content.
我从哪里开始?
推荐答案
You'll want to use an HTML+JavaScript library like Cobra. It'll parse the DOM elements in the HTML as well as apply any DOM changes caused by JavaScript.
这篇关于使用Java解析javascript生成的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!