1
0
mirror of http://aero2k.de/t/repos/urlbot-native.git synced 2017-09-06 15:25:38 +02:00

remove provided URL from title extraction messages

This commit is contained in:
urlbot
2015-07-04 10:22:30 +02:00
parent c28af0ad69
commit d7948cf0ab

View File

@@ -56,7 +56,7 @@ def extract_title(url):
(code, html_text, headers) = fetch_page(url)
if 1 == code:
return (3, 'failed: %s for %s' % (html_text, url))
return (3, 'failed: %s' % html_text)
if html_text:
charset = ''
@@ -174,26 +174,26 @@ def extract_url(data, msg_obj):
if 0 == status:
title = title.strip()
message = 'Title: %s: %s' % (title, url)
message = 'Title: %s' % title
elif 1 == status:
if conf('image_preview'):
# of course it's fake, but it looks interesting at least
char = """,._-+=\|/*`~"'"""
message = 'No text but %s, 1-bit ASCII art preview: [%c] %s' % (
title, random.choice(char), url
message = 'No text but %s, 1-bit ASCII art preview: [%c]' % (
title, random.choice(char)
)
else:
log.info('no message sent for non-text %s (%s)' % (url, title))
continue
elif 2 == status:
message = 'No title: %s' % url
message = '(No title)'
elif 3 == status:
message = title
elif 4 == status:
message = 'Bug triggered (%s), invalid URL/domain part: %s' % (title, url)
log.warn(message)
else:
message = 'some error occurred when fetching %s' % url
message = 'some error occurred while fetching'
message = message.replace('\n', '\\n')