Spaces:
Runtime error
Runtime error
import gradio as gr | |
import requests | |
from youtube_transcript_api import YouTubeTranscriptApi | |
import json | |
def retrieve_url(vid_id): | |
try: | |
transcript = YouTubeTranscriptApi.get_transcript(vid_id) | |
except Exception as e: | |
raise e | |
req = requests.get( | |
f"https://yt.lemnoslife.com/noKey/videos?part=snippet&id={vid_id}" | |
) | |
if req.status_code == 200: | |
information = json.loads(req.content) | |
else: | |
# print(req.status_code) | |
information = None | |
return "" | |
# print(transcript) | |
text = " ".join([x["text"] for x in transcript]) | |
return text | |
def greet(name): | |
return "Hello " + name + "!!" | |
demo = gr.Interface(fn=retrieve_url, inputs="text", outputs="text") | |
demo.launch(share=True) | |