Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

meta property content info

0

Hi,   I can't get meta property content info. i need the value: 126990 but i can't get it. It is in the head tag. <meta property="product:price:amount" content="126990">   I would like to get price infos of lego sets from lego.com it is easy to find price, set number, name infos in the meta section, but i can't get it with the sample code from "Import Web Data to Excel using VBA Macros".

https://www.teachexcel.com/excel-tutorial/2189/vba-macro-to-import-web-data-into-excel

Thank you!

Answer
Discuss

Discussion

Hi and welcome to the Forum. 

Please provide the URL for the website you're trying to get the price from. Then Don (or someone else) might provide an answer. 
John_Ru (rep: 6142) Jan 11, '23 at 11:19 am
In the youtube tutorial <body> part is used.  But meta is in the <head> section. And i couldn't found the solution for this.

Any lego set can be used, but this is what i tried:  
https://www.lego.com/hu-hu/product/lego-ideas-home-alone-21330  

I can find the price in the body section, but that is not work as well. 
When i didn't get error i only got an empty box.  

Is it possible to get the price info for this set?
halowarsss Jan 14, '23 at 3:16 pm
Add to Discussion

Answers

0

Halowarsss

I suspect (but don't know for sure) that the method in that tutorial will not work on the Lego site.

When I tested the URL you provided, I noticed that the varable "response" wasn't much, just:

"<!DOCTYPE html><html><head><title>LEGO.com - Unsupported Browser</title><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="lego" content="LegoUnsupportedBrowser"/><meta name="msapplication-TileColor" "

This is NOT what happens with other sites where the method works. 

Given response is what gets converted to HTML (as the document html ) and used in the line:

' Get the price from the specified element on the page.
price = html.getElementsByClassName("Text__BaseText-sc-13i1y3k-0 zkrlj ProductPricestyles__StyledText-sc-vmt0i4-0 tMWye") '.Item(0).innerText

nothing will be found since html only contains the text in response (and so contains no classes or IDs seen on the webpage).

It may be that Lego is blocking such requests since if I try a web query in Excel (ribbon Data/ from Web in Excel 365) with that URL, the Document/ Web View says my "browser is out of data".

Sorry I can't help more. Hope others can.

Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login