I am trying to create a chrome extension which transcribes a Youtube video into text allowing the user to save time. In order to obtain the transcript of the specific video, I use an external Python API called the 'youtube-transcript-api' which returns a dictionary and I then convert it into JSON so that my javascript can access it.
from youtube_transcript_api import YouTubeTranscriptApi
import json
# assigning srt variable with the list of dictonaries
# obtained by the the .get_transcript() function
# and this time it gets only teh subtitles that
# are of english langauge.
srt = YouTubeTranscriptApi.get_transcript("TA_Wk53oHT8",
languages=['en'])
# writing the json file
out_file = open("subtitles.json", "w")
out_file.truncate(0) # emptying the contents of the JSON file
json.dump(srt, out_file, indent = 4, sort_keys = False)
out_file.close()
The javascript then parses the JSON and displays it on the page.
I want to use this Python + JavaScript in a chrome extension while also using the external youtube-transcript-api. How to do so by providing step-by-step instructions including the permissions required in the manifest.json file by the external python api? I am new and just in high school.
I have spent days googling but can't come up with a solution.