From 87a11881a4f980e7b17e3aa51251272ce358e44c Mon Sep 17 00:00:00 2001 From: spathi-wa Date: Wed, 9 Oct 2013 04:56:34 +0530 Subject: [PATCH] plugins/twitter: added hook.regex for twitter URLs Also minor changes in output formatting --- plugins/twitter.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/twitter.py b/plugins/twitter.py index 4d2f848..49e7c76 100644 --- a/plugins/twitter.py +++ b/plugins/twitter.py @@ -77,4 +77,9 @@ def twitter(inp, api_key=None): time = strftime('%Y-%m-%d %H:%M:%S', strptime(time, '%a %b %d %H:%M:%S +0000 %Y')) - return "%s %s: %s" % (time, screen_name, text) + return "%s \x02%s\x02: %s" % (time, screen_name, text) + +@hook.api_key('twitter') +@hook.regex(r'https?://twitter.com/(#!/)?([_0-9a-zA-Z]+)/status/(\d+)') +def show_tweet(match, api_key=None): + return twitter(match.group(3),api_key)