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.
 
 
 
 
 

138 lines
10 KiB

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