chiark / gitweb /
Patch from adam to allow - in video URLs
authorMatthew Vernon <matthewv@chiark.greenend.org.uk>
Wed, 14 Sep 2016 10:37:16 +0000 (11:37 +0100)
committerMatthew Vernon <matthewv@chiark.greenend.org.uk>
Wed, 14 Sep 2016 10:37:16 +0000 (11:37 +0100)
commands.py

index cea3a2a..491ab3c 100755 (executable)
@@ -529,7 +529,7 @@ def getTweet(urlstring,twitapi,inclusion=False):
 
         for k,v in replacements.items():
 
-            v = [re.sub(r"/tweet_video_thumb/(\w+).jpg", r"/tweet_video/\1.mp4", link) for link in v]
+            v = [re.sub(r"/tweet_video_thumb/([\w\-]+).jpg", r"/tweet_video/\1.mp4", link) for link in v]
             if len(v) > 1:
                 replacementstring = "[" +  " ; ".join(v) +"]"
             else:
@@ -593,4 +593,5 @@ def getTweet(urlstring,twitapi,inclusion=False):
     stringout = "Error: %s" % terror[1].__str__()
   if inclusion:
       return stringout # don't want to double-encode it, so just pass it on for now and encode later
+  print stringout.encode('UTF-8', 'replace')
   return stringout.encode('UTF-8', 'replace')