admin commited on
Commit
a6003b4
·
1 Parent(s): eaa17fe
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -24,7 +24,7 @@ def extract_fst_url(text):
24
  url_pattern = r'(https?://[^\s"]+)'
25
  match = re.search(url_pattern, text)
26
  if match:
27
- out_url = match.group(1)
28
  if out_url[-1] == "/":
29
  out_url = out_url[:-1]
30
 
@@ -45,7 +45,7 @@ def get_real_url(short_url):
45
  ).url.split("/?")[0]
46
 
47
 
48
- def infer(video_url: str):
49
  title = cover = desc = dur = video = author = avatar = None
50
  if not video_url:
51
  title = "Empty video link!"
@@ -64,7 +64,7 @@ def infer(video_url: str):
64
  cover = response_json["imgurl"]
65
  desc = response_json["desc"]
66
 
67
- response_data = response_json["data"][0]
68
  dur = response_data["duration"]
69
  video_id = video_url.split("/")[-1]
70
  video = download_file(response_data["video_url"], video_id)
@@ -91,6 +91,7 @@ if __name__ == "__main__":
91
  placeholder="https://www.bilibili.com/video/*",
92
  show_copy_button=True,
93
  ),
 
94
  ],
95
  outputs=[
96
  gr.Textbox(label="Video title", show_copy_button=True),
@@ -105,9 +106,9 @@ if __name__ == "__main__":
105
  description="This site does not provide any video storage services, only to provide the most basic resolution services",
106
  flagging_mode="never",
107
  examples=[
108
- "BV1Dt4y1o7bU",
109
- "https://b23.tv/LuTAbzj",
110
- "https://www.bilibili.com/video/BV1Dt4y1o7bU",
111
  ],
112
  cache_examples=False,
113
  ).launch()
 
24
  url_pattern = r'(https?://[^\s"]+)'
25
  match = re.search(url_pattern, text)
26
  if match:
27
+ out_url = match.group(1).split("?")[0]
28
  if out_url[-1] == "/":
29
  out_url = out_url[:-1]
30
 
 
45
  ).url.split("/?")[0]
46
 
47
 
48
+ def infer(video_url: str, p: int):
49
  title = cover = desc = dur = video = author = avatar = None
50
  if not video_url:
51
  title = "Empty video link!"
 
64
  cover = response_json["imgurl"]
65
  desc = response_json["desc"]
66
 
67
+ response_data = response_json["data"][int(p) - 1]
68
  dur = response_data["duration"]
69
  video_id = video_url.split("/")[-1]
70
  video = download_file(response_data["video_url"], video_id)
 
91
  placeholder="https://www.bilibili.com/video/*",
92
  show_copy_button=True,
93
  ),
94
+ gr.Number(label="Part", minimum=1, maximum=1000, step=1, value=1),
95
  ],
96
  outputs=[
97
  gr.Textbox(label="Video title", show_copy_button=True),
 
106
  description="This site does not provide any video storage services, only to provide the most basic resolution services",
107
  flagging_mode="never",
108
  examples=[
109
+ ["BV1Dt4y1o7bU", 1],
110
+ ["https://b23.tv/LuTAbzj", 1],
111
+ ["https://www.bilibili.com/video/BV1Dt4y1o7bU", 1],
112
  ],
113
  cache_examples=False,
114
  ).launch()