Markets

Check youtube remote control with this command line in Linux

This pages describe how youTube remotely operate in the browser.

In practice, this type of script should not be used directly from the command line, but rather attached to the keyboard shortcut or run from another script that forms a larger process.

This approach works only for Linux because of the restrictions on the Chrome extension. If you have a programming experience, you may be able to adjust the approach to another operating system. I would direct everyone who is interested in Mozeidon, an example of remote control Chrome What can be triggered by the command line.

This approach works only for chromium -based browsers. I got it to work with Brave, but there is another Chrome-based browser.

How does it work

The whole page is effectively alternative and complete documentation for the flowers that almost by the way. However, this page focuses on the use of the Linux command line and works on some issues at some circuit centers and is an easy-to-find article on YouTube management on the command line.

Vooluyys was written with the aim of checking YouTube or other media players by running with Chrome from all other tabs. However, by the way, it also provides support for MPRIS, which is generally a Linux protocol for multimedia guidance on a command trip. This standard can be used for a YouTube playback from the command line.

You can do things like::

  • Stop the player
  • Move on
  • Get the current position in Helis. Suitable for adding notes or sharing with others.
  • Get video length

You can be particularly useful when connecting a video subtitles for a YT DLP.

Setting up all

Unfortunately, the flow has been removed from the Chrome extension store, has a construction process that depends on outdated libraries, and requires an outdated process of construction. However, it works.

You need to download the flow techniques, build and add Chrome manually. This may be a good experience for you if you are going to develop your browser extension.

Requirements:

  1. UV is required to use the old version of Python node-gyp what requires node-sass

  2. NVM must use the old version node Used to build an extension

  3. python3-dbus is required for an interface used to communicate with an extension of the command line

  4. playerctl There is a command bar tool for interacting with Mediaplayers (including streams after some configuration).

Both tools are standard, widely used development tools

To install the well -maintained results:

  1. sudo apt-get install pipx

  2. sudo apt-get install python3-dbus

  3. pipx install uv

  4. Follow the instructions to install here nvmTo. Note nvm UPDAID, whose bark configuration and demands that this configuration again loads

To build current:

  1. Cd ~/.localTo. I like to keep the code installed here – but you can save your code elsewhere.

  2. Clone flow. git clone [email protected]:berrberr/streamkeys.git

  3. cd streamkeys

  4. Create an old Python UV -Virtualenv uv venv --python=3.10

  5. Activate UV Virtual Virtualenv source .venv/bin/activate

  6. Install the knot 16 nvm install 16

  7. Allow knot 16 nvm use 16

  8. Add this python python --version should return 3.10 and node --version should 16.

  9. Set up a construction environment npm install

  10. Create an extension npm run dev

To install Roomkeys:

  1. Find the extension ./build/unpacked-dev

  2. Go to the extension page Chrome “Chrome: // Extensions”

  3. Add a developer extension with the road build/unpacked-dev

You need to start the script to enable power wins to use the silhouette (MPIRS).

  1. Find the streamkeys extension ID. Go brave://extensions/ And click on the Details of the Package streamkeys. It should have an ID – copy this ID.
  2. Start the script python3 ./build/unpacked-dev/native/mpris_host_setup.py install $ID With its ID.

Order playerctl pause should now take a break from YouTube and playerctl play Start it.

Use

You can use playerctl from the command line. You may -you want to study the documentation. This script can be wrapped for purposes.

I use the following scripts (among other things):

skip: Leave for 10 seconds (or number of seconds given)

#!/bin/bash
playerctl position | perl -pe "\$_ = \$_ + ${1-10}" | xargs playerctl position; playerctl position

upside down: Leave 10 seconds ago (or the number of seconds given)

#!/bin/bash
skip ${1:--10}

pos: Return the position to the video

#!/bin/bash
playerctl position

yt position: Return a percentage through video

#!/bin/bash
length=$(playerctl metadata  | grep length | awk '{ print $3 }')
pos=$(playerctl position)
perl -e 'my ($a,$b) = @ARGV; print(int($a * 1000000 / $b * 100) . "%\n")' "$pos" "$length"

yt-link: Return the link to the video 10 seconds ago

#!/bin/bash
mozeidon tabs  get  | jq '.[] | .[] | select(.url | test("youtube\\.com")) | .url ' -rc | { read line ; echo $line\&t=$(playerctl position | perl -pe '$_ -= 10') ; }

I use this script (and other) to refer to the videos while taking obsidian notes. If you are interested in a note, you might want to read my review of the observations of the obsidian.

Alternatives

YTMDesktop is a YouTube desktop application that can be remotely controlled by HTTP. There is a risk that players such as Google stop working when they do not have a special caregiver.

You can download from YT-DLP from the media to download the media and play it as another player.

A shortcut to jump on the YouTube tab may be sufficient for your use. I have it in the past with a key simulation combination xdotool By interacting with a tab selection function and wmctrl To lift Windows. You can use Mozeidon to select tabs

It should be noted that the YouTube website offers a variety of social and recommendations that other approaches are not supported.

References

  1. yt-dlp
  2. mozeidon

About me

I am @REeadwithaiTo. Create tools for reading, researching and agencies, sometimes using Markdown Rediger Obsidian.

I also create a flow of tools related to my work.

I write about many things – including such tools – in X. My blog is more reading and research and the agency.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Adblocker Detected

Please consider supporting us by disabling your ad blocker