EnigmaOfTheWorld commited on
Commit
ad953b8
·
1 Parent(s): b63372f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -83,13 +83,19 @@ def gen_draw(user_query:str)->tuple:
83
  return "Invalid prompt"
84
 
85
 
86
-
87
  def vid_tube(user_query:str) -> tuple:
88
  py_tube_list_of_videos = Search(user_query)
89
  first_video = py_tube_list_of_videos.results[0]
90
- youtube_object = first_video.streams.get_highest_resolution() #if facing problems use get_lowest_resolution
91
- file_path = youtube_object.download('/tmp/')
92
- return (file_path,)
 
 
 
 
 
 
 
93
 
94
 
95
  def search_internet(user_query:str,*,key_number:int) -> str:
 
83
  return "Invalid prompt"
84
 
85
 
 
86
  def vid_tube(user_query:str) -> tuple:
87
  py_tube_list_of_videos = Search(user_query)
88
  first_video = py_tube_list_of_videos.results[0]
89
+ yt_flag = False
90
+ for vid in py_tube_list_of_videos.results:
91
+ print(vid.vid_info.keys())
92
+ if vid.vid_info.get('streamingData'):
93
+ print(vid.vid_info.keys(),'-')
94
+ yt_flag = True
95
+ file_path = vid.streams.get_highest_resolution().download('/content/')
96
+ break
97
+
98
+ return (file_path,) if yt_flag else "The system cannot fulfill your request currently please try later"
99
 
100
 
101
  def search_internet(user_query:str,*,key_number:int) -> str: