我想提取從以下網站的標題和描述:如何使用python從URL中提取元描述?
查看源代碼:http://www.virginaustralia.com/au/en/bookings/flights/make-a-booking/
與源代碼下面的代碼片段:
<title>Book a Virgin Australia Flight | Virgin Australia
</title>
<meta name="keywords" content="" />
<meta name="description" content="Search for and book Virgin Australia and partner flights to Australian and international destinations." />
我想要的標題和meta內容。
我用鵝,但它沒有做好提取。這裏是我的代碼:
website_title = [g.extract(url).title for url in clean_url_data]
和
website_meta_description=[g.extract(urlw).meta_description for urlw in clean_url_data]
結果是空
BeautifulSoup怎麼樣? - https://www.crummy.com/software/BeautifulSoup/ –