Added .posted (local version)

This commit is contained in:
andreimarcu
2014-04-06 19:35:14 -04:00
parent 2da9ed09c1
commit a67113305c
3 changed files with 84 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ import urllib.parse
import time
from html.entities import name2codepoint
import web
from modules.posted import check_posted
from tools import deprecated
@@ -89,7 +90,7 @@ noteuri.priority = 'low'
def snarfuri(phenny, input):
uri = input.group(1)
title = gettitle(phenny, uri)
title = gettitle(phenny, input, uri)
if title:
phenny.msg(input.sender, title)
@@ -98,7 +99,7 @@ snarfuri.priority = 'low'
snarfuri.thread = True
def gettitle(phenny, uri):
def gettitle(phenny, input, uri):
if not ':' in uri:
uri = 'http://' + uri
uri = uri.replace('#!', '?_escaped_fragment_=')
@@ -179,10 +180,18 @@ def gettitle(phenny, uri):
title = title.replace('\n', '')
title = title.replace('\r', '')
title = "[ {0} ]".format(title)
if "posted" in phenny.variables:
posted = check_posted(phenny, input, uri)
if posted:
title = "{0} (posted: {1})".format(title, posted)
else:
title = None
return title
if __name__ == '__main__':
print(__doc__.strip())
print(__doc__.strip())