使用带有XPath的Google表格ImportXML导入Amazon产品标题 [英] Use Google Sheets ImportXML with XPath to import Amazon product title

查看:948
本文介绍了使用带有XPath的Google表格ImportXML导入Amazon产品标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从Google表格中的亚马逊产品页面获取产品标题。



我已经搜索并尝试了不同的方法,并提出了此问题。



= ImportXML(



如果您还想删除面包屑的其余部分,例如:Clothing 只需修改它即可使用符号,它在正则表达式中是 | >

  = REGEXREPLACE(ImportXML(http://rads.stackoverflow.com/amzn/click /B01MSR8J29\",\"//About:)Amazon.com:|:Clothing,)


I want to get the Product title from an Amazon product page in Google Sheets.

I have searched and tried different approaches and came up with this

=ImportXML("https://www.amazon.com/dp/B01MSR8J29","//*[@id='productTitle']")

I want to get the title: Army Flag Shirt: Become Brothers Army TShirt

But I get Error, Imported content is empty.

Demo Sheet

解决方案

You can do this with just the //title xpath and a simple regexreplace to remove the standard Amazon.com: portion:

=REGEXREPLACE(ImportXML("http://rads.stackoverflow.com/amzn/click/B01MSR8J29","//title"),"Amazon.com: ","")

If you also want to remove the rest of the breadcrumb e.g. : Clothing just modify it to use the OR symbol which in regex is | like this:

=REGEXREPLACE(ImportXML("http://rads.stackoverflow.com/amzn/click/B01MSR8J29","//title"),"Amazon.com: |: Clothing","")

这篇关于使用带有XPath的Google表格ImportXML导入Amazon产品标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆