jfataphd commited on
Commit
fb7bdf2
·
1 Parent(s): 07a7646

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -34
app.py CHANGED
@@ -164,46 +164,52 @@ if query:
164
  mime='text/csv')
165
 
166
  if query:
167
- randomlist=[]
168
-
169
  search_keyword = {query}
170
- html = urllib.request.urlopen(f"https://www.youtube.com/results?search_query={database_name}")
 
 
 
 
171
  video_ids = re.findall(r"watch\?v=(\S{11})", html.read().decode())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
 
173
- video_form = st.form(key=f"youTube videos for {database_name}")
174
  c1, c2, c3 = st.columns(3)
175
  with c1:
176
- for i in range(50):
177
- idx = random.randint(0, 20)
178
- if idx not in randomlist:
179
- randomlist.append(idx)
180
- idx = idx
181
- VIDEO_DATA = "https://www.youtube.com/watch?v=" + video_ids[idx]
182
- width = 100
183
- side = 1 # (100-width)/2
184
- _, container, _ = st.columns([side, width, side])
185
- container.video(data=VIDEO_DATA)
186
  with c2:
187
- for i in range(50):
188
- idx = random.randint(0, 20)
189
- if idx not in randomlist:
190
- randomlist.append(idx)
191
- idx = idx
192
- VIDEO_DATA = "https://www.youtube.com/watch?v=" + video_ids[idx]
193
- width = 100
194
- side = 1
195
- _, container, _ = st.columns([side, width, side])
196
- container.video(data=VIDEO_DATA)
197
  with c3:
198
- for i in range(50):
199
- idx = random.randint(0, 20)
200
- if idx not in randomlist:
201
- randomlist.append(idx)
202
- idx = idx
203
- VIDEO_DATA = "https://www.youtube.com/watch?v=" + video_ids[idx]
204
- width = 100
205
- side = 1
206
- _, container, _ = st.columns([side, width, side])
207
- container.video(data=VIDEO_DATA)
 
 
 
 
 
 
 
208
 
209
 
 
164
  mime='text/csv')
165
 
166
  if query:
167
+ idlist=[]
 
168
  search_keyword = {query}
169
+ html = urllib.request.urlopen("https://www.youtube.com/@NCIgov/search?query=cancer")
170
+ html2 = urllib.request.urlopen("https://www.youtube.com/@CancerCenter/search?query=cancer")
171
+ html3 = urllib.request.urlopen("https://www.youtube.com/@NorthwesternMedicine/search?query=cancer")
172
+ html4 = urllib.request.urlopen("https://www.youtube.com/@TEDEd/search?query=cancer")
173
+ html5 = urllib.request.urlopen("https://www.youtube.com/@CancerResearchUK/search?query=cancer")
174
  video_ids = re.findall(r"watch\?v=(\S{11})", html.read().decode())
175
+ video_ids2 = re.findall(r"watch\?v=(\S{11})", html2.read().decode())
176
+ video_ids3 = re.findall(r"watch\?v=(\S{11})", html3.read().decode())
177
+ video_ids4 = re.findall(r"watch\?v=(\S{11})", html4.read().decode())
178
+ video_ids5 = re.findall(r"watch\?v=(\S{11})", html5.read().decode())
179
+
180
+ for i in video_ids2:
181
+ video_ids.append(i)
182
+ for i in video_ids3:
183
+ video_ids.append(i)
184
+ for i in video_ids4:
185
+ video_ids.append(i)
186
+ for i in video_ids5:
187
+ video_ids.append(i)
188
+
189
+ random.shuffle(video_ids)
190
 
 
191
  c1, c2, c3 = st.columns(3)
192
  with c1:
193
+ st.video("https://www.youtube.com/watch?v=" + video_ids[0])
 
 
 
 
 
 
 
 
 
194
  with c2:
195
+ st.video("https://www.youtube.com/watch?v=" + video_ids[1])
 
 
 
 
 
 
 
 
 
196
  with c3:
197
+ st.video("https://www.youtube.com/watch?v=" + video_ids[2])
198
+ # width = 40
199
+ # side = 30 # (100-width)/2
200
+ # _, container, _ = st.columns([side, width, side])
201
+ # container.video(data=VIDEO_DATA)
202
+
203
+ # VIDEO_DATA = "https://www.youtube.com/watch?v=" + video_ids[1]
204
+ # width = 40
205
+ # side = 30 # (100-width)/2
206
+ # _, container, _ = st.columns([side, width, side])
207
+ # container.video(data=VIDEO_DATA)
208
+
209
+ # VIDEO_DATA = "https://www.youtube.com/watch?v=" + video_ids[2]
210
+ # width = 40
211
+ # side = 30 # (100-width)/2
212
+ # _, container, _ = st.columns([side, width, side])
213
+ # container.video(data=VIDEO_DATA)
214
 
215