Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files via upload #2

Closed
wants to merge 1 commit into from
Closed

Conversation

venom-developer
Copy link

No description provided.

@venom-developer
Copy link
Author

please accept my PR this is the best i can do. thanks

Comment on lines +54 to +107

import tempfile
from youtube_transcript_api import YouTubeTranscriptApi


class Transcribe:
def __init__(self, url) -> None:
# https://www.youtube.com/watch?v=34u1sOLrgVo
self.url = url.split("?")[1].split("&")[0].split("=")[1]

def transcribe(self):
srt = YouTubeTranscriptApi.get_transcript(self.url)

transcript = ""

for i in srt:
transcript += i["text"] + " "

transcript = transcript.replace("\n", " ")

transcript_file = tempfile.NamedTemporaryFile(
mode="w", delete=False, suffix=".txt"
)

transcript_file.write(transcript)

return transcript_file.name
import tempfile
from youtube_transcript_api import YouTubeTranscriptApi


class Transcribe:
def __init__(self, url) -> None:
# https://www.youtube.com/watch?v=34u1sOLrgVo
self.url = url.split("?")[1].split("&")[0].split("=")[1]

def transcribe(self):
srt = YouTubeTranscriptApi.get_transcript(self.url)

transcript = ""

for i in srt:
transcript += i["text"] + " "

transcript = transcript.replace("\n", " ")

transcript_file = tempfile.NamedTemporaryFile(
mode="w", delete=False, suffix=".txt"
)

transcript_file.write(transcript)

return transcript_file.name

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review this part of the code. It seems that you've added the same code multiple times.

@cyai
Copy link
Owner

cyai commented Oct 11, 2023

Since, there is no updates from @venom-developer I am closing this PR!

@cyai cyai closed this Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants