jsoup の Element#text() が便利。HTMLのタグを削除して中身のテキストだけ抽出できる。子要素のものも含めてまとめて抽出できるのでありがたい。 「Gets the normalized, combined text of this element and all its children. Whitespace is normalized and trimmed.」 「For example, given HTML <p>Hello <b>there</b> now! </p>, p.text() returns "Hello there now!"」 Element (jsoup Java HTML Parser 1.15.3 API) https://jsoup.org/apidocs/org/jsoup/nodes/Element.html#text()
[Mastodon] 2023-02-09 08:38:12
|