Link profile location to search query if available

Fixes #60
This commit is contained in:
Zed
2019-10-08 23:25:59 +02:00
parent d8c8b6696a
commit 83a651e732
3 changed files with 15 additions and 2 deletions

View File

@@ -92,6 +92,14 @@ proc getBio*(profile: XmlNode; selector: string; fallback=""): string =
bio = profile.selectText(fallback)
stripText(bio)
proc getLocation*(profile: XmlNode): string =
let sel = ".ProfileHeaderCard-locationText"
result = profile.selectText(sel).stripText()
let link = profile.selectAttr(sel & " a", "data-place-id")
if link.len > 0:
result &= ":" & link
proc getAvatar*(profile: XmlNode; selector: string): string =
profile.selectAttr(selector, "src").getUserpic()