diff options
Diffstat (limited to 'http')
-rw-r--r-- | http/index.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/http/index.py b/http/index.py index 4bccde5..9ba0371 100644 --- a/http/index.py +++ b/http/index.py @@ -68,7 +68,7 @@ def handler(req): return apache.OK # we need to sanitize line breaks and double-closed anchors manually - remote_content = bs4('<body>' + ' '.join(remote_content[delimiters[0]+1:delimiters[1]]).replace('<BR>', '<br />').replace('</a></a>', '</a>') + '</body>', 'html.parser') + remote_content = bs4('<div>' + ' '.join(remote_content[delimiters[0]+1:delimiters[1]]).replace('<BR>', '<br />').replace('</a></a>', '</a>') + '</div>', 'html.parser') # stub template for output page page_content = bs4(''' <html><head> @@ -80,7 +80,7 @@ def handler(req): </style> </head><body></body></html> ''', 'html.parser') - page_content.html.body.append(remote_content.body) + page_content.html.body.append(remote_content.div) # internal links being rewritten to application links for link in page_content.select('a[href^="?p=21&pid="]'): @@ -119,6 +119,10 @@ def handler(req): for element in page_content.select(selector): link = element.wrap(page_content.new_tag('a')) link['href'] = search_url + + # credits info + credits_div = bs4('<div style="position:absolute;top:250px;width:130px;left:460px;opacity:0.02">Pomysł Ivana,<br />Ivan jest zajebisty.</div>', 'html.parser', from_encoding='utf-8') + page_content.html.body.div.append(credits_div.div) req.content_type = 'text/html' req.write(page_content.prettify('utf-8')) |