From c670ddc97e07c6cd0815e18da27219a2d853b697 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 7 Apr 2013 22:24:23 -0700 Subject: [PATCH 1/2] Allow https in videos. --- lib/markdown2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/markdown2.py b/lib/markdown2.py index 22bc979a..622654fc 100755 --- a/lib/markdown2.py +++ b/lib/markdown2.py @@ -2147,7 +2147,7 @@ class StreamingVideoUrlHandler(object): # 'height': 423 #}, 'veoh': { - 'regex': re.compile(r'([^(]|^)http://www\.veoh\.com/\S*(#watch%3D|watch/)(?P\w+)'), + 'regex': re.compile(r'([^(]|^)https?://www\.veoh\.com/\S*(#watch%3D|watch/)(?P\w+)'), 'stream_url': 'http://www.veoh.com/videodetails2.swf?permalinkId=%s', 'width': 410, 'height': 341 @@ -2172,7 +2172,7 @@ class StreamingVideoUrlHandler(object): # 'height': 322 #}, 'youtube': { - 'regex': re.compile(r'([^(]|^)http://www\.youtube\.com/watch\?\S*v=(?P[A-Za-z0-9_&=-]+)\S*'), + 'regex': re.compile(r'([^(]|^)https?://www\.youtube\.com/watch\?\S*v=(?P[A-Za-z0-9_&=-]+)\S*'), 'stream_url': 'http://www.youtube.com/v/%s', 'width': 425, 'height': 344 From 2ad4706350faab8279fdb391a0be52fc1760a8fa Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 7 Apr 2013 22:49:34 -0700 Subject: [PATCH 2/2] Use protocol from the provided link. --- lib/markdown2.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/markdown2.py b/lib/markdown2.py index 622654fc..e60ab3b9 100755 --- a/lib/markdown2.py +++ b/lib/markdown2.py @@ -2147,8 +2147,8 @@ class StreamingVideoUrlHandler(object): # 'height': 423 #}, 'veoh': { - 'regex': re.compile(r'([^(]|^)https?://www\.veoh\.com/\S*(#watch%3D|watch/)(?P\w+)'), - 'stream_url': 'http://www.veoh.com/videodetails2.swf?permalinkId=%s', + 'regex': re.compile(r'([^(]|^)(?Phttps?)://www\.veoh\.com/\S*(#watch%3D|watch/)(?P\w+)'), + 'stream_url': '%s://www.veoh.com/videodetails2.swf?permalinkId=%s', 'width': 410, 'height': 341 }, @@ -2172,8 +2172,8 @@ class StreamingVideoUrlHandler(object): # 'height': 322 #}, 'youtube': { - 'regex': re.compile(r'([^(]|^)https?://www\.youtube\.com/watch\?\S*v=(?P[A-Za-z0-9_&=-]+)\S*'), - 'stream_url': 'http://www.youtube.com/v/%s', + 'regex': re.compile(r'([^(]|^)(?Phttps?)://www\.youtube\.com/watch\?\S*v=(?P[A-Za-z0-9_&=-]+)\S*'), + 'stream_url': '%s://www.youtube.com/v/%s', 'width': 425, 'height': 344 }, @@ -2189,12 +2189,11 @@ def get_embed_video_xml(self, url): """ for data in self.providers.values(): m = data['regex'].match(url) - if m: - - get_params = data.get('get_params', lambda m: m.group('param')) + if m: if '%s' in data['stream_url']: - stream_url = data['stream_url'] % get_params(m) + params = tuple([m.group('protocol'), m.group('param')]) + stream_url = data['stream_url'] % params else: stream_url = data['stream_url']