开发者

Getting javascript variable value with HTML Agility pack

Is it possible to get a javascript variable value with html agility pack?

<script type="text/javascript"> 
var title = "Site title";
var articlesummary = "article summary.";
</script>

Is there any way that html agilit开发者_Python百科y pack would allow me to get the value of the variable title for example?


You can't get the value of a javascript variable in HTML Agility Pack. You have to use regex.


Actually you can do it. HtmlAgilityPack gives you the inner html and you pick your texts&variables by your own way.

For example:

htmlDocument.SelectNodes("//script[@language='javascript']");

This code will give you the inner text of script tag. After that, you may split the whole text ending with ";".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜