enable calling youtube.py from cli

This commit is contained in:
jan6 2022-08-23 14:11:47 +00:00
parent d5f6f0a7bc
commit 03e3980d10
1 changed files with 8 additions and 2 deletions

View File

@ -8,7 +8,7 @@ class YouTube:
def mesg(self, msg, t=None):
self.util.mesg(msg, t)
def match_urls(self,str):
def match_urls(self, str):
r = [
i
for i in str.split()
@ -19,7 +19,7 @@ class YouTube:
or "https://www.youtube.com/embed/" in i
or "https://www.youtube-nocookie.com/embed/" in i
]
r=list(dict.fromkeys(r))
r = list(dict.fromkeys(r))
return r
def is_embed(str):
@ -81,3 +81,9 @@ class YouTube:
ansi_string = f"[\x1b[32mYoutube\x1b[0m] \x1b[1m{y['name']}\x1b[0m ({y['duration']}) uploaded by \x1b[03m{y['channelName']}\x1b[0m on {y['uploadDate']}"
print(ansi_string)
return irc_string
if __name__ == "__main__":
import sys
YouTube.yt(YouTube, sys.argv[1])