mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-12 02:56:29 +00:00
Remove html from tweet preview
This commit is contained in:
parent
e7c5085365
commit
fe15003665
2 changed files with 7 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
import strutils, strformat, sequtils, htmlgen, xmltree, times, uri, tables
|
||||
import strutils, strformat, sequtils, times, uri, tables
|
||||
import xmltree, htmlparser, htmlgen
|
||||
import regex
|
||||
|
||||
import types, utils, query
|
||||
|
@ -92,3 +93,7 @@ proc getTwitterLink*(path: string; params: Table[string, string]): string =
|
|||
result = $(parseUri("https://twitter.com") / path ? p)
|
||||
if username.len > 0:
|
||||
result = result.replace("/" & username, "")
|
||||
|
||||
proc getTweetPreview*(text: string): string =
|
||||
let html = parseHtml(text)
|
||||
html.innerText()
|
||||
|
|
|
@ -57,7 +57,7 @@ proc renderMain*(body: VNode; req: Request; title="Nitter"; titleText=""; desc="
|
|||
meta(name="viewport", content="width=device-width, initial-scale=1.0")
|
||||
meta(property="og:type", content=`type`)
|
||||
meta(property="og:title", content=titleText)
|
||||
meta(property="og:description", content=desc)
|
||||
meta(property="og:description", content=getTweetPreview(desc))
|
||||
meta(property="og:site_name", content="Nitter")
|
||||
|
||||
for url in images:
|
||||
|
|
Loading…
Reference in a new issue