flyboytarantino14 commited on
Commit
1ef3b80
1 Parent(s): f6261a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
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
- print(desired_string)
17
- numbers = desired_string.split(',')
18
- if len(numbers) > 1:
19
- desired_string = ",".join(numbers[1:]) # Keep only the numbers after the first comma
20
- else:
21
- print("Only one number found.")
 
 
22
  else:
23
  print("String not found.")
24
  else:
25
  print("Failed to fetch content from the URL.")
26
- return desired_string.strip()
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()