问题描述
我正在尝试使用Xpath通过Google表格从网页中提取元描述.
I'm trying to use Xpath to pull in the meta descriptions from web pages, using Google Sheets.
我正在努力提取标题:=importXml(www.example.com; "//title")
I have this working to pull in the titles: =importXml(www.example.com; "//title")
这是我学习的两个来源:
Here are two sources of my learning:
http://seogadget.co.uk/playing -around-with-importxml-in-google-spreadsheets/
http://docs.google.com/support/bin /answer.py?hl=zh-CN&answer=75507
我已经在该网站上阅读了许多其他帖子,这似乎与我想要的内容类似:
I have read many other posts on this site, and this seems to be the similar idea of what I want:
"/html/head/meta[@name='description']/@content"
"/*/head/meta[@name='description']/@content"
"//head/meta[@name=\"description\"]/@content"
在Google表格中,这些都不指定要用Xpath编写.唯一的区别是,在Google表格中您将使用'代替(因此,说明为何如此).老实说,我已经尝试了219种不同的方式....祝您好运.
None of these work in Google Sheets, which specifies to write it in Xpath. The only difference, is that in Google Sheets you are to use ' in place of " (hence why description is like that). I've honestly tried it about 219 different ways....no luck.
有什么想法吗?提前致谢!
Any ideas? Thanks in advance!
推荐答案
//meta[@name='description']/@content
因此,您在Google工作表中的完整URL调用将是
So your full URL call in google sheet would be
=importxml(A1,"//meta[@name='description']/@content")
我已经使用importXML构建了一些很棒的SEO工具-这仅仅是它的开始! :)
I've built some awesome SEO tools using importXML - this is just the start of it mate! :)
这篇关于= importXML()中的xpath用于提取元描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!