YouTube link information plugin for Sopel.
Releases are hosted on PyPI, so after installing Sopel, all you need is pip
:
$ pip install sopel-youtube
(Make sure you use the "correct" pip
, i.e. the one corresponding to the Python
environment where you have Sopel installed.)
You can simply pip uninstall sopel-modules.youtube
prior to installing this
package; no extra steps should be needed. sopel-youtube
inherits the
configuration section originally defined and used by the older versions.
If you want to help develop or test the plugin, you'll need to install from source. Clone the repo first, then:
$ pip install -e .
To run tests, make sure you have the development dependencies as well:
$ pip install -r dev-requirements.txt
Run the test suite from the repo root directory:
$ pytest -v .
- Go to the Google Cloud APIs & Services Console and create a new project for your bot (or select an existing one, if you prefer).
- Visit the API Library, find "YouTube Data API v3" (or click here), and enable it.
- Go to the Credentials section, click "+ Create Credentials", and choose "API key" from the menu. You can enter a name for the new key and limit the IPs it can be used from, but you don't have to.
- Copy the new key and paste it into the appropriate prompt in the config
wizard (see below), or the
api_key
field under[youtube]
in your bot's config file. - Optional: If the
⚠️ icon next to your new key in the Cloud Console annoys you, it changes to a checkmark if you restrict the key's access to only the API(s) it needs.
sopel-youtube
supports Sopel's interactive configuration wizard:
sopel-plugins configure youtube
The api_key
option is self-explanatory (see above for how to get one).
If video "watch" links contain a playlist ID, the plugin will show the
playlist info as well as the video info by default. To disable this, set
playlist_watch
to False
.
For videos, by default, only the video length, uploader (channel name), view
count, and upload date are shown. The included items, and the order in which
they appear, depend on the info_items
setting, which is a list of keywords.
Unrecognized keywords are simply ignored. Supported info_items
are:
comments
(comment count)date
(upload time/date)length
(duration)likes
(count)uploader
(channel name)views
(view count)