A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

200 linhas
12 KiB

  1. <%!
  2. from flask import g, request
  3. from copyvios.checker import T_POSSIBLE, T_SUSPECT
  4. %>\
  5. <%include file="/support/header.mako" args="title='Earwig\'s Copyvio Detector'"/>
  6. <%namespace module="copyvios.highlighter" import="highlight_delta"/>\
  7. <%namespace module="copyvios.misc" import="httpsfix, urlstrip"/>\
  8. % if query.submitted:
  9. % if query.error == "bad action":
  10. <div id="info-box" class="red-box">
  11. <p>Unknown action: <b><span class="mono">${query.action | h}</span></b>.</p>
  12. </div>
  13. % elif query.error == "no URL":
  14. <div id="info-box" class="red-box">
  15. <p>URL comparison mode requires a URL to be entered. Enter one in the text box below, or choose copyvio search mode to look for content similar to the article elsewhere on the web.</p>
  16. </div>
  17. % elif query.error == "bad URI":
  18. <div id="info-box" class="red-box">
  19. <p>Unsupported URI scheme: <a href="${query.url | h}">${query.url | h}</a>.</p>
  20. </div>
  21. % elif query.error == "no data":
  22. <div id="info-box" class="red-box">
  23. <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>
  24. </div>
  25. % elif query.error == "timeout":
  26. <div id="info-box" class="red-box">
  27. <p>The URL <a href="${query.url | h}">${query.url | h}</a> timed out before any data could be retrieved.</p>
  28. </div>
  29. % elif not query.site:
  30. <div id="info-box" class="red-box">
  31. <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>
  32. </div>
  33. % elif query.title and not result:
  34. <div id="info-box" class="red-box">
  35. <p>The given page doesn't seem to exist: <a href="${query.page.url}">${query.page.title | h}</a>.</p>
  36. </div>
  37. % elif query.oldid and not result:
  38. <div id="info-box" class="red-box">
  39. <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>.</p>
  40. </div>
  41. % endif
  42. %endif
  43. <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="//developer.yahoo.com/boss/search/">Yahoo! BOSS</a> and then display a report if a match is found. If you give a specific URL, it will skip the search engine step and directly display a report comparing the article to that particular webpage, like the <a href="//tools.wmflabs.org/dupdet/">Duplication Detector</a>.</p>
  44. <p>Running a full check can take up to 45 seconds if other websites are slow. Please be patient. If you get a timeout, wait a moment and refresh the page.</p>
  45. <p>Specific websites can be skipped (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>
  46. <form action="${request.script_root}" method="get">
  47. <table id="cv-form">
  48. <tr>
  49. <td>Site:</td>
  50. <td colspan="3">
  51. <span class="mono">https://</span>
  52. <select name="lang">
  53. <% 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 %>\
  54. % for code, name in query.all_langs:
  55. % if code == selected_lang:
  56. <option value="${code | h}" selected="selected">${name}</option>
  57. % else:
  58. <option value="${code | h}">${name}</option>
  59. % endif
  60. % endfor
  61. </select>
  62. <span class="mono">.</span>
  63. <select name="project">
  64. <% selected_project = query.project if query.project else g.cookies["CopyviosDefaultProject"].value if "CopyviosDefaultProject" in g.cookies else g.bot.wiki.get_site().project %>\
  65. % for code, name in query.all_projects:
  66. % if code == selected_project:
  67. <option value="${code | h}" selected="selected">${name}</option>
  68. % else:
  69. <option value="${code | h}">${name}</option>
  70. % endif
  71. % endfor
  72. </select>
  73. <span class="mono">.org</span>
  74. </td>
  75. </tr>
  76. <tr>
  77. <td id="cv-col1">Page&nbsp;title:</td>
  78. <td id="cv-col2">
  79. % if query.title:
  80. <input class="cv-text" type="text" name="title" value="${query.page.title if query.page else query.title | h}" />
  81. % else:
  82. <input class="cv-text" type="text" name="title" />
  83. % endif
  84. </td>
  85. <td id="cv-col3">or&nbsp;revision&nbsp;ID:</td>
  86. <td id="cv-col4">
  87. % if query.oldid:
  88. <input class="cv-text" type="text" name="oldid" value="${query.oldid | h}" />
  89. % else:
  90. <input class="cv-text" type="text" name="oldid" />
  91. % endif
  92. </td>
  93. </tr>
  94. <tr>
  95. <td>Action:</td>
  96. <td colspan="3">
  97. <table id="cv-form-inner">
  98. <tr>
  99. <td id="cv-inner-col1">
  100. <input id="action-search" type="radio" name="action" value="search" ${'checked="checked"' if (query.action == "search" or not query.action) else ""} />
  101. </td>
  102. <td id="cv-inner-col2"><label for="action-search">Copyvio&nbsp;search:</label></td>
  103. <td id="cv-inner-col3">
  104. <input id="cv-cb-engine" type="checkbox" name="use_engine" value="1" ${'checked="checked"' if (query.use_engine or not query.submitted) else ""} />
  105. <label for"cv-cb-engine">Use&nbsp;search&nbsp;engine</label>
  106. <input id="cv-cb-links" type="checkbox" name="use_links" value="1" ${'checked="checked"' if (query.use_links or not query.submitted) else ""} />
  107. <label for="cv-cb-links">Use&nbsp;links&nbsp;in&nbsp;page</label>
  108. </td>
  109. </tr>
  110. <tr>
  111. <td>
  112. <input id="action-compare" type="radio" name="action" value="compare" ${'checked="checked"' if query.action == "compare" else ""} />
  113. </td>
  114. <td><label for="action-compare">URL&nbsp;comparison:</label></td>
  115. <td>
  116. <input id="url-box" class="cv-text" type="text" name="url"
  117. % if query.url:
  118. value="${query.url | h}"
  119. % endif
  120. />
  121. </td>
  122. </tr>
  123. </table>
  124. </td>
  125. </tr>
  126. % if query.nocache or (result and result.cached):
  127. <tr>
  128. <td><label for="cb-nocache">Bypass&nbsp;cache:</label></td>
  129. <td colspan="3">
  130. <input id="cb-nocache" type="checkbox" name="nocache" value="1" ${'checked="checked"' if query.nocache else ""} />
  131. </td>
  132. </tr>
  133. % endif
  134. <tr>
  135. <td colspan="4">
  136. <button type="submit">Submit</button>
  137. </td>
  138. </tr>
  139. </table>
  140. </form>
  141. % if result:
  142. <% hide_comparison = "CopyviosHideComparison" in g.cookies and g.cookies["CopyviosHideComparison"].value == "True" %>
  143. <div id="cv-result" class="${'red' if result.confidence >= T_SUSPECT else 'yellow' if result.confidence >= T_POSSIBLE else 'green'}-box">
  144. <h2 id="cv-result-header">
  145. % if result.confidence >= T_POSSIBLE:
  146. <a href="${query.page.url}">${query.page.title | h}</a>
  147. % if query.oldid:
  148. @<a href="//${query.site.domain | h}/w/index.php?oldid=${query.oldid | h}">${query.oldid | h}</a>
  149. % endif
  150. is a ${"suspected" if result.confidence >= T_SUSPECT else "possible"} violation of <a href="${result.url | h}">${result.url | urlstrip, h}</a>.
  151. % else:
  152. % if query.oldid:
  153. No violations detected in <a href="${query.page.url}">${query.page.title | h}</a> @<a href="//${query.site.domain | h}/w/index.php?oldid=${query.oldid | h}">${query.oldid | h}</a>.
  154. % else:
  155. No violations detected in <a href="${query.page.url}">${query.page.title | h}</a>.
  156. % endif
  157. % endif
  158. </h2>
  159. </div>
  160. <ul id="cv-result-list">
  161. % if result.confidence < T_POSSIBLE and query.action == "search":
  162. % if result.url:
  163. <li>Best match: <a href="${result.url | h}">${result.url | urlstrip, h}</a>.</li>
  164. % else:
  165. <li>No matches found.</li>
  166. % endif
  167. % endif
  168. % if result.url:
  169. <li><b><span class="mono">${round(result.confidence * 100, 1)}%</span></b> confidence of a violation.</li>
  170. % endif
  171. % if query.redirected_from:
  172. <li>Redirected from <a href="${query.redirected_from.url}">${query.redirected_from.title | h}</a>. <a href="${request.url | httpsfix, h}&amp;noredirect=1">Check the original page.</a></li>
  173. % endif
  174. % if result.cached:
  175. <li>
  176. Results are <a id="cv-cached" href="#">cached<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></a> from <abbr title="${result.cache_time}">${result.cache_age} ago</abbr>. Retrieved in <span class="mono">${round(result.time, 3)}</span> seconds (originally generated in
  177. % if result.queries:
  178. <span class="mono">${round(result.original_time, 3)}</span>s using <span class="mono">${result.queries}</span> queries).
  179. % else:
  180. <span class="mono">${round(result.original_time, 3)}</span>s).
  181. % endif
  182. <a href="${request.url | httpsfix, h}&amp;nocache=1">Bypass the cache.</a>
  183. </li>
  184. % else:
  185. <li>Results generated in <span class="mono">${round(result.time, 3)}</span> seconds using <span class="mono">${result.queries}</span> queries.</li>
  186. % endif
  187. % if result.queries:
  188. <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>
  189. % endif
  190. <li><a id="cv-chain-link" href="#cv-chain-table" onclick="copyvio_toggle_details()">${"Show" if hide_comparison else "Hide"} comparison:</a></li>
  191. </ul>
  192. <table id="cv-chain-table" style="display: ${'none' if hide_comparison else 'table'};">
  193. <tr>
  194. <td class="cv-chain-cell">Article: <div class="cv-chain-detail"><p>${highlight_delta(result.article_chain, result.delta_chain)}</p></div></td>
  195. <td class="cv-chain-cell">Source: <div class="cv-chain-detail"><p>${highlight_delta(result.source_chain, result.delta_chain)}</p></div></td>
  196. </tr>
  197. </table>
  198. % endif
  199. <%include file="/support/footer.mako"/>