How can I get content value from meta tag using PyQuery?

1k views Asked by At
<meta name="keywords" content="Ruby On Rails (Software), Authentication (Software Genre), Tutorial (Industry), howto, tips, tricks">

How can I get content value from this meta tag using PyQuery?

from pyquery import PyQuery

def get_data(myurl):
    query = PyQuery(url=myurl)
    title = query("title").text()
    keyword = query("meta[name=keywords]").text()
    ...
1

There are 1 answers

0
rat On

You've almost made it, missing apostrophe character to set the keywork

keyword = query("meta[name='keywords']").text()