mzltest commited on
Commit
67439f6
·
1 Parent(s): ed233d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -79,7 +79,7 @@ def downloadTubeUpload(query):
79
  # Step 1: Search for videos with the given query
80
  search_url = f"https://draw-8fj.begin.app/api/search/{urlencode(query)}"
81
  search_response = requests.get(search_url).json()
82
-
83
  # Step 2: Find the first video with duration less than 10 minutes and extract its ID
84
  video_id = None
85
  for item in search_response:
@@ -87,7 +87,7 @@ def downloadTubeUpload(query):
87
  if duration and duration < "00:10:00":
88
  video_id = item.get("id", {}).get("videoId")
89
  break
90
-
91
  # If no video with duration less than 10 minutes was found, return None
92
  if not video_id:
93
  return None
@@ -95,7 +95,7 @@ def downloadTubeUpload(query):
95
  # Step 3: Get the formats for the video and find the URL for the best audio-only format
96
  formats_url = f"https://draw-8fj.begin.app/api/info/{video_id}"
97
  formats_response = requests.get(formats_url).json()
98
-
99
  best_audio_format = None
100
  for fmt in formats_response.get("formats", []):
101
  if fmt.get("hasVideo") is False and fmt.get("hasAudio") is True and fmt.get("container") == "mp4":
 
79
  # Step 1: Search for videos with the given query
80
  search_url = f"https://draw-8fj.begin.app/api/search/{urlencode(query)}"
81
  search_response = requests.get(search_url).json()
82
+ print('1=>', search_response)
83
  # Step 2: Find the first video with duration less than 10 minutes and extract its ID
84
  video_id = None
85
  for item in search_response:
 
87
  if duration and duration < "00:10:00":
88
  video_id = item.get("id", {}).get("videoId")
89
  break
90
+ print('1-r',video_id)
91
  # If no video with duration less than 10 minutes was found, return None
92
  if not video_id:
93
  return None
 
95
  # Step 3: Get the formats for the video and find the URL for the best audio-only format
96
  formats_url = f"https://draw-8fj.begin.app/api/info/{video_id}"
97
  formats_response = requests.get(formats_url).json()
98
+ print(formats_response.json()["formats"])
99
  best_audio_format = None
100
  for fmt in formats_response.get("formats", []):
101
  if fmt.get("hasVideo") is False and fmt.get("hasAudio") is True and fmt.get("container") == "mp4":