From 762a3822f7393492cce8bd71e4d05c8d51de1a41 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 10 May 2017 03:40:58 +0100 Subject: [PATCH] Sets title from read one. --- wrp.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/wrp.py b/wrp.py index e8d1d00..355b7c8 100755 --- a/wrp.py +++ b/wrp.py @@ -240,8 +240,13 @@ if sys.platform == "linux" or sys.platform == "linux2": % (__version__)) httpout.write("\n" % (WebkitRenderer.req_url, web_url)) - httpout.write("WRP%s:%s\n\n" - % (__version__, web_url)) + httpout.write("") + # Get title + for ttl in frame.findAllElements('title'): + httpout.write((u"%s" + % ttl.toPlainText()).encode('utf-8', errors='ignore')) + break # Don't repeat bad HTML coding with several title marks + httpout.write("\n\n") if ISMAP == "true": httpout.write("" @@ -535,8 +540,12 @@ elif sys.platform == "darwin": % (__version__)) httpout.write("\n" % (WebkitLoad.req_url, web_url)) - httpout.write("WRP%s:%s\n\n" - % (__version__, web_url)) + # Get title + for ttl in frame.findAllElements('title'): + httpout.write((u"%s" + % ttl.toPlainText()).encode('utf-8', errors='ignore')) + break # Don't repeat bad HTML coding with several title marks + httpout.write("\n\n") if ISMAP == "true": httpout.write("" "\"wrp-render\"\n"