Prevent 403 errors from outdated videos
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import strutils, sequtils
|
||||
import strutils, sequtils, asyncdispatch, httpclient
|
||||
import ../utils, ../prefs
|
||||
export utils, prefs
|
||||
|
||||
@@ -13,3 +13,9 @@ template refPath*(): untyped {.dirty.} =
|
||||
|
||||
proc getNames*(name: string): seq[string] =
|
||||
name.strip(chars={'/'}).split(",").filterIt(it.len > 0)
|
||||
|
||||
proc safeFetch*(url: string): Future[string] {.async.} =
|
||||
let client = newAsyncHttpClient()
|
||||
try: result = await client.getContent(url)
|
||||
except: discard
|
||||
client.close()
|
||||
|
||||
Reference in New Issue
Block a user