Re: watch YT videos through in Emacs [Was: Interest in an Org video meetup?]

2022-10-12 Thread Ihor Radchenko
Max Nikulin  writes:

> On 12/10/2022 16:26, Ihor Radchenko wrote:
>> 
>> if echo "$URL" | grep "ted.com/talks"; then
>>  mpv $URL && exit;
>> fi
>> 
>> # if echo "$URL" | grep "reddit.com"; then
>> # URL="$(echo "$URL" | sed -rE 's/www\.reddit\.com/libredd.it/')"
>> # fi
>> 
>> if echo "$URL" | grep "bilibili.com"; then
>>  mpv $URL && exit;
>> fi
>
> case "$URL" in
> *ted.com/talks*|*bilibili.com*)
>  mpv "$URL" && exit
>  ;;
> esac

Thanks! I keep forgetting how to use case :)

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: watch YT videos through in Emacs [Was: Interest in an Org video meetup?]

2022-10-12 Thread Robert Weiner
>  More info on my blog in Spanish (if anyone is interested, I can
translate it)

Yes, please translate it to English.

-- rsw


On Wed, Oct 12, 2022 at 6:24 AM Juan Manuel Macías 
wrote:

> Ihor Radchenko writes:
>
> > Quiliro Ordóñez  writes:
> >
> >> Hola Juan Manuel.
> >>
> >>> There is the YouTube option, which I imagine no one would like (me
> >>> neither). The only thing in its favor is that Invidious can be used to
> >>> watch the videos. BTW, I watch YT videos through Invidious in Emacs,
> >>> with the Ytel package and EMMS/MPV.
> >>
> >> Nice.  Is there a guide to do this specificly?
> >
> > I simply use
> >
> > #+begin_src bash :tangle ~/.local/bin/qutebrowser-call.sh :shebang
> #!/bin/bash
> > URL="$1"
> >
> > if echo "$URL" | grep "youtube.com"; then
> > # URL="$(echo "$URL" | sed -r 's/\\(www\\)?youtube\.com/
> invidious.namazso.eu/')"
> > if [[ ! -z $(echo "$URL" | grep "/watch") ]]; then
> >   mpv $URL && exit;
> > fi
> > fi
> >
> > if echo "$URL" | grep "ted.com/talks"; then
> >   mpv $URL && exit;
> > fi
> >
> > # if echo "$URL" | grep "reddit.com"; then
> > # URL="$(echo "$URL" | sed -rE 's/www\.reddit\.com/libredd.it/')"
> > # fi
> >
> > if echo "$URL" | grep "bilibili.com"; then
> > mpv $URL && exit;
> > fi
> >
> > grep "$URL" ~/.data/web-mirror/sources/* >/dev/null 2>&1 &&\
> > ARCHIVE_DIR="$(echo "$URL" | archivebox-cmd list 2>/dev/null | tail
> -n1 | cut -d' ' -f1  | sed -r 's|/data|~/.data/web-mirror|')"
> >
> > if [[ ! -z "$ARCHIVE_DIR" ]]; then
> > [[ -f "${ARCHIVE_DIR}/singlefile.html" ]] &&
> URL="${ARCHIVE_DIR}/singlefile.html";
> > fi
> >
> > #from
> https://github.com/qutebrowser/qutebrowser/blob/master/scripts/open_url_in_instance.sh
> > _url="$URL"
> > _command=":later 4000 :jump-mark last-position"
> >
> > qutebrowser "${_command}" ":spawn -u untrack-url -r -O ${_url}"
> >
> > #+end_src
> >
> > and my mpv is configured to use youtube-dl.
>
> In this short video I show an example of my procedure to watch youtube
> videos without leaving Emacs:
>
> https://cloud.disroot.org/s/X3cfi2orT38CPyM
>
> I use:
>
> 1. Helm-google-suggest (set to use duckduckgo)
>
> 2. Ytel (based on elfeed). With a few hacks that I have added, in order
> to:
>
>   - Display thumbnails in the searches.
>
>   - Watch the video at point (via invidious) with EMMS/MPV,
> configured with yt-dlp, which is a fork of youtube-dl that works
> much better.
>
>   - Download the video at point with yt-dlp (full video or only audio)
>
>   - Create a bookmark of the video with org-capture
>
> More info on my blog in Spanish (if anyone is interested, I can translate
> it):
>
> https://gnutas.juanmanuelmacias.com/ytel_invidious.html
>
> Best regards,
>
> Juan Manuel
>
>


Re: watch YT videos through in Emacs [Was: Interest in an Org video meetup?]

2022-10-12 Thread Max Nikulin

On 12/10/2022 16:26, Ihor Radchenko wrote:


if echo "$URL" | grep "ted.com/talks"; then
mpv $URL && exit;
fi

# if echo "$URL" | grep "reddit.com"; then
# URL="$(echo "$URL" | sed -rE 's/www\.reddit\.com/libredd.it/')"
# fi

if echo "$URL" | grep "bilibili.com"; then
 mpv $URL && exit;
fi


case "$URL" in
*ted.com/talks*|*bilibili.com*)
mpv "$URL" && exit
;;
esac






Re: watch YT videos through in Emacs [Was: Interest in an Org video meetup?]

2022-10-12 Thread Juan Manuel Macías
Ihor Radchenko writes:

> Quiliro Ordóñez  writes:
>
>> Hola Juan Manuel.
>>
>>> There is the YouTube option, which I imagine no one would like (me
>>> neither). The only thing in its favor is that Invidious can be used to
>>> watch the videos. BTW, I watch YT videos through Invidious in Emacs,
>>> with the Ytel package and EMMS/MPV.
>>
>> Nice.  Is there a guide to do this specificly?
>
> I simply use
>
> #+begin_src bash :tangle ~/.local/bin/qutebrowser-call.sh :shebang #!/bin/bash
> URL="$1"
>
> if echo "$URL" | grep "youtube.com"; then
> # URL="$(echo "$URL" | sed -r 
> 's/\\(www\\)?youtube\.com/invidious.namazso.eu/')"
> if [[ ! -z $(echo "$URL" | grep "/watch") ]]; then 
>   mpv $URL && exit;
> fi
> fi
>
> if echo "$URL" | grep "ted.com/talks"; then
>   mpv $URL && exit;
> fi
>
> # if echo "$URL" | grep "reddit.com"; then
> # URL="$(echo "$URL" | sed -rE 's/www\.reddit\.com/libredd.it/')"
> # fi
>
> if echo "$URL" | grep "bilibili.com"; then
> mpv $URL && exit;
> fi
>
> grep "$URL" ~/.data/web-mirror/sources/* >/dev/null 2>&1 &&\
> ARCHIVE_DIR="$(echo "$URL" | archivebox-cmd list 2>/dev/null | tail -n1 | 
> cut -d' ' -f1  | sed -r 's|/data|~/.data/web-mirror|')"
>
> if [[ ! -z "$ARCHIVE_DIR" ]]; then
> [[ -f "${ARCHIVE_DIR}/singlefile.html" ]] && 
> URL="${ARCHIVE_DIR}/singlefile.html";
> fi
>
> #from 
> https://github.com/qutebrowser/qutebrowser/blob/master/scripts/open_url_in_instance.sh
> _url="$URL"
> _command=":later 4000 :jump-mark last-position"
>
> qutebrowser "${_command}" ":spawn -u untrack-url -r -O ${_url}"
>
> #+end_src
>
> and my mpv is configured to use youtube-dl.

In this short video I show an example of my procedure to watch youtube
videos without leaving Emacs:

https://cloud.disroot.org/s/X3cfi2orT38CPyM

I use:

1. Helm-google-suggest (set to use duckduckgo)

2. Ytel (based on elfeed). With a few hacks that I have added, in order
to:

  - Display thumbnails in the searches.

  - Watch the video at point (via invidious) with EMMS/MPV,
configured with yt-dlp, which is a fork of youtube-dl that works
much better.

  - Download the video at point with yt-dlp (full video or only audio)

  - Create a bookmark of the video with org-capture

More info on my blog in Spanish (if anyone is interested, I can translate it):

https://gnutas.juanmanuelmacias.com/ytel_invidious.html

Best regards,

Juan Manuel 



Re: watch YT videos through in Emacs [Was: Interest in an Org video meetup?]

2022-10-12 Thread Ihor Radchenko
Quiliro Ordóñez  writes:

> Hola Juan Manuel.
>
>> There is the YouTube option, which I imagine no one would like (me
>> neither). The only thing in its favor is that Invidious can be used to
>> watch the videos. BTW, I watch YT videos through Invidious in Emacs,
>> with the Ytel package and EMMS/MPV.
>
> Nice.  Is there a guide to do this specificly?

I simply use

#+begin_src bash :tangle ~/.local/bin/qutebrowser-call.sh :shebang #!/bin/bash
URL="$1"

if echo "$URL" | grep "youtube.com"; then
# URL="$(echo "$URL" | sed -r 
's/\\(www\\)?youtube\.com/invidious.namazso.eu/')"
if [[ ! -z $(echo "$URL" | grep "/watch") ]]; then 
mpv $URL && exit;
fi
fi

if echo "$URL" | grep "ted.com/talks"; then
mpv $URL && exit;
fi

# if echo "$URL" | grep "reddit.com"; then
# URL="$(echo "$URL" | sed -rE 's/www\.reddit\.com/libredd.it/')"
# fi

if echo "$URL" | grep "bilibili.com"; then
mpv $URL && exit;
fi

grep "$URL" ~/.data/web-mirror/sources/* >/dev/null 2>&1 &&\
ARCHIVE_DIR="$(echo "$URL" | archivebox-cmd list 2>/dev/null | tail -n1 | 
cut -d' ' -f1  | sed -r 's|/data|~/.data/web-mirror|')"

if [[ ! -z "$ARCHIVE_DIR" ]]; then
[[ -f "${ARCHIVE_DIR}/singlefile.html" ]] && 
URL="${ARCHIVE_DIR}/singlefile.html";
fi

#from 
https://github.com/qutebrowser/qutebrowser/blob/master/scripts/open_url_in_instance.sh
_url="$URL"
_command=":later 4000 :jump-mark last-position"

qutebrowser "${_command}" ":spawn -u untrack-url -r -O ${_url}"

#+end_src

and my mpv is configured to use youtube-dl.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: watch YT videos through in Emacs [Was: Interest in an Org video meetup?]

2022-10-07 Thread Juan Manuel Macías
Hola, Quirilo,

Quiliro Ordóñez writes:

>> There is the YouTube option, which I imagine no one would like (me
>> neither). The only thing in its favor is that Invidious can be used to
>> watch the videos. BTW, I watch YT videos through Invidious in Emacs,
>> with the Ytel package and EMMS/MPV.
>
> Nice.  Is there a guide to do this specificly?

I have written a bunch of homemade hacks for ytel, including the ability
to display video thumbnails in the results. I explain all the details on
my blog, here:

https://gnutas.juanmanuelmacias.com/ytel_invidious.html

The post is in Spanish. If anyone is interested in this topic, I can
write a version in English.

Best regards,

Juan Manuel 



watch YT videos through in Emacs [Was: Interest in an Org video meetup?]

2022-10-07 Thread Quiliro Ordóñez
Hola Juan Manuel.

> There is the YouTube option, which I imagine no one would like (me
> neither). The only thing in its favor is that Invidious can be used to
> watch the videos. BTW, I watch YT videos through Invidious in Emacs,
> with the Ytel package and EMMS/MPV.

Nice.  Is there a guide to do this specificly?