Compare commits
2 commits
c0f8f1da38
...
05ca46ffef
Author | SHA1 | Date | |
---|---|---|---|
05ca46ffef | |||
f67fbefb5e |
2 changed files with 3 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,6 +6,7 @@ meme.jpg
|
||||||
toots.db
|
toots.db
|
||||||
toots.db-journal
|
toots.db-journal
|
||||||
toots.db-wal
|
toots.db-wal
|
||||||
|
.mypy_cache/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
__pypackages__/
|
__pypackages__/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
|
@ -80,10 +80,10 @@ def extract_toot(toot):
|
||||||
toot = html.unescape(toot) # convert HTML escape codes to text
|
toot = html.unescape(toot) # convert HTML escape codes to text
|
||||||
soup = BeautifulSoup(toot, "html.parser")
|
soup = BeautifulSoup(toot, "html.parser")
|
||||||
for lb in soup.select("br"): # replace <br> with linebreak
|
for lb in soup.select("br"): # replace <br> with linebreak
|
||||||
lb.name = "\n"
|
lb.append('\n')
|
||||||
|
|
||||||
for p in soup.select("p"): # ditto for <p>
|
for p in soup.select("p"): # ditto for <p>
|
||||||
p.name = "\n"
|
p.append('\n\n')
|
||||||
|
|
||||||
for ht in soup.select("a.hashtag"): # convert hashtags from links to text
|
for ht in soup.select("a.hashtag"): # convert hashtags from links to text
|
||||||
ht.unwrap()
|
ht.unwrap()
|
||||||
|
|
Loading…
Reference in a new issue