[英]Retrive javascript properties from html page using C#
我想知道是否有办法使用 c# 从网页中获取 javascript 函数的特定属性,
这是我在网站中找到的功能:
(function($){
window.Ibles.pageContext = $.extend(window.Ibles.pageContext, {
numStepsByWordCount: 1,
allSteps: true,
ibleID: "EPAOKDUH8I455QP",
ibleUrl: "/id/PVC-longbow/",
ibleType: "Step by Step",
ibleCategory: "outside",
ibleChannel: "survival"
});
})(jQuery);
我需要获取 ibleID 属性。
之前谢谢
您可以使用正则表达式轻松提取值:
var match = Regex.Match(content, "ibleID: \"(?<id>\\w+)\"");
if (match.Success)
{
var id = match.Groups["id"].Value;
}
else
{
// id not found
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.