mirror of
https://github.com/zedeus/nitter
synced 2026-09-05 22:59:31 +00:00
Add video proxy support
This commit is contained in:
parent
f5fef0ff3a
commit
ce6dace1d7
4 changed files with 20 additions and 6 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import strutils, strformat, htmlgen, xmltree, times
|
||||
import regex
|
||||
|
||||
import types
|
||||
import types, utils
|
||||
|
||||
from unicode import Rune, `$`
|
||||
|
||||
|
|
@ -74,6 +74,12 @@ proc stripTwitterUrls*(text: string): string =
|
|||
result = result.replace(picRegex, "")
|
||||
result = result.replace(ellipsisRegex, "")
|
||||
|
||||
proc proxifyVideo*(manifest: string; proxy: bool): string =
|
||||
proc cb(m: RegexMatch; s: string): string =
|
||||
result = "https://video.twimg.com" & s[m.group(0)[0]]
|
||||
if proxy: result = result.getSigUrl("video")
|
||||
result = manifest.replace(re"(.+(.ts|.m3u8|.vmap))", cb)
|
||||
|
||||
proc getUserpic*(userpic: string; style=""): string =
|
||||
let pic = userpic.replace(re"_(normal|bigger|mini|200x200|400x400)(\.[A-z]+)$", "$2")
|
||||
pic.replace(re"(\.[A-z]+)$", style & "$1")
|
||||
|
|
|
|||
Loading…
Reference in a new issue