Scraping hidden elements from HTML

How can I perform the hidden data scraping in HTML. The data is there on the HTML head, but those are hidden meta tags with and the value I want to extract can be found on content property.

  <meta xmlns:og="" property="og:upc" content="2633" />
  <meta xmlns:og="" property="product:price:amount" content="419.99" />
  <meta xmlns:og="" property="product:price:currency" content="USD" />

I am able to get the meta tag with ‘meta’ selector but I am not able to scrape the content value within this tag. For example if I want to get the UPC, I got an empty text in my scraping result.

Please help.

@Alex2 You can use the Attribute selector to scrape this hidden tags from HTML. You can write your selector manually and then enter the “content” in attribute name option to scrape it.

To scrape the UPC the selector will be - meta[property=“og:upc”]
And then the attribute name will be - content

The answer by @Craig is correct. To give your more details, it’s important to use double-quote ("") in attribute selector when there is a special character in the attribute value you are using in your selector.

For example if your HTML was like this -

<meta xmlns:og="" property="upc" content="2633" />

This selector will work to extract this hidden value without double quotes as well -


But if the property value has special character like “:” as in your case it’s “og:upc”. So, it must be enclosed with quotes to make your selector valid and scraping these hidden elements in meta tags.


So valid selector is: