chevron_left chevron_right
Login Register invert_colors photo_library

Stay updated and chat with others! - Join the Discord!

Youtube Module filter_list
Youtube Module #1
I did not create this. I merely found it on the internet and cleaned it up a bit. I am also not a professional Python programmer so as far as the cleaning goes there may or may not be tiny errors.

Okay, so I found a Youtube module on the internets but it was a little unorganized. It was fine but needed some cleaning if you will. Probably my OCD talking. Here's my fix:

from urllib.request import urlopen
import re

class YoutubeException(Exception):

def tag_regex_construct(tag):
    return re.compile(r"<%s ?[^>]*>(.*?)</%s>" % (tag,tag), re.IGNORECASE | re.DOTALL )

title_re = tag_regex_construct("title")
desc_re  = tag_regex_construct("content")
auth_re  = tag_regex_construct("name")

class Video:
    def __init__(self,vid,update = True):
        self.vid = vid
        if(update): self.update()

    def update(self):
        resp = urlopen(self.get_api_link())
            data       =
            self.title =
                self.desc =
                self.desc = "No description available."
            self.auth  =
            raise YoutubeException("Video ID seems invalid.")

    def get_api_link(self):
        return "" % (self.vid)

    def get_id(self):
        return self.vid

    def get_title(self):
        return self.title

    def get_desc(self):
        return self.desc

    def get_auth(self):
        return self.auth

Duubz, the fuck is this shit used for?

I don't fucking know, maybe a bot. Intellect uses it. Jump off my dick.


Users browsing this thread: 1 Guest(s)