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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <%! from flask import g, request %>\
  2. <%include file="/support/header.mako" args="title='Earwig\'s Copyvio Detector'"/>
  3. <%namespace module="copyvios.highlighter" import="highlight_delta"/>\
  4. <%namespace module="copyvios.misc" import="httpsfix, urlstrip"/>\
  5. % if query.project and query.lang and (query.title or query.oldid):
  6. % if query.error == "bad URI":
  7. <div id="info-box" class="red-box">
  8. <p>Unsupported URI scheme: <a href="${query.url | h}">${query.url | h}</a>.</p>
  9. </div>
  10. % elif query.error == "no data":
  11. <div id="info-box" class="red-box">
  12. <p>Couldn't find any text in <a href="${query.url | h}">${query.url | h}</a>. <i>Note:</i> only HTML and plain text pages are supported, and content generated by JavaScript or found inside iframes is ignored.</p>
  13. </div>
  14. % elif not query.site:
  15. <div id="info-box" class="red-box">
  16. <p>The given site (project=<b><span class="mono">${query.project | h}</span></b>, language=<b><span class="mono">${query.lang | h}</span></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>
  17. </div>
  18. % elif query.title and not result:
  19. <div id="info-box" class="red-box">
  20. <p>The given page doesn't seem to exist: <a href="${query.page.url}">${query.page.title | h}</a>.</p>
  21. </div>
  22. % elif query.oldid and not result:
  23. <div id="info-box" class="red-box">
  24. <p>The given revision ID doesn't seem to exist: <a href="//${query.site.domain | h}/w/index.php?oldid=${query.oldid | h}">${query.oldid | h}</a>. <i>Note:</i> searching by revision IDs isn't supported just yet, but it will be soon. Sorry for the inconvenience!</p>
  25. </div>
  26. % endif
  27. %endif
  28. <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 or ID of the revision you want to check and hit Submit. The tool will search for similar content elsewhere on the web using <a href="//info.yahoo.com/legal/us/yahoo/boss/pricing/">Yahoo! BOSS</a> and then display a report if a match is found. If you give a URL, it will skip the search engine step and directly display a report comparing the article to that particular webpage, like the <a href="//toolserver.org/~dcoetzee/duplicationdetector/">Duplication Detector</a>.</p>
  29. <p>Specific websites can be excluded from the check (for example, if their content is in the public domain) by being added to the <a href="//en.wikipedia.org/wiki/User:EarwigBot/Copyvios/Exclusions">excluded URL list</a>.</p>
  30. <form action="${request.script_root}" method="get">
  31. <table id="cv-form">
  32. <tr>
  33. <td>Site:</td>
  34. <td colspan="3">
  35. <span class="mono">http://</span>
  36. <select name="lang">
  37. <% selected_lang = query.orig_lang if query.orig_lang else g.cookies["CopyviosDefaultLang"].value if "CopyviosDefaultLang" in g.cookies else g.bot.wiki.get_site().lang %>\
  38. % for code, name in query.all_langs:
  39. % if code == selected_lang:
  40. <option value="${code | h}" selected="selected">${name}</option>
  41. % else:
  42. <option value="${code | h}">${name}</option>
  43. % endif
  44. % endfor
  45. </select>
  46. <span class="mono">.</span>
  47. <select name="project">
  48. <% selected_project = query.project if query.project else g.cookies["CopyviosDefaultProject"].value if "CopyviosDefaultProject" in g.cookies else g.bot.wiki.get_site().project %>\
  49. % for code, name in query.all_projects:
  50. % if code == selected_project:
  51. <option value="${code | h}" selected="selected">${name}</option>
  52. % else:
  53. <option value="${code | h}">${name}</option>
  54. % endif
  55. % endfor
  56. </select>
  57. <span class="mono">.org</span>
  58. </td>
  59. </tr>
  60. <tr>
  61. <td id="cv-col1">Page&nbsp;title:</td>
  62. <td id="cv-col2">
  63. % if query.page:
  64. <input class="cv-text" type="text" name="title" value="${query.page.title | h}" />
  65. % elif query.title:
  66. <input class="cv-text" type="text" name="title" value="${query.title | h}" />
  67. % else:
  68. <input class="cv-text" type="text" name="title" />
  69. % endif
  70. </td>
  71. <td id="cv-col3">or&nbsp;revision&nbsp;ID:</td>
  72. <td id="cv-col4">
  73. % if query.oldid:
  74. <input class="cv-text" type="text" name="oldid" value="${query.oldid | h}" />
  75. % else:
  76. <input class="cv-text" type="text" name="oldid" />
  77. % endif
  78. </td>
  79. </tr>
  80. <tr>
  81. <td>URL&nbsp;(optional):</td>
  82. <td colspan="3">
  83. % if query.url:
  84. <input class="cv-text" type="text" name="url" value="${query.url | h}" />
  85. % else:
  86. <input class="cv-text" type="text" name="url" />
  87. % endif
  88. </td>
  89. </tr>
  90. % if query.nocache or (result and result.cached):
  91. <tr>
  92. <td>Bypass&nbsp;cache:</td>
  93. <td colspan="3">
  94. % if query.nocache:
  95. <input type="checkbox" name="nocache" value="1" checked="checked" />
  96. % else:
  97. <input type="checkbox" name="nocache" value="1" />
  98. % endif
  99. </td>
  100. </tr>
  101. % endif
  102. <tr>
  103. <td colspan="4">
  104. <button type="submit">Submit</button>
  105. </td>
  106. </tr>
  107. </table>
  108. </form>
  109. % if result:
  110. <% show_details = "CopyviosShowDetails" in g.cookies and g.cookies["CopyviosShowDetails"].value == "True" %>
  111. <div class="divider"></div>
  112. <div id="cv-result" class="${'red' if result.violation else 'green'}-box">
  113. % if result.violation:
  114. <h2 id="cv-result-header"><a href="${query.page.url}">${query.page.title | h}</a> is a suspected violation of <a href="${result.url | h}">${result.url | urlstrip, h}</a>.</h2>
  115. % else:
  116. <h2 id="cv-result-header">No violations detected in <a href="${query.page.url}">${query.page.title | h}</a>.</h2>
  117. % endif
  118. <ul id="cv-result-list">
  119. % if not result.violation and not query.url:
  120. % if result.url:
  121. <li>Best match: <a href="${result.url | h}">${result.url | urlstrip, h}</a>.</li>
  122. % else:
  123. <li>No matches found.</li>
  124. % endif
  125. % endif
  126. <li><b><span class="mono">${round(result.confidence * 100, 1)}%</span></b> confidence of a violation.</li>
  127. % if result.cached:
  128. <li>Results are <a id="cv-cached" href="#">cached
  129. <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>
  130. </a> from ${result.cache_time} (${result.cache_age} ago). <a href="${request.url | httpsfix, h}&amp;nocache=1">Bypass the cache.</a></li>
  131. % else:
  132. <li>Results generated in <span class="mono">${round(result.time, 3)}</span> seconds using <span class="mono">${result.queries}</span> queries.</li>
  133. % endif
  134. <li><a id="cv-result-detail-link" href="#cv-result-detail" onclick="copyvio_toggle_details()">${"Hide" if show_details else "Show"} details:</a></li>
  135. </ul>
  136. <div id="cv-result-detail" style="display: ${'block' if show_details else 'none'};">
  137. <ul id="cv-result-detail-list">
  138. <li>Trigrams: <i>Article:</i> <span class="mono">${result.article_chain.size()}</span> / <i>Source:</i> <span class="mono">${result.source_chain.size()}</span> / <i>Delta:</i> <span class="mono">${result.delta_chain.size()}</span></li>
  139. % if result.cached:
  140. % if result.queries:
  141. <li>Retrieved from cache in <span class="mono">${round(result.time, 3)}</span> seconds (originally generated in <span class="mono">${round(result.original_time, 3)}</span>s using <span class="mono">${result.queries}</span> queries; <span class="mono">${round(result.original_time - result.time, 3)}</span>s saved).</li>
  142. % else:
  143. <li>Retrieved from cache in <span class="mono">${round(result.time, 3)}</span> seconds (originally generated in <span class="mono">${round(result.original_time, 3)}</span>s; <span class="mono">${round(result.original_time - result.time, 3)}</span>s saved).</li>
  144. % endif
  145. % endif
  146. % if result.queries:
  147. <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>
  148. % endif
  149. </ul>
  150. <table id="cv-chain-table">
  151. <tr>
  152. <td class="cv-chain-cell">Article: <div class="cv-chain-detail"><p>${highlight_delta(result.article_chain, result.delta_chain)}</p></div></td>
  153. <td class="cv-chain-cell">Source: <div class="cv-chain-detail"><p>${highlight_delta(result.source_chain, result.delta_chain)}</p></div></td>
  154. </tr>
  155. </table>
  156. </div>
  157. </div>
  158. % endif
  159. <%include file="/support/footer.mako"/>