Javascript 使用jsdom的多行属性
是否可以使用jsdom获取多行属性的值(我使用Node.js+JQuery) 要刮取的站点包括以下HTML:Javascript 使用jsdom的多行属性,javascript,node.js,web-scraping,screen-scraping,jsdom,Javascript,Node.js,Web Scraping,Screen Scraping,Jsdom,是否可以使用jsdom获取多行属性的值(我使用Node.js+JQuery) 要刮取的站点包括以下HTML: <li><a data-title="<strong>hello world this is a test</strong>" href="example.org</strong>">A link</a></li> 不幸的是,这会被解析为 <li><a data-title="da
<li><a data-title="<strong>hello world
this is a test</strong>" href="example.org</strong>">A link</a></li>
不幸的是,这会被解析为
<li><a data-title="data-title"><strong>hello world
this is a test</strong>' href="example.org">A link</a></li>
因此我无法提取title和href属性,例如通过JQuery:$(“a”).attr(“数据标题”)
有什么想法吗?是的,这是
jsdom
解析器中的一个bug。这是因为它没有使用完全兼容HTML5的解析器。您可以看到这些错误仍然没有解决:
您可以尝试使用刮削功能。Cheerio似乎也被多行属性阻塞了:-/。我想我要换成机械化。