Can I access meta tags using Custom API?
Yes. Custom API allows you to access practically all elements on the page.
A common <meta> element may look like this:
<meta property="og:title" content="Supreme Court Bolsters Gay Marriage With Two Major Rulings" />When creating our rule, the first step is to create a CSS selector with the proper syntax to identify the specific meta property, og:title: meta[property=og:title]
Once that’s done, you’ll also need to specify the attribute you want to extract. In most cases this is the content attribute:
With that, your field should now be populated with the contents of the meta tag you specified.
Additional notes:
- Did you know our Extract APIs can automatically return all meta elements found on a page using the
fields=metaparameter? Read more in Optional Fields. - You can use the above syntax or attribute filters to extract nearly any other tag on a page. A
srcattribute will return the source URL of an image file, and thehrefattribute will return an anchor tag’s link location.div[itemprop=author]will retrieve any div elements that have anitempropattribute of “author.”
Updated 18 days ago