#!/usr/bin/env python3 # coding=utf-8 # YouTube Module for Drastikbot # # Search YouTube and return the resulting video. # When a YouTube url is posted return the video's information. # # If you are planning to use the url module or a url bot, consider adding the # following blacklist: ['youtu.be/', 'youtube.com/watch'] # # Depends: # - requests :: $ pip3 install requests # - beautifulsoup :: $ pip3 install beautifulsoup4 ''' Copyright (C) 2018-2020 drastik.org This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ''' import urllib.parse import json import requests import bs4 import url class Module: def __init__(self): self.commands = ['yt'] self.manual = { "desc": "Search YouTube and return the resulting video url.", "bot_commands": {"yt": {"usage": lambda x: f"{x}yt