youtube: use list comprehensions

This commit is contained in:
Přemysl Eric Janouch 2015-06-22 19:29:11 +02:00
parent d7dd296b61
commit d2611d3f82
1 changed files with 4 additions and 4 deletions

View File

@ -35,14 +35,14 @@ class Plugin:
print ('ZYKLONB print :%s' % what) print ('ZYKLONB print :%s' % what)
class YouTube (Plugin): class YouTube (Plugin):
re_videos = list (map (lambda x: re.compile (x), [ re_videos = [re.compile (x) for x in [
r'youtube\.[a-z]+/[^ ]*[&?]v=([-\w]+)', r'youtube\.[a-z]+/[^ ]*[&?]v=([-\w]+)',
r'youtube\.[a-z]+/v/([-\w]+)', r'youtube\.[a-z]+/v/([-\w]+)',
r'youtu\.be/([-\w]+)' r'youtu\.be/([-\w]+)'
])) ]]
re_playlists = list (map (lambda x: re.compile (x), [ re_playlists = [re.compile (x) for x in [
r'youtube\.[a-z]+/playlist[&?][^ ]*(?<=&|\?)list=([-\w]+)', r'youtube\.[a-z]+/playlist[&?][^ ]*(?<=&|\?)list=([-\w]+)',
])) ]]
def print_info (self, channel, url, cb): def print_info (self, channel, url, cb):
try: try: