Spaces:
Runtime error
Runtime error
File size: 769 Bytes
232d651 bffc7a4 232d651 bffc7a4 d48eb67 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
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)
|