无法使用 Google 个工作表解析 ImportXML 获取内容

ImportXML get content cannot be parsed with Google Sheets

我似乎无法获取 Twitter 简介并获取 "content cannot be parsed"。我可以获得与 Twitter 帐户关联的点赞。

我使用的线路有什么问题?

=importXML("http://twitter.com/"&substitute(A4,"@","",2),"//p[@class=’ProfileHeaderCard-bio u-dir’]")

A4=jaredhuet 在 google 张中。

它不适用于 twitter 的实际原因是因为它在源代码中的格式不正确,它是 malformed xml 所以它不能仅使用 importxml 进行解析,但是下面的公式可以得到同样的结果,并且它处理得更快更容易,因为要加载和筛选的数据更少。

将 twitter.com 部分替换为:

"https://twitter.com/intent/user?screen_name="&A41

完整的公式是:

=IMPORTXML("https://twitter.com/intent/user?screen_name="&A4,"//*[@class='note']")

请注意 @ 符号不会影响页面是否加载,但这里是抓取该部分的工作公式: