A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

133 lines
9.6 KiB

  1. <%include file="/support/header.mako" args="environ=environ, title='Copyvio Detector', add_css=('copyvios.css',), add_js=('copyvios.js',)"/>\
  2. <%namespace module="toolserver.copyvios" import="main, highlight_delta"/>\
  3. <%namespace module="toolserver.cookies" import="parse_cookies"/>\
  4. <%namespace module="toolserver.misc" import="urlstrip"/>\
  5. <% query, bot, all_langs, all_projects, page, result = main(environ) %>
  6. <% cookies = parse_cookies(environ) %>
  7. <h1>Copyvio Detector</h1>
  8. <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>
  9. <form action="${environ['PATH_INFO']}" method="get">
  10. <table>
  11. <tr>
  12. <td>Site:</td>
  13. <td>
  14. <tt>http://</tt>
  15. <select name="lang">
  16. <% selected_lang = query.orig_lang if query.orig_lang else cookies["EarwigDefaultLang"].value if "EarwigDefaultLang" in cookies else bot.wiki.get_site().lang %>
  17. % for code, name in all_langs:
  18. % if code == selected_lang:
  19. <option value="${code}" selected="selected">${name}</option>
  20. % else:
  21. <option value="${code}">${name}</option>
  22. % endif
  23. % endfor
  24. </select>
  25. <tt>.</tt>
  26. <select name="project">
  27. <% selected_project = query.project if query.project else cookies["EarwigDefaultProject"].value if "EarwigDefaultProject" in cookies else bot.wiki.get_site().project %>
  28. % for code, name in all_projects:
  29. % if code == selected_project:
  30. <option value="${code}" selected="selected">${name}</option>
  31. % else:
  32. <option value="${code}">${name}</option>
  33. % endif
  34. % endfor
  35. </select>
  36. <tt>.org</tt>
  37. </td>
  38. </tr>
  39. <tr>
  40. <td>Page title:</td>
  41. % if page:
  42. <td><input type="text" name="title" size="60" value="${page.title | h}" /></td>
  43. % elif query.title:
  44. <td><input type="text" name="title" size="60" value="${query.title | h}" /></td>
  45. % else:
  46. <td><input type="text" name="title" size="60" /></td>
  47. % endif
  48. </tr>
  49. <tr>
  50. <td>URL (optional):</td>
  51. % if query.url:
  52. <td><input type="text" name="url" size="120" value="${query.url | h}" /></td>
  53. % else:
  54. <td><input type="text" name="url" size="120" /></td>
  55. % endif
  56. </tr>
  57. % if query.nocache or (result and result.cached):
  58. <tr>
  59. <td>Bypass cache:</td>
  60. % if query.nocache:
  61. <td><input type="checkbox" name="nocache" value="1" checked="checked" /></td>
  62. % else:
  63. <td><input type="checkbox" name="nocache" value="1" /></td>
  64. % endif
  65. </tr>
  66. % endif
  67. <tr>
  68. <td><button type="submit">Submit</button></td>
  69. </tr>
  70. </table>
  71. </form>
  72. % if query.project and query.lang and query.title and not page:
  73. <div class="divider"></div>
  74. <div class="red-box">
  75. <p>The given site (project=<b><tt>${query.project}</tt></b>, language=<b><tt>${query.lang}</tt></b>) doesn't seem to exist. It may also be closed or private. <a href="//${query.lang}.${query.project}.org/">Confirm its URL.</a></p>
  76. </div>
  77. % elif query.project and query.lang and query.title and page and not result:
  78. <div class="divider"></div>
  79. <div class="red-box">
  80. <p>The given page doesn't seem to exist: <a href="${page.url}">${page.title | h}</a>.</p>
  81. </div>
  82. % elif page:
  83. <div class="divider"></div>
  84. <div id="cv-result-${'yes' if result.violation else 'no'}">
  85. % if result.violation:
  86. <h2 id="cv-result-header"><a href="${page.url}">${page.title | h}</a> is a suspected violation of <a href="${result.url | h}">${result.url | urlstrip}</a>.</h2>
  87. % else:
  88. <h2 id="cv-result-header">No violations detected in <a href="${page.url()}">${page.title | h}</a>.</h2>
  89. % endif
  90. <ul id="cv-result-list">
  91. <li><b><tt>${round(result.confidence * 100, 1)}%</tt></b> confidence of a violation.</li>
  92. % if result.cached:
  93. <li>Results are <a id="cv-cached" href="#">cached
  94. <span>To save time (and money), this tool will retain the results of checks for up to 72 hours. This includes the URL of the "violated" source, but neither its content nor the content of the article. Future checks on the same page (assuming it remains unchanged) will not involve additional search queries, but a fresh comparison against the source URL will be made. If the page is modified, a new check will be run.</span>
  95. </a> from ${result.cache_time} (${result.cache_age} ago). <a href="${environ['REQUEST_URI'].decode("utf8") | h}&amp;nocache=1">Bypass the cache.</a></li>
  96. % else:
  97. <li>Results generated in <tt>${round(result.tdiff, 3)}</tt> seconds using <tt>${result.queries}</tt> queries.</li>
  98. % endif
  99. % if "EarwigCVShowDetails" in cookies and cookies["EarwigCVShowDetails"].value == "True":
  100. <li><a id="cv-result-detail-link" href="#cv-result-detail" onclick="copyvio_toggle_details()">Hide details:</a></li>
  101. % else:
  102. <li><a id="cv-result-detail-link" href="#cv-result-detail" onclick="copyvio_toggle_details()">Show details:</a></li>
  103. % endif
  104. </ul>
  105. % if "EarwigCVShowDetails" in cookies and cookies["EarwigCVShowDetails"].value == "True":
  106. <div id="cv-result-detail" style="display: block;">
  107. % else:
  108. <div id="cv-result-detail" style="display: none;">
  109. % endif
  110. <ul id="cv-result-detail-list">
  111. <li>Trigrams: <i>Article:</i> <tt>${result.article_chain.size()}</tt> / <i>Source:</i> <tt>${result.source_chain.size()}</tt> / <i>Delta:</i> <tt>${result.delta_chain.size()}</tt></li>
  112. % if result.cached:
  113. % if result.queries:
  114. <li>Retrieved from cache in <tt>${round(result.tdiff, 3)}</tt> seconds (originally generated in <tt>${round(result.original_tdiff, 3)}</tt>s using <tt>${result.queries}</tt> queries; <tt>${round(result.original_tdiff - result.tdiff, 3)}</tt>s saved).</li>
  115. % else:
  116. <li>Retrieved from cache in <tt>${round(result.tdiff, 3)}</tt> seconds (originally generated in <tt>${round(result.original_tdiff, 3)}</tt>s; <tt>${round(result.original_tdiff - result.tdiff, 3)}</tt>s saved).</li>
  117. % endif
  118. % endif
  119. % if result.queries:
  120. <li><i>Fun fact:</i> The Wikimedia Foundation paid Yahoo! Inc. <a href="http://info.yahoo.com/legal/us/yahoo/search/bosspricing/details.html">$${result.queries * 0.0008} USD</a> for these results.</li>
  121. % endif
  122. </ul>
  123. <table id="cv-chain-table">
  124. <tr>
  125. <td>Article: <div class="cv-chain-detail"><p>${highlight_delta(result.article_chain, result.delta_chain)}</p></div></td>
  126. <td>Source: <div class="cv-chain-detail"><p>${highlight_delta(result.source_chain, result.delta_chain)}</p></div></td>
  127. </tr>
  128. </table>
  129. </div>
  130. </div>
  131. % endif
  132. <%include file="/support/footer.mako" args="environ=environ"/>