对于我的抓取工具项目,我需要从JavaScript对象获取产品详细信息。
如何从以下JavaScript有效获取对象详细信息?我使用XPath和HTMLAgilityPack。
<script type="text/javascript">
var product = {
identifier: '2051189775', //PRODUCT ID
fn: 'Fit- Whiskered Dark Wash Skirt',
category: ['sale'],
brand: 'Brand Name',
price: '22.90', // this would be the discount price
amount: '31.80', // this would be the original price
currency: 'USD',
//List can me even more.
};
</script>
我之前没有尝试过从JavaScript对象获取详细信息。我直接从HTML获取其他抓取工具的详细信息。