Spaces:
Runtime error
Runtime error
Download app.py from rudayrude/scriptscrape: direct link, hf CLI and curl.
- Browser
- Download file 528 Bytes
-
https://huggingface.co/spaces/rudayrude/scriptscrape/resolve/main/app.py
- Command line
-
hf download hf://spaces/rudayrude/scriptscrape/app.py
-
curl -L -o app.py https://huggingface.co/spaces/rudayrude/scriptscrape/resolve/main/app.py
528 Bytes
| import sys | |
| from youtube_transcript_api import YouTubeTranscriptApi | |
| def get_clean_transcript(video_id): | |
| try: | |
| transcript = YouTubeTranscriptApi.get_transcript(video_id) | |
| except Exception as e: | |
| print(f"Error: {str(e)}") | |
| sys.exit(1) | |
| clean_transcript = "" | |
| for line in transcript: | |
| clean_transcript += f"{line['text']} " | |
| return clean_transcript | |
| if __name__ == "__main__": | |
| video_id = sys.argv[1] | |
| clean_transcript = get_clean_transcript(video_id) | |
| print(clean_transcript) |