Price Scrape from an ecommerce website google sheets importxml - xpath

Hi I need to scrape the price from given link but Im getting errors with
xpath=IMPORTXML("https://www.tokopedia.com/jktmusicavenue/kawai-cn39-digital-piano-cn-39-cn-39-elektrik-yamaha-hitam","//*[#id="zeus-root"]/div/div[2]/div[1]/div/div[2]/div[4]/dd/h3")

Try to use this XPath:
"//h3[#data-testid='lblPDPDetailProductPrice']"
P.S. Also note that you're using double quotes pair without escaping inside XPath that already surrounded by double-quotes pair

Related

How to scrape price from mercari in google sheet using importxml?

I would like to get the "3,776" price in this website.
https://jp.mercari.com/item/m68422230699
I copy the full xpath, but it returs #N/A
=IMPORTXML("https://jp.mercari.com/item/m68422230699","/html/body/div[1]/div[1]/div/div/div/main/article/div[2]/section[1]/section[1]/div/mer-price//span[2]")
#N/A, in this case, is a result of trying to scrape JavaScript content/elements which Google Sheets does not support. you can test this simply by disabling JS for a given site and what's left can be scraped. in your case it's nothing:

How to find the correct Xpath to get importxml function work

I'm trying to use ImportXML function in Google sheets in order to bring some prices into my Google sheet, how to find the correct Xpath for this?
This is the URL:
https://www.superama.com.mx/catalogo/d-frutas-verduras/f-frutas/l-naranja-limon-y-citricos/mandarina-por-kilo/0000000003029
and I'm trying to bring the id="lblPrice" which in this case is $24.90
I was trying this formula but I'm getting NA
=IMPORTXML("https://www.superama.com.mx/catalogo/d-frutas-verduras/f-frutas/l-naranja-limon-y-citricos/mandarina-por-kilo/0000000003029","//*[#id="lblPrice"]")
IMOPORTXML/Google Sheets does not support scraping of JavaScript elements.

Using ImportXML to pull URL and anchor

My goal is to scrape a link containing either a word "apple" or a word "pear", and for each scraped link I need to scrape the anchor.
At present I am using the following:
=IMPORTXML(A1,"//a/#href[contains(., 'apple')]")
Unfortunately, I can only scrape the links containing apple. Still need to add another condition - "pear" and scrape the anchor.
Thank you for your help.
Try this:
=IMPORTXML(A1,"//a/#href[contains(., 'apple') or contains(., 'pear')]")

Designing a macro, regex expression or approach for importing first search result from Google

I have one cell in a Google spreadsheet, which contains "apple". In the column next to it, I am trying to take the cell with the text "apple", run that through Google search, and return the URL of the first search result that comes up.
What is the solution to this problem?
Unfortunately, there is no solution to this issue. Google does not allow scraping Google Search via Google Sheets. Any such attempt will result in #N/A error.

xpath for a google search url issue no content

http://www.google.com/search?q=youtube
Trying to get the url part www.youtube.com/ of the search
using this xpath but there is no output from it.
.//*[#id='rso']/li[1]/div/div[2]/div[1]/cite
i've also tried using the css path same issue
CSS: div[aria-label='Result details']+div>div cite.
Btw, your xpath works fine for me. If you use selenium to retrieve your text for example, you should write xpath=.// in this case, because it recognize selector as xpath by preceding // symbols. Also //*[#id='rso']/li[1]/div/div[2]/div[1]/cite//text() will return three textNodes www., youtube and .com/

Resources