mirror of
https://github.com/zedeus/nitter
synced 2026-09-05 22:59:31 +00:00
Turn regex patterns into consts
This commit is contained in:
parent
bddb6df567
commit
b03faccd45
3 changed files with 16 additions and 7 deletions
|
|
@ -9,6 +9,7 @@ from htmlgen import a
|
|||
const
|
||||
thumbRegex = re".+:url\('([^']+)'\)"
|
||||
gifRegex = re".+thumb/([^\.']+)\.[jpng].*"
|
||||
reColor = re"a:active \{\n +color: (#[A-Z0-9]+)"
|
||||
|
||||
proc selectAll*(node: XmlNode; selector: string): seq[XmlNode] =
|
||||
if node == nil: return
|
||||
|
|
@ -134,7 +135,7 @@ proc getTimelineBanner*(node: XmlNode): string =
|
|||
|
||||
let style = node.select("style").innerText()
|
||||
var m: RegexMatch
|
||||
if style.find(re"a:active \{\n +color: (#[A-Z0-9]+)", m):
|
||||
if style.find(reColor, m):
|
||||
return style[m.group(0)[0]]
|
||||
|
||||
proc getMediaCount*(node: XmlNode): string =
|
||||
|
|
|
|||
Loading…
Reference in a new issue