我在页面上有一个javascript,如下所示:
new Shopify.OptionSelectors("product-select", { product: {"id":185310341,"title":"10. Design | Siyah \u0026 beyaz kalpli",
我想要“185310341”。我在谷歌上搜索了几个小时,但是没有找到任何东西,希望你能帮助我。我怎样才能获取javascript和id?在
我试过密码:
^{pr2}$但我得到了:
exceptions.AttributeError: 'Selector' object has no attribute 'search'
Scrapy选择器对正则表达式有built-in support:
演示此特定正则表达式的工作:
^{pr2}$regex方法的另一种方法是使用Javascript解析器,将解析器的输出转换为XML文档,然后使用XPath进行解析。在
这就是在js2xml中实现的,它使用^{} 和{}
(免责声明:我编写了js2xml;警告:不稳定)
在您的示例中,请使用
js2xml.jsonlike.getall()
检查这个示例scrpy shell会话:相关问题 更多 >
编程相关推荐