Spaces:
Running
Running
experimental b64 decode
#1
by
parsee-mizuhashi
- opened
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
import requests
|
2 |
from bs4 import BeautifulSoup
|
3 |
import re
|
4 |
import gradio as gr
|
@@ -32,6 +32,14 @@ def get_blocked_urls():
|
|
32 |
# trim 1 char front and back, split the text with ';' into array
|
33 |
raw_string = raw_string[1:-1].split(';')
|
34 |
result = raw_string
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
if len(result) > 0:
|
37 |
return (result)
|
@@ -51,7 +59,15 @@ def handle_refresh():
|
|
51 |
"""
|
52 |
xs = "<ol>"
|
53 |
for url in get_blocked_urls():
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
xs += "</ol>"
|
56 |
return xs
|
57 |
|
|
|
1 |
+
import requests, base64
|
2 |
from bs4 import BeautifulSoup
|
3 |
import re
|
4 |
import gradio as gr
|
|
|
32 |
# trim 1 char front and back, split the text with ';' into array
|
33 |
raw_string = raw_string[1:-1].split(';')
|
34 |
result = raw_string
|
35 |
+
for i in range(len(result)):
|
36 |
+
try:
|
37 |
+
decodedurl = base64.b64decode(result[i]).decode('utf-8')
|
38 |
+
|
39 |
+
except:
|
40 |
+
decodedurl = None
|
41 |
+
if decodedurl:
|
42 |
+
result[i] = f"{result[i]} < {decodedurl} >[thisisb64]"
|
43 |
|
44 |
if len(result) > 0:
|
45 |
return (result)
|
|
|
59 |
"""
|
60 |
xs = "<ol>"
|
61 |
for url in get_blocked_urls():
|
62 |
+
if "[thisisb64]" in url:
|
63 |
+
url = url.replace("[thisisb64]", "")
|
64 |
+
# primary color [primary_100]
|
65 |
+
nondecoded = url.split('<')[0]
|
66 |
+
decodedurl = url.split('<')[1]
|
67 |
+
decodedurl = f"<{decodedurl}>"
|
68 |
+
xs += "<li><code>"+nondecoded+"</code> <font color="#4EACEF"><"+decodedurl+"></font></li>"
|
69 |
+
else:
|
70 |
+
xs += "<li><code>"+url+"</code></li>"
|
71 |
xs += "</ol>"
|
72 |
return xs
|
73 |
|