How to parse a rendered web page containing javascript

强颜欢笑 提交于 2019-12-13 06:33:06

问题


How can one extract data from a rendered web page? In which java script would update the data with time. Is it possible to write user script which can access varibles from webpage java script? Please suggest possible way to achieve this.


回答1:


according to Turing's Halting Problem Theorem, you can't.

That's what we mean when we say that JavaScript is a Turing complete language. The only way is to execute the JavaScript and let it render the page.




回答2:


it depends on your programming language.

In C# you could use a webbrowser control, then use the Webbrowser.Document property to get a HTMLDocument object to get the current markup. To invoke javascript function in the document, use the ObjectForScripting property of the Browser control.



来源:https://stackoverflow.com/questions/1765573/how-to-parse-a-rendered-web-page-containing-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!