diff options
| author | 2019-07-20 05:51:44 -0400 | |
|---|---|---|
| committer | 2019-07-20 05:51:44 -0400 | |
| commit | 2a63a9c9b7032a76894c48ac4d9cea732fcaee49 (patch) | |
| tree | 3d5f633ff69cd393036a3dabc4d4533c8484f9ad /gallery_dl/text.py | |
| parent | 195c45911e79c33cf0bb986721365fb06df5a153 (diff) | |
New upstream version 1.9.0upstream/1.9.0
Diffstat (limited to 'gallery_dl/text.py')
| -rw-r--r-- | gallery_dl/text.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gallery_dl/text.py b/gallery_dl/text.py index 151fa30..81e87b5 100644 --- a/gallery_dl/text.py +++ b/gallery_dl/text.py @@ -36,12 +36,15 @@ def clean_xml(xmldata, repl=""): return xmldata -def remove_html(txt): +def remove_html(txt, repl=" ", sep=" "): """Remove html-tags from a string""" try: - return " ".join(re.sub("<[^>]+>", " ", txt).split()) + txt = re.sub("<[^>]+>", repl, txt) except TypeError: return "" + if sep: + return sep.join(txt.split()) + return txt.strip() def split_html(txt, sep=None): |
