`find-yttranscript-links'In march 2022 Andrea Giugliano wrote these two posts in his blog:
I immediately thought that: WOW, I need something like that in eev - but I would like to rewrite it in a style in which all the steps can be executed one by one, and I would like to integrate it with find-youtubedl-links... At that point I was still totally incompetent with Python - I didn't have this yet - so I had to ask for help on the #emacs IRC channel. After a lot of help I was able to write the functions find-yttranscript-links and find-pip3-links, that produce temporary buffers like the ones shown in the first two screenshots below, ...and I posted this in the eev mailing list:
It has a detailed explanation of how everything works, but in a format that is somewhat hard to read. Section 1 below is a de-uglified version of that e-mail to the mailing list; section 2 is about two functions similar to find-pip3-links that were added later, and section 3 is about a video that explains everything. You can watch it by clicking on the third screenshot above. You can read the subtitles in a nice format here. 1. The e-mail to the mailing list(The original is here.) Hi all, I added a small feature to eev that has some nice ideas in it. I think that it deserves a video, but I can't record the video now, so let me explain it by text. The new feature consists on just two functions: `find-yttranscript-links' and `find-pip3-links'. This blog post by ag91, called "An Elisp snippet to dowload YouTube videos transcripts", implements a function that downloads the transcript of a video from youtube using a Python package that can be installed using pip3, and in the day after writing that blog post the author wrote this other one, in which he translates his script to another style. So: I thought that I wanted to add that to eev, but I wanted to translate it to a third style, in which each line of the Python code could be executed individually, and all the intermediate results could be inspected and tinkered with. Remember that most functions of eev that operate on youtube URL work on the id, or the "hash", of the URL. If we put the point on the hash of the URL below and type `M-x find-yttranscript-links', or if we execute the "eek" sexp,
then we get a temporary buffer whose body is this:
Most of the functions in eev that generate temporary buffers use either `find-elinks' or `find-elinks-elisp'. I _could_ have implemented a `find-elinks-python' that would put the temporary buffer in python-mode, but I decided to be lazy and use the trick above, and I was quite pleased with the result... just to be clear: when we type <f8> on the line with the sexp `(python-mode)' the buffer changes to python-mode. That trick can be used for all other language modes, too. If you type <f8> on the line with the
you will probably get an error, because youtube_transcript_downloader is not installed... but a bit above the header we have this sexp,
that we can use to install youtube-transcript-downloader. If we run the Python script above - with all dependencies installed - the line
will print many lines like this one
in the target buffer of eepitch, that is running a Python REPL. The function `find-{c}video' is probably undefined, so that sexp doesn't play a video. One way to solve this - in two steps - is to change the line at the top of the *find-yttranscript-links* buffer from
to:
and then regenerate the buffer and rerun its Python script, then the last "print" will generate lots of lines like this one:
which is a bit better. If the function `find-acmetourvideo' is not defined we can execute this sexp, that is in one of the first lines of the *find-yttranscript-links* buffer,
to either download a local copy of that video and define `find-acmetourvideo' as a function that plays it, or to define `find-acmetourvideo' as function that plays that video on youtube. The last two lines of the *find-youtubedl-links* will be these ones (because I changed this yesterday),
and we can use the `find-yttranscript-links' sexp to go back to the buffer that generates the transcript. 2. `find-importlib-links' and `find-pypi-links'In 2022-10-19 I asked on #python how I could enhance find-pip3-links. I showed a screenshot of my find-cabal-links, explained how I use it to get information about a Haskell package and to download a copy of its upstream repository, and asked how I could do something like that for Python packages. I got a lot of help - thanks SpookJ, grym, Tritium, and BrenBarn! - and I was able to write the functions find-importlib-links and find-pypi-links, that create temporary buffers like the ones below: 3. The videoI recorded it in 2022oct20, and then I ran this on it,
and edited the output to prepare this preliminary index for the video. In 2022dec30 I added "real subtitles" to the video, and now you can watch it with subtitles - even in high speed! - with:
4. The subtitlesYou can read the subtitles of this video here. |