@@ -1,7 +1,7 @@ | |||||
<%include file="/support/header.mako" args="environ=environ, title='Copyvio Detector', add_css=('copyvios.css',), add_js=('copyvios.js',)"/>\ | <%include file="/support/header.mako" args="environ=environ, title='Copyvio Detector', add_css=('copyvios.css',), add_js=('copyvios.js',)"/>\ | ||||
<%namespace module="toolserver.copyvios" import="main, highlight_delta"/>\ | <%namespace module="toolserver.copyvios" import="main, highlight_delta"/>\ | ||||
<%namespace module="toolserver.misc" import="urlstrip"/>\ | <%namespace module="toolserver.misc" import="urlstrip"/>\ | ||||
<% lang, project, name, title, url, site, page, result = main(environ) %> | |||||
<% lang, orig_lang, project, title, url, bot, page, result = main(environ) %> | |||||
<h1>Copyvio Detector</h1> | <h1>Copyvio Detector</h1> | ||||
<p>This tool attempts to detect <a href="//en.wikipedia.org/wiki/WP:COPYVIO">copyright violations</a> in articles. Simply give the title of the page you want to check and hit Submit. The tool will then search for its content elsewhere on the web and display a report if a similar webpage is found. If you also provide a URL, it will not query any search engines and instead display a report comparing the article to that particular webpage, like the <a href="//toolserver.org/~dcoetzee/duplicationdetector/">Duplication Detector</a>. Check out the <a href="//en.wikipedia.org/wiki/User:EarwigBot/Copyvios/FAQ">FAQ</a> for more information and technical details.</p> | <p>This tool attempts to detect <a href="//en.wikipedia.org/wiki/WP:COPYVIO">copyright violations</a> in articles. Simply give the title of the page you want to check and hit Submit. The tool will then search for its content elsewhere on the web and display a report if a similar webpage is found. If you also provide a URL, it will not query any search engines and instead display a report comparing the article to that particular webpage, like the <a href="//toolserver.org/~dcoetzee/duplicationdetector/">Duplication Detector</a>. Check out the <a href="//en.wikipedia.org/wiki/User:EarwigBot/Copyvios/FAQ">FAQ</a> for more information and technical details.</p> | ||||
<form action="${environ['PATH_INFO']}" method="get"> | <form action="${environ['PATH_INFO']}" method="get"> | ||||
@@ -9,9 +9,8 @@ from ..sites import get_site, get_sites | |||||
def main(context, environ): | def main(context, environ): | ||||
lang = orig_lang = project = name = title = url = None | lang = orig_lang = project = name = title = url = None | ||||
site = page = result = None | |||||
# Parse the query string. | |||||
# Parse the query string: | |||||
query = parse_qs(environ["QUERY_STRING"]) | query = parse_qs(environ["QUERY_STRING"]) | ||||
if "lang" in query: | if "lang" in query: | ||||
lang = orig_lang = query["lang"][0].decode("utf8").lower() | lang = orig_lang = query["lang"][0].decode("utf8").lower() | ||||
@@ -26,9 +25,10 @@ def main(context, environ): | |||||
bot = Bot(".earwigbot") | bot = Bot(".earwigbot") | ||||
all_langs, all_projects = get_sites(bot) | all_langs, all_projects = get_sites(bot) | ||||
page = result = None | |||||
if lang and project and title: | if lang and project and title: | ||||
site = get_site(bot, lang, project, name, all_projects) | site = get_site(bot, lang, project, name, all_projects) | ||||
if site: | if site: | ||||
page, result = get_results(bot, site, title, url, query) | page, result = get_results(bot, site, title, url, query) | ||||
return lang, project, name, title, url, site, page, result | |||||
return lang, orig_lang, project, title, url, bot, page, result |