summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xplugins/youtube14
1 files changed, 8 insertions, 6 deletions
diff --git a/plugins/youtube b/plugins/youtube
index 48fa824..65f7ce1 100755
--- a/plugins/youtube
+++ b/plugins/youtube
@@ -51,8 +51,11 @@ if youtube_api_key == "":
print ("ZYKLONB register")
-re_link_1 = re.compile ('youtube\\.[a-z]+/[^ ]*[&?]v=([-_A-Za-z0-9]+)')
-re_link_2 = re.compile ('youtu\\.be/([-_A-Za-z0-9]+)')
+regexes = map (lambda x: re.compile (x), [
+ 'youtube\\.[a-z]+/[^ ]*[&?]v=([-_A-Za-z0-9]+)',
+ 'youtube\\.[a-z]+/v/([-_A-Za-z0-9]+)',
+ 'youtu\\.be/([-_A-Za-z0-9]+)'
+])
def print_video_info (channel, video_id):
global youtube_api_key
@@ -88,7 +91,6 @@ for line in sys.stdin:
if not ctx.startswith (('#', '+', '&', '!')):
ctx = nick
- for i in re_link_1.findall (args[1]):
- print_video_info (ctx, i)
- for i in re_link_2.findall (args[1]):
- print_video_info (ctx, i)
+ for regex in regexes:
+ for i in regex.findall (args[1]):
+ print_video_info (ctx, i)