Commit
·
28bc63e
1
Parent(s):
febdfb8
Update main.py
Browse files
main.py
CHANGED
|
@@ -22,6 +22,15 @@ with open('video_urls.pkl', 'rb') as f:
|
|
| 22 |
with open('owner_dict.pkl', 'rb') as f:
|
| 23 |
owner_dict = pkl.load(f)
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
def load_exception_urls():
|
| 26 |
url = os.environ['EXCEPTIONS']
|
| 27 |
response = requests.get(url)
|
|
@@ -84,6 +93,7 @@ def proxy(url):
|
|
| 84 |
}
|
| 85 |
|
| 86 |
clean_url = url.replace('proxy/', '')
|
|
|
|
| 87 |
|
| 88 |
try:
|
| 89 |
import time
|
|
|
|
| 22 |
with open('owner_dict.pkl', 'rb') as f:
|
| 23 |
owner_dict = pkl.load(f)
|
| 24 |
|
| 25 |
+
from urllib.parse import urlsplit, urlunsplit, quote, parse_qsl, urlencode
|
| 26 |
+
|
| 27 |
+
def encode_url(url):
|
| 28 |
+
scheme, netloc, path, query_string, fragment = urlsplit(url)
|
| 29 |
+
query_params = parse_qsl(query_string)
|
| 30 |
+
encoded_query_params = [(key, quote(value)) for key, value in query_params]
|
| 31 |
+
encoded_query_string = urlencode(encoded_query_params)
|
| 32 |
+
return urlunsplit((scheme, netloc, path, encoded_query_string, fragment))
|
| 33 |
+
|
| 34 |
def load_exception_urls():
|
| 35 |
url = os.environ['EXCEPTIONS']
|
| 36 |
response = requests.get(url)
|
|
|
|
| 93 |
}
|
| 94 |
|
| 95 |
clean_url = url.replace('proxy/', '')
|
| 96 |
+
clean_url = encode_url(clean_url)
|
| 97 |
|
| 98 |
try:
|
| 99 |
import time
|