Linked Questions

Popular Questions

How to extract specific dl, dt list elements using BeautifulSoup

Asked by At

I'm trying to extract the date, link, and title for news releases from this website (in Japanese):

https://www.rinnai.co.jp/releases/index.html

Here is the code that I've tried so far:

import requests
from bs4 import BeautifulSoup

r=requests.get("https://www.rinnai.co.jp/releases/index.html")
c=r.content
soup=BeautifulSoup(c,"html.parser")

all=soup.find_all("dl",)

My expected results are:

2019年01月09日
/releases/2019/0109/index_2.html
「深型スライドオープンタイプ」食器洗い乾燥機2019年3月1日発売 食器も調理器具もまとめて入る大容量

2019年01月09日
/releases/2019/0109/index_1.html
シンプルキッチンに似合う洗練されたドロップインコンロ 2月1日新発売 耐久性に優れたステンレストッププレート仕様のグリルレスコンロ

And my actual results are:

[<dl>
<dt>2019年01月09日</dt>
<dd>
<a href="/releases/2019/0109/index_2.html">



「深型スライドオープンタイプ」食器洗い乾燥機2019年3月1日発売 食器も調理器具もまとめて入る大容量



</a></dd>
</dl>, <dl>
<dt>2019年01月09日</dt>
<dd>
<a href="/releases/2019/0109/index_1.html">



シンプルキッチンに似合う洗練されたドロップインコンロ 2月1日新発売 耐久性に優れたステンレストッププレート仕様のグリルレスコンロ



</a></dd>
</dl>, <dl>

Related Questions