Skip to main content

pytblocklib

Overview

( This project is under development. )
Pytblocklib is an library for blocking spam bots on YouTube.

Pytblocklib は、Youtubeのスパムボットのブロックを補助するライブラリです。
YouTube API設定不要、リスナー側のブロックにも対応しています。
詳細はwiki を参照してください。

  • YouTubeの仕様変更等により使用できなくなる場合があります。
  • 使用に際しては自己責任でお願いいたします。
  • LICENSE:LGPL-3.0

Description

Pytblocklibs's goal is to provide easy blocking operation on YT.
You can concentrate on thinking block algorithms.
Function around livechat is based on my pytchat script.

Features:

  • Functions focused on blocks, light weight, easy operation.
  • You can block as a listener. (not need to give or take moderator privileges)
  • No Scraping, no Selenium, no BeautifulSoup.

Install

pip install pytblocklib

Example

from pytblocklib import Watcher
import time

w = Watcher("video_id")

NG_WORDS = ['NG_WORD1','NG_WORD2']
blocklist = []

w.start()

#Start checking loop
while w.loop():
    #Get chat list from buffer
    chats = w.get_chats()

    for chat in chats:
        if any(ng_word in chat.message or ng_word in chat.author_name  
            for ng_word in NG_WORDS):
            print("Found :message-`{}` by {} ".format(
                chat.message, chat.author_name))
            #Block user by specifying author channel id.
            w.block(chat.author_id)
            blocklist.append(chat.author_id)

    time.sleep(3)

#Example: Unblock all blocked users (only available during executing script)
for author_id in blocklist:
    w.unblock(author_id)


w.stop()

Derived app

AutoBlocker by sayamame_beans

Compatible environment

  • Python 3.7.4 later
  • OS : Windows 10 / macOS Catalina / Ubuntu 18.04.2 LTS
  • Browser: Chrome v80 later / Firefox 75.0 later (requires browser cookie)

VS

Nightbot

  • Pros

    • Sophisticated user interface on browser, integrated functions.
    • Applicable for Twitch.
    • Various blocking setting (e.g. blacklist, excess emotes, repetitions)
  • Cons

    • Only srteamers can block spams on their broadcasting with moderator privileges, not per listener.

YouTube Studio

  • Pros

    • Official features.
    • Various blocking setting (e.g. specify channel id, prohibited words)
  • Cons

    • Only srteamers can block spams on their broadcasting with owner/moderator privileges, not per listener.

Pytblocklib

  • Pros

    • No need for YT API settings.
    • Simple - functions focused on blocking spams.
    • You can customize the blocking algorithm with a python script.
    • You can block spams as a listener. (not need to give or take moderator privileges)
  • Cons

    • Need to implement blocking procedures and user interface separately.
    • Less portability : requires python environment.

Using

This program uses a customized browser_cookie3 library.
The original copyright of browser_cookie 3 belongs to borisbabic :
https://github.com/borisbabic/browser_cookie3

LICENSE

GNU LESSER GENERAL PUBLIC LICENSE Version 3

Metadata

Release files for pytblocklib 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for pytblocklib 0.1.8
File Interpreter ABI Platform Actions
pytblocklib-0.1.8-py3-none-any.whl Python 3 none any Details for pytblocklib-0.1.8-py3-none-any.whl

Release files / pytblocklib-0.1.8-py3-none-any.whl

Download URL pytblocklib-0.1.8-py3-none-any.whl
Size 34.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0335339175ec82221bc3d3d0cdf8d65354712af13082c2100ef4b65cf7f6657b
BLAKE2b-256 checksum
How to use checksums
ab0d355ff4d3da85e0454964dd47e23909c908d556316f3801120949806e5daa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.4

Security for pytblocklib 0.1.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page