Remove html from tweet preview

This commit is contained in:
Zed
2019-10-10 11:35:48 +02:00
parent e7c5085365
commit fe15003665
2 changed files with 7 additions and 2 deletions

View File

@@ -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()