wuhp commited on
Commit
8dd9c3f
·
verified ·
1 Parent(s): 8724b67

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -29,7 +29,8 @@ def scan_url_vt(url, api_key):
29
  def fetch_clean_videos(keywords, api_key, scan_enabled):
30
  query = " OR ".join([f"{kw.strip().replace(' ', '+')}" for kw in keywords.split(",")])
31
  ia_query = f"mediatype:(movies) AND ({query})"
32
- results = list(search_items(ia_query, rows=50))
 
33
  clean_urls = []
34
  for res in results:
35
  item = get_item(res['identifier'])
@@ -40,7 +41,7 @@ def fetch_clean_videos(keywords, api_key, scan_enabled):
40
  if scan_enabled and api_key:
41
  try:
42
  is_clean = scan_url_vt(url, api_key)
43
- except Exception as e:
44
  continue
45
  else:
46
  is_clean = True
@@ -67,4 +68,4 @@ with gr.Blocks() as demo:
67
  run_btn.click(fn=gui, inputs=[kw_input, key_input, scan_toggle], outputs=output)
68
 
69
  if __name__ == "__main__":
70
- demo.launch() # on HuggingFace Spaces, this binds to 0.0.0.0 automatically
 
29
  def fetch_clean_videos(keywords, api_key, scan_enabled):
30
  query = " OR ".join([f"{kw.strip().replace(' ', '+')}" for kw in keywords.split(",")])
31
  ia_query = f"mediatype:(movies) AND ({query})"
32
+ # limit parameter works with internetarchive.search_items
33
+ results = list(search_items(ia_query, limit=50))
34
  clean_urls = []
35
  for res in results:
36
  item = get_item(res['identifier'])
 
41
  if scan_enabled and api_key:
42
  try:
43
  is_clean = scan_url_vt(url, api_key)
44
+ except Exception:
45
  continue
46
  else:
47
  is_clean = True
 
68
  run_btn.click(fn=gui, inputs=[kw_input, key_input, scan_toggle], outputs=output)
69
 
70
  if __name__ == "__main__":
71
+ demo.launch() # Hugging Face Spaces binds to 0.0.0.0, no file downloads