diff options
Diffstat (limited to 'youtube_oembed_old.py')
-rwxr-xr-x | youtube_oembed_old.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/youtube_oembed_old.py b/youtube_oembed_old.py index 0d51e16..9719757 100755 --- a/youtube_oembed_old.py +++ b/youtube_oembed_old.py @@ -16,6 +16,7 @@ class YouTube: self.util.mesg(msg, t) def match_urls(self, str): + str = str.replace("http://", "https://") r = [ i for i in str.split() @@ -59,21 +60,19 @@ class YouTube: str = self else: str = str[0] - return str.startswith("https://youtube.com/shorts/") or str.startswith( - "https://www.youtube.com/shorts/" - ) + return str.startswith("https://youtube.com/shorts/") or str.startswith("https://www.youtube.com/shorts/") def is_clip(self, *str): if type(self) == type("a"): str = self else: str = str[0] - return str.startswith("https://youtube.com/clip/") or str.startswith( - "https://www.youtube.com/clip/" - ) + return str.startswith("https://youtube.com/clip/") or str.startswith("https://www.youtube.com/clip/") def yt(self, url): - irc_string = "[\x0304Youtube\x03] \x0307ERROR:\x0308 got no data from server! \x0315(check your URL for typos!)\x03" + irc_string = ( + "[\x0304Youtube\x03] \x0307ERROR:\x0308 got no data from server! \x0315(check your URL for typos!)\x03" + ) ansi_string = "[\x1b[31mYoutube\x1b[0m] \x1b[33;2mERROR:\x1b[33;1m got no data from server! \x1b[37;2m(check your URL for typos!)\x1b[0m" # self.util.mesg("dbg hello") url = url.rstrip("\x01") @@ -117,9 +116,7 @@ class YouTube: ansi_string = f"[\x1b[31mYoutube\x1b[0m] \x1b[33;2mERROR:\x1b[33;1m {e} \x1b[37;2m\x1b[0m" print(ansi_string) return irc_string, True - irc_string = ( - f"[\x0303Youtube\x03] \x02{title}\x02 uploaded by \x1d{channelName}\x1d" - ) + irc_string = f"[\x0303Youtube\x03] \x02{title}\x02 uploaded by \x1d{channelName}\x1d" ansi_string = f"[\x1b[32mYoutube\x1b[0m] \x1b[1m{title}\x1b[0m uploaded by \x1b[03m{channelName}\x1b[0m" print(ansi_string) return irc_string, False |