【问题标题】:Parsing Javascript HTML with HTMLAgilityPack使用 HTMLAgilityPack 解析 Javascript HTML
【发布时间】:2022-01-24 16:54:26
【问题描述】:

我需要从 HTML 文档中的脚本中获取 "Title""CustomerID" 的值

  <script type="text/javascript">
    
    //blablabla
    
   if (app) {
   app.value("onlineUser", {"Id":171454371,"Username":"User9007","BourseCode":"ع اط84408","CustomerId":171273228,"IsTrader":false,"IsForTest":false,"Title":"name","CanTradeForAll":false,"PasswordExpired":false,"CcmsCode":7876016,"ClubCustomerLevel":0,"PasswordSecurityWarnningMode":false,"UserSettings":[{"Key":"marketWatchColumnSettings","Value":"[]"},{"Key":"layoutModeClass","Value":""},{"Key":"showIntro","Value":"false"},{"Key":"newVersion","Value":"2.47.3"},{"Key":"helpDownloaded","Value":"true"},{"Key":"changeLayout","Value":"0"},{"Key":"closeRightBar","Value":"1"},{"Key":"openLeftBar","Value":"0"},{"Key":"selectedTheme","Value":""},{"Key":"orderInfoBoxOptionState","Value":"{\"colState\":[{\"colId\":\"0\",\"hide\":false,\"aggFunc\":null,\"width\":65,\"pivotIndex\":null,\"pinned\":\"right\",\"rowGroupIndex\":null},{\"colId\":\"DateTime\",\"hide\":false,\"aggFunc\":null,\"width\":183,\"pivotIndex\":null,\"pinned\":null,\"rowGroupIndex\":null},{\"colId\":\"InstrumentName\",\"hide\":false,\"aggFunc\":null,\"width\":181,\"pivotIndex\":null,\"pinned\":null,\"rowGroupIndex\":null},{\"colId\":\"OrderSideId\",\"hide\":false,\"aggFunc\":null,\"width\":181,\"pivotIndex\":null,\"pinned\":null,\"rowGroupIndex\":null},{\"colId\":\"Quantity\",\"hide\":false,\"aggFunc\":null,\"width\":181,\"pivotIndex\":null,\"pinned\":null,\"rowGroupIndex\":null},{\"colId\":\"TradedQuantity\",\"hide\":false,\"aggFunc\":null,\"width\":181,\"pivotIndex\":null,\"pinned\":null,\"rowGroupIndex\":null},{\"colId\":\"RemainingQuantity\",\"hide\":false,\"aggFunc\":null,\"width\":181,\"pivotIndex\":null,\"pinned\":null,\"rowGroupIndex\":null},{\"colId\":\"Price\",\"hide\":false,\"aggFunc\":null,\"width\":181,\"pivotIndex\":null,\"pinned\":null,\"rowGroupIndex\":null},{\"colId\":\"HeadLinePrice\",\"hide\":false,\"aggFunc\":null,\"width\":181,\"pivotIndex\":null,\"pinned\":null,\"rowGroupIndex\":null},{\"colId\":\"OrderState\",\"hide\":false,\"aggFunc\":null,\"width\":181,\"pivotIndex\":null,\"pinned\":null,\"rowGroupIndex\":null},{\"colId\":\"1\",\"hide\":false,\"aggFunc\":null,\"width\":90,\"pivotIndex\":null,\"pinned\":null,\"rowGroupIndex\":null}],\"sortState\":[{\"colId\":\"Price\",\"sort\":\"asc\"}]}"},{"Key":"sendOrderConfirmation","Value":"0"}],"FeatureAccess":["Hm01","Po01","Po02","Po03","Po04","Po05"],"HasShortSaleOwner":false,"PersonageTypeId":0,"IsForeign":false,"ActiveTypicalMessageIds":[],"CustomerInitialInstrumentIds":[]});
                app.value("liveAsset", []);
            }

            //blablabla
    
        </script>

是否可以借助 html 敏捷包?如果不是我还需要什么其他工具

【问题讨论】:

    标签: javascript c# html html-agility-pack


    【解决方案1】:

    不,HTML Agility Pack 不解析 Javascript。它只支持 HTML 解析。要解析Javascript,您需要另一种方法,例如regexjs grammar 等。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-01-26
      • 2016-11-20
      • 2010-12-03
      • 2017-04-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多