mirror of
https://github.com/zedeus/nitter
synced 2026-09-06 07:09:31 +00:00
Add experimental user search parser
This commit is contained in:
parent
49a2fbb070
commit
4738ec3385
8 changed files with 74 additions and 33 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import std/[algorithm, unicode, re, strutils, strformat]
|
||||
import std/[algorithm, unicode, re, strutils, strformat, options]
|
||||
import jsony
|
||||
import utils, slices
|
||||
import ../types/user as userType
|
||||
|
|
@ -38,9 +38,11 @@ proc getBanner(user: RawUser): string =
|
|||
if user.profileLinkColor.len > 0:
|
||||
return '#' & user.profileLinkColor
|
||||
|
||||
if user.profileImageExtensions.mediaColor.r.ok.palette.len > 0:
|
||||
let color = user.profileImageExtensions.mediaColor.r.ok.palette[0].rgb
|
||||
return &"#{color.red:02x}{color.green:02x}{color.blue:02x}"
|
||||
if user.profileImageExtensions.isSome:
|
||||
let ext = get(user.profileImageExtensions)
|
||||
if ext.mediaColor.r.ok.palette.len > 0:
|
||||
let color = ext.mediaColor.r.ok.palette[0].rgb
|
||||
return &"#{color.red:02x}{color.green:02x}{color.blue:02x}"
|
||||
|
||||
proc toUser*(raw: RawUser): User =
|
||||
result = User(
|
||||
|
|
|
|||
Loading…
Reference in a new issue