mirror of
https://github.com/zedeus/nitter
synced 2026-09-06 15:19:32 +00:00
parent
7d431781c3
commit
8114eefa19
18 changed files with 338 additions and 41 deletions
|
|
@ -86,6 +86,12 @@ proc decoded*(req: jester.Request; index: int): string =
|
|||
if based: decode(encoded)
|
||||
else: decodeUrl(encoded)
|
||||
|
||||
proc normalizeImgUrl*(url: var string) =
|
||||
if not url.startsWith("http"):
|
||||
if "twimg.com" notin url:
|
||||
url.insert(twimg)
|
||||
url.insert(https)
|
||||
|
||||
proc createMediaRouter*(cfg: Config) =
|
||||
router media:
|
||||
get "/pic/?":
|
||||
|
|
@ -94,11 +100,7 @@ proc createMediaRouter*(cfg: Config) =
|
|||
get re"^\/pic\/orig\/(enc)?\/?(.+)":
|
||||
var url = decoded(request, 1)
|
||||
cond "/amplify_video/" notin url
|
||||
|
||||
if "twimg.com" notin url:
|
||||
url.insert(twimg)
|
||||
if not url.startsWith(https):
|
||||
url.insert(https)
|
||||
normalizeImgUrl(url)
|
||||
url.add("?name=orig")
|
||||
|
||||
let uri = parseUri(url)
|
||||
|
|
@ -110,11 +112,7 @@ proc createMediaRouter*(cfg: Config) =
|
|||
get re"^\/pic\/(enc)?\/?(.+)":
|
||||
var url = decoded(request, 1)
|
||||
cond "/amplify_video/" notin url
|
||||
|
||||
if "twimg.com" notin url:
|
||||
url.insert(twimg)
|
||||
if not url.startsWith(https):
|
||||
url.insert(https)
|
||||
normalizeImgUrl(url)
|
||||
|
||||
let uri = parseUri(url)
|
||||
cond isTwitterUrl(uri) == true
|
||||
|
|
@ -143,6 +141,6 @@ proc createMediaRouter*(cfg: Config) =
|
|||
|
||||
if ".m3u8" in url:
|
||||
let vid = await safeFetch(url)
|
||||
content = proxifyVideo(vid, requestPrefs().proxyVideos)
|
||||
content = proxifyVideo(vid, requestPrefs().proxyVideos, url)
|
||||
|
||||
resp content, m3u8Mime
|
||||
|
|
|
|||
Loading…
Reference in a new issue