Skip to main content

Young YouTube library

Project description

yt_lib: Young YouTube library

yt_lib is the unofficial library for YouTube, which supports operations with likes, subscriptions, comments.

>>> from yt_lib import states
>>> from yt_lib import YoutubeClient
>>> client = YoutubeClient(cookies=cookies)
>>> client.init_session()
>>> client.subscribe('UCtinbF-Q-fVthA0qrFQTgXQ', states.SubscribeAction.SUBSCRIBE)
<ActResult.SUCCESS: 1>

Feature Support

The library begins to take its first steps, so the list is small.

  • Rates (like, dislikes and take back)
  • Subscriptions (and unsubscribes)
  • Writing comments

Installation

To install yt_lib, simply run this simple command in your terminal of choice:

$ pip install yt_lib

yt_lib is actively developed on GitHub, where the code is always available.

You can either clone the public repository:

$ git clone https://github.com/hairygeek/yt_lib.git

Quickstart

First make sure thar yt_lib is installed.

Let's get started with some simple examples.

Subscribes

Begin by importing the yt_lib and yt_lib.states modules:

>>> import yt_lib
>>> from yt_lib import states

Now let's create YouTubeClient, this requires youtube cookies. Cookies required to work: apisid, consent, hsid, login_info, pref, sapisid, sid, sidcc, ssid, visitor_info1_live. Imagine that we already have them:

>>> client = YoutubeClient(cookies=cookies)

Now let's initialize the session. Nothing will work without it:

>>> client.init_session()

Now we can subscribe to the channel. for this we need a type of subscription (unsubscribe / subscription), we will take it from the module states:

>>> client.subscribe('UCtinbF-Q-fVthA0qrFQTgXQ', states.SubscribeAction.SUBSCRIBE)
    <ActResult.SUCCESS: 1>

We got an response. In our case, this is SUCCESS, which means that the subscription was successful.

Rates

In the same way we can like:

>>> client.rate('V6Y-ahQFQDA', states.LikeAction.LIKE)
    <ActResult.SUCCESS: 1>

or dislike:

>>> client.rate('V6Y-ahQFQDA', states.LikeAction.DISLIKE)
    <ActResult.SUCCESS: 1>

or take action back:

>>> client.rate('V6Y-ahQFQDA', states.LikeAction.TAKE_BACK)
    <ActResult.SUCCESS: 1>

That's not all, but l'm too lazy to describe the rest. See the description of methods.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yt_lib-0.0.1.tar.gz (5.7 kB view details)

Uploaded Source

File details

Details for the file yt_lib-0.0.1.tar.gz.

File metadata

  • Download URL: yt_lib-0.0.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.1

File hashes

Hashes for yt_lib-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b651d3e7a2b6c2555560e70a1798baeef6a3b84d38a2b1046fb06c914b398182
MD5 a156f0e8be3318ae89a5e84ad34b83d1
BLAKE2b-256 92ae297ac23b6ebcf683b22524aeec1050657d8c8014e29502f12ae371246351

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page