|
from youtubesearchpython import VideosSearch |
|
import gradio as gr |
|
|
|
def search_youtube_videos(keyword, limit=5): |
|
videos_search = VideosSearch(keyword, limit=limit) |
|
results = videos_search.result() |
|
|
|
video_urls = [video['link'] for video in results['result']] |
|
return video_urls |
|
|
|
def gradio_interface(keyword): |
|
video_urls = search_youtube_videos(keyword, limit=5) |
|
return "\n".join(video_urls) |
|
|
|
interface = gr.Interface( |
|
fn=gradio_interface, |
|
inputs=gr.Textbox(label="κ²μ ν€μλλ₯Ό μ
λ ₯νμΈμ"), |
|
outputs=gr.Textbox(label="κ²μλ μ νλΈ λμμ URL"), |
|
title="μ νλΈ κ²μ λμ°λ―Έ", |
|
description="ν€μλλ₯Ό μ
λ ₯νλ©΄ μ νλΈμμ ν΄λΉ ν€μλλ‘ κ²μν ν λμμ URLμ 보μ¬μ€λλ€." |
|
) |
|
|
|
if __name__ == "__main__": |
|
interface.launch() |