我如何使用cheerio访问脚本标签内的内容

问题描述

使用cheerio从html中的script标签提取数据。

<html>
<head>
<title>Driver Registration Form</title>
<style>
table,td,th {  
  border: 1px solid #ddd;
  text-align: left;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,td {
  padding: 15px;
}
</style>
</head>
<body>
<b>Driver registration completed successfully. Please check Driver Status to verify activation.
    <script type="text/javascript">
    
        function saveAccessCode(accessCode) {
            Android.saveAccessCode(accessCode);
        }
        function saveVehicleType(vehicleType) {
            Android.saveVehicleType(vehicleType);
        }

       saveAccessCode('tt759433'); 
       saveVehicleType('car');

    </script>

这是我的HTML代码,如何从脚本标签提取数据。我需要从saveAccessCode('tt759433');访问数据 saveVehicleType('car'); 这两个代码。任何帮助表示赞赏。谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)