Spaces:
Sleeping
Sleeping
flyboytarantino14
commited on
Commit
•
1ef3b80
1
Parent(s):
f6261a5
Update app.py
Browse files
app.py
CHANGED
@@ -9,21 +9,23 @@ def function(url):
|
|
9 |
content = response.text
|
10 |
escaped_content = html.escape(content)
|
11 |
print(escaped_content)
|
12 |
-
pattern = r'APP_INITIALIZATION_STATE=\[\[\[([^]]
|
13 |
matches = re.search(pattern, content, re.S)
|
14 |
if matches:
|
15 |
desired_string = matches.group(1)
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
else:
|
23 |
print("String not found.")
|
24 |
else:
|
25 |
print("Failed to fetch content from the URL.")
|
26 |
-
return
|
27 |
|
28 |
input = gr.Textbox()
|
29 |
output = gr.Textbox()
|
|
|
9 |
content = response.text
|
10 |
escaped_content = html.escape(content)
|
11 |
print(escaped_content)
|
12 |
+
pattern = r'APP_INITIALIZATION_STATE=\[\[\[([^]]+)\]'
|
13 |
matches = re.search(pattern, content, re.S)
|
14 |
if matches:
|
15 |
desired_string = matches.group(1)
|
16 |
+
# Split the string by commas
|
17 |
+
numbers_list = desired_string.split(',')
|
18 |
+
# Remove the first element (index 0) from the list
|
19 |
+
numbers_list = numbers_list[1:]
|
20 |
+
# Swap the positions of the two numbers in the list
|
21 |
+
numbers_list[0], numbers_list[1] = numbers_list[1], numbers_list[0]
|
22 |
+
# Join the remaining elements back into a string using commas as the delimiter
|
23 |
+
result_string = ','.join(numbers_list)
|
24 |
else:
|
25 |
print("String not found.")
|
26 |
else:
|
27 |
print("Failed to fetch content from the URL.")
|
28 |
+
return result_string
|
29 |
|
30 |
input = gr.Textbox()
|
31 |
output = gr.Textbox()
|