Reputation: 2359
I have just wrote my first ImportXML function to fetch the products like this.
I want to fetch all h3
elements. But its showing import internal error
.
=ImportXML("https://www.google.com/products?q=ipod+nano","//h3")
I tried this query also to give all the h3 elements with class r
, but its still showing the same error?
=ImportXML("https://www.google.com/products?q=ipod+nano",
"//h3[@clsass='r')")
Upvotes: 1
Views: 183
Reputation: 22647
As pointed out by @MarcusRickert already, HTTPS pages might be a problem. Use HTTP versions of them:
=IMPORTXML("http://www.google.com/search?tbm=shop&q=ipod+nano&gws_rd=ssl", "//h3")
The result is (clipped):
Apple iPod Nano (6th Generation) - 8 GB - Graphite
Apple iPod Nano (3rd Generation) - 4 GB - Silver
Apple iPod Nano (4th Generation) - 8 GB - Pink
Apple iPod Nano (PRODUCT) RED (7th Generation) - 16 GB - Red
Apple iPod Nano (2nd Generation) - 4 GB - Silver
Apple iPod Nano (5th Generation) - 8 GB - Black
Apple iPod Nano (4th Generation) - 8 GB - Silver
Apple iPod Nano (7th Generation) - 16 GB - Space Gray
Apple iPod Nano (5th Generation) - 16 GB - Black
Apple iPod Nano (2nd Generation) - 4 GB - Green
.....
Do the same with your second query. Again, credit goes to Marcus for spotting two errors in your XPath expression. Try to be more careful with writing those expressions! Especially the clsass
instead of class
should be easy to catch if you look twice at your code.
=IMPORTXML("http://www.google.com/search?tbm=shop&q=ipod+nano&gws_rd=ssl", "//h3[@class='r']")
Result:
Apple iPod Nano (7th Generation) - 16 GB - Slate
Apple iPod Nano (6th Generation) - 8 GB - Graphite
Apple iPod Nano (3rd Generation) - 4 GB - Silver
Apple iPod Nano (4th Generation) - 8 GB - Pink
Apple iPod Nano (PRODUCT) RED (7th Generation) - 16 GB - Red
Apple iPod Nano (2nd Generation) - 4 GB - Silver
Apple iPod Nano (5th Generation) - 8 GB - Black
Apple iPod Nano (4th Generation) - 8 GB - Silver
Apple iPod Nano (7th Generation) - 16 GB - Space Gray
Apple iPod Nano (5th Generation) - 16 GB - Black
Apple iPod Nano (2nd Generation) - 4 GB - Green
Apple iPod Nano (3rd Generation) - 8 GB - Pink
Apple iPod Nano (PRODUCT) RED Special Edition (2nd Generation) - 4 ...
Apple iPod Nano (1st Generation) - 2 GB - White
Apple iPod nano (PRODUCT) RED Special Edition (6th Generation) - 8 ...
Apple iPod Nano (PRODUCT) RED Special Edition (3rd Generation) - 8 ...
Apple iPod Nano (PRODUCT) RED Special Edition (5th Generation) - 8 ...
Engraved Apple iPod Nano 16GB - 8th Gen
Apple 16GB iPod nano (Blue) Brand new
Apple iPod Nano (3rd Generation) - 8 GB - Green
Upvotes: 1