Finding paragraphs with duplicate text

I want to check (and eliminate) that two paragraphs in a part of text (or entire text, this does not matter for my task) have no identical text.

In other words, if two paragraphs have the same text:

XYZ

XYZ

this should be noted so that I could delete the second paragraph.

Note that only text matters; colors, level of indent, style, etc. don’t matter when finding paragraphs with duplicate text.

I suspect it can be done in LibreOffice Basic, but I don’t want to learn it to solve this problem only. Could anyone write a macro for me?

Hello @porton,

such a macro in Basic has already been written by JohnV on the other forum, and also a possibly faster macro in Python has been written by @karolus on that same page.

Link: How to find duplicate paragraphs?