Reputation: 549
I'm currently trying to retrieve a meta property tag along with some values from the script tag. The values from the script tag work just fine. I have a problem only with the meta property tag. I've written an xpath for it, for it seems it doesn't work because it return "None"
.
The line I've talking about is:
name = response.xpath("//meta[@name='og:country-name']/@content").extract_first()
The meta property from the page is:
<meta property="og:country-name" content="al">
I want to retrieve the content inside it.
Thank you!
Upvotes: 0
Views: 573
Reputation: 52685
Attribute is not a name
, but property
, so just replace
"//meta[@name='og:country-name']/@content"
with
"//meta[@property='og:country-name']/@content"
Upvotes: 2