YoutubeLoader.from_youtube_url does not work when using hf space it does work when i am doing it on local machine

from langchain_community.document_loaders import YoutubeLoader


# Function to load YouTube details
def get_youtube_details(video_url):
    print(video_url)
    loader = YoutubeLoader.from_youtube_url(str(video_url), add_video_info=False)
    docs = loader.load()
    print(docs)
    print("Video transcripts loaded in DB")
    return docs, loader

When i run this function on local it works i get the results.
but when done the same of hf space it returns docs as =

I have tried doing the same version of libraries on local and hf spaces via requirements.txt

Does hf spaces blocks requests to youtube?

HF link of app

I get the same problem. any solutions to this issue?
@tushifire have you resolved the problem?

I don’t have the API key for COHERE, so I don’t know if it works or not, but I’ve fixed it up to the point where it will start anyway.

Not yet I will give it a shot again.

1 Like

@John6666 The space link you shared is not working . The application did not even start.

What change did you do specifically that made you think its working now?

1 Like

It seems to have crashed at some point. I rebooted it.

I made a lot of changes, but the most important one is README.md. The header part is a configuration file for the HF space, without which any space will not work properly.

1 Like

May be your problem

If your Space needs to make any network requests, you can make requests through the standard HTTP and HTTPS ports (80 and 443) along with port 8080. Any requests going to other ports will be blocked.

Ref : Spaces Overview

1 Like