random proxy
This commit is contained in:
parent
6771bb774b
commit
647c377f65
16
stream.py
16
stream.py
@ -1,12 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
import random
|
||||
import json
|
||||
import urllib.parse
|
||||
import re
|
||||
import os
|
||||
import streamlink
|
||||
import tornado.web
|
||||
import tornado.routing
|
||||
import requests
|
||||
import json
|
||||
import os
|
||||
import urllib.parse
|
||||
import re
|
||||
|
||||
providers = {}
|
||||
providers["nrk"] = "https://tv.nrk.no"
|
||||
@ -168,8 +169,13 @@ class MainHandler(tornado.web.RequestHandler):
|
||||
path = path.strip("/")
|
||||
src = providers[provider] + self.request.path
|
||||
proxy = None
|
||||
proxy_list = proxies.get(provider)
|
||||
proxy_list = None
|
||||
proxy_list_orig = proxies.get(provider)
|
||||
if isinstance(proxy_list_orig, list):
|
||||
proxy_list = proxy_list_orig.copy()
|
||||
if isinstance(proxy_list, list):
|
||||
rand = random.SystemRandom()
|
||||
rand.shuffle(proxy_list)
|
||||
for proxy_temp in proxy_list:
|
||||
try:
|
||||
resp = requests.head(src, allow_redirects=True, proxies=proxy_temp.req)
|
||||
|
Loading…
Reference in New Issue
Block a user