Jeffgold commited on
Commit
cbd85fc
·
1 Parent(s): c047e75

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -13,12 +13,15 @@ def download_file(url, destination):
13
  with open(destination, 'wb') as f:
14
  f.write(response.content)
15
 
 
 
16
  def get_input_path(video_file, video_url, temp_dir):
17
  """Returns the path to the video file, downloading it if necessary."""
18
  if video_file is not None:
19
  return Path(video_file.name)
20
  elif video_url:
21
- file_name = Path(video_url).name
 
22
  destination = temp_dir / file_name
23
  download_file(video_url, destination)
24
  return destination
 
13
  with open(destination, 'wb') as f:
14
  f.write(response.content)
15
 
16
+ from urllib.parse import urlparse
17
+
18
  def get_input_path(video_file, video_url, temp_dir):
19
  """Returns the path to the video file, downloading it if necessary."""
20
  if video_file is not None:
21
  return Path(video_file.name)
22
  elif video_url:
23
+ url_path = urlparse(video_url).path
24
+ file_name = Path(url_path).name
25
  destination = temp_dir / file_name
26
  download_file(video_url, destination)
27
  return destination