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.
 
 
 
 
 

143 line
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. <p><i>Note:</i> The tool is still in its earliest beta stages. You are completely welcome to use it and provide <a href="//en.wikipedia.org/wiki/User_talk:The_Earwig">feedback</a>, but be aware that it may produce strange or broken results.</p>
  22. <form action="${environ['PATH_INFO']}" method="get">
  23. <table>
  24. <tr>
  25. <td>Site:</td>
  26. <td>
  27. <tt>http://</tt>
  28. <select name="lang">
  29. <% selected_lang = query.orig_lang if query.orig_lang else cookies["EarwigDefaultLang"].value if "EarwigDefaultLang" in cookies else bot.wiki.get_site().lang %>\
  30. % for code, name in all_langs:
  31. % if code == selected_lang:
  32. <option value="${code | h}" selected="selected">${name}</option>
  33. % else:
  34. <option value="${code | h}">${name}</option>
  35. % endif
  36. % endfor
  37. </select>
  38. <tt>.</tt>
  39. <select name="project">
  40. <% selected_project = query.project if query.project else cookies["EarwigDefaultProject"].value if "EarwigDefaultProject" in cookies else bot.wiki.get_site().project %>\
  41. % for code, name in all_projects:
  42. % if code == selected_project:
  43. <option value="${code | h}" selected="selected">${name}</option>
  44. % else:
  45. <option value="${code | h}">${name}</option>
  46. % endif
  47. % endfor
  48. </select>
  49. <tt>.org</tt>
  50. </td>
  51. </tr>
  52. <tr>
  53. <td>Page title:</td>
  54. % if page:
  55. <td><input type="text" name="title" size="60" value="${page.title | h}" /></td>
  56. % elif query.title:
  57. <td><input type="text" name="title" size="60" value="${query.title | h}" /></td>
  58. % else:
  59. <td><input type="text" name="title" size="60" /></td>
  60. % endif
  61. </tr>
  62. <tr>
  63. <td>URL (optional):</td>
  64. % if query.url:
  65. <td><input type="text" name="url" size="120" value="${query.url | h}" /></td>
  66. % else:
  67. <td><input type="text" name="url" size="120" /></td>
  68. % endif
  69. </tr>
  70. % if query.nocache or (result and result.cached):
  71. <tr>
  72. <td>Bypass cache:</td>
  73. % if query.nocache:
  74. <td><input type="checkbox" name="nocache" value="1" checked="checked" /></td>
  75. % else:
  76. <td><input type="checkbox" name="nocache" value="1" /></td>
  77. % endif
  78. </tr>
  79. % endif
  80. <tr>
  81. <td><button type="submit">Submit</button></td>
  82. </tr>
  83. </table>
  84. </form>
  85. % if page and result:
  86. <div class="divider"></div>
  87. <div id="cv-result-${'yes' if result.violation else 'no'}">
  88. % if result.violation:
  89. <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>
  90. % else:
  91. <h2 id="cv-result-header">No violations detected in <a href="${page.url}">${page.title | h}</a>.</h2>
  92. % endif
  93. <ul id="cv-result-list">
  94. % if not result.violation and not query.url:
  95. % if result.url:
  96. <li>Best match: <a href="${result.url | h}">${result.url | urlstrip, h}</a>.</li>
  97. % else:
  98. <li>No matches found.</li>
  99. % endif
  100. % endif
  101. <li><b><tt>${round(result.confidence * 100, 1)}%</tt></b> confidence of a violation.</li>
  102. % if result.cached:
  103. <li>Results are <a id="cv-cached" href="#">cached
  104. <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>
  105. </a> from ${result.cache_time} (${result.cache_age} ago). <a href="${environ['REQUEST_URI'] | h}&amp;nocache=1">Bypass the cache.</a></li>
  106. % else:
  107. <li>Results generated in <tt>${round(result.time, 3)}</tt> seconds using <tt>${result.queries}</tt> queries.</li>
  108. % endif
  109. % if "EarwigCVShowDetails" in cookies and cookies["EarwigCVShowDetails"].value == "True":
  110. <li><a id="cv-result-detail-link" href="#cv-result-detail" onclick="copyvio_toggle_details()">Hide details:</a></li>
  111. % else:
  112. <li><a id="cv-result-detail-link" href="#cv-result-detail" onclick="copyvio_toggle_details()">Show details:</a></li>
  113. % endif
  114. </ul>
  115. % if "EarwigCVShowDetails" in cookies and cookies["EarwigCVShowDetails"].value == "True":
  116. <div id="cv-result-detail" style="display: block;">
  117. % else:
  118. <div id="cv-result-detail" style="display: none;">
  119. % endif
  120. <ul id="cv-result-detail-list">
  121. <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>
  122. % if result.cached:
  123. % if result.queries:
  124. <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>
  125. % else:
  126. <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>
  127. % endif
  128. % endif
  129. % if result.queries:
  130. <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>
  131. % endif
  132. </ul>
  133. <table id="cv-chain-table">
  134. <tr>
  135. <td class="cv-chain-cell">Article: <div class="cv-chain-detail"><p>${highlight_delta(result.article_chain, result.delta_chain)}</p></div></td>
  136. <td class="cv-chain-cell">Source: <div class="cv-chain-detail"><p>${highlight_delta(result.source_chain, result.delta_chain)}</p></div></td>
  137. </tr>
  138. </table>
  139. </div>
  140. </div>
  141. % endif
  142. <%include file="/support/footer.mako" args="environ=environ, cookies=cookies"/>