A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

index.mako 21 KiB

il y a 10 ans
il y a 7 ans
il y a 10 ans
il y a 10 ans
il y a 3 ans
il y a 3 ans
il y a 4 ans
il y a 3 ans
il y a 4 ans
il y a 3 ans
il y a 3 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <%!
  2. from flask import g, request
  3. from copyvios.attribution import get_attribution_info
  4. from copyvios.checker import T_POSSIBLE, T_SUSPECT
  5. from copyvios.misc import cache
  6. %>\
  7. <%
  8. titleparts = []
  9. if query.page:
  10. titleparts.append(query.page.title)
  11. titleparts.append("Earwig's Copyvio Detector")
  12. title = " | ".join(titleparts)
  13. %>\
  14. <%include file="/support/header.mako" args="title=title, splash=not result"/>
  15. <%namespace module="copyvios.highlighter" import="highlight_delta"/>\
  16. <%namespace module="copyvios.misc" import="httpsfix, urlstrip"/>\
  17. % if notice:
  18. <div id="notice-box" class="gray-box">
  19. ${notice}
  20. </div>
  21. % endif
  22. % if query.submitted:
  23. % if query.error:
  24. <div id="info-box" class="red-box"><p>
  25. % if query.error == "bad action":
  26. Unknown action: <b><span class="mono">${query.action | h}</span></b>.
  27. % elif query.error == "no search method":
  28. No copyvio search methods were selected. A check can only be made using the search engine, links present in the page, Turnitin, or some combination of these.
  29. % elif query.error == "bad oldid":
  30. The revision ID <code>${query.oldid | h}</code> is invalid. It should be an integer.
  31. % elif query.error == "no URL":
  32. Compare 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.
  33. % elif query.error == "bad URI":
  34. Unsupported URI scheme: <a href="${query.url | h}">${query.url | h}</a>.
  35. % elif query.error == "no data":
  36. Couldn't find any text in <a href="${query.url | h}">${query.url | h}</a>. <i>Note:</i> only HTML documents, plain text pages, and PDFs are supported, and content generated by JavaScript or found inside iframes is ignored.
  37. % elif query.error == "timeout":
  38. The URL <a href="${query.url | h}">${query.url | h}</a> timed out before any data could be retrieved.
  39. % elif query.error == "search error":
  40. An error occurred while using the search engine (${query.exception}). <i>Note:</i> there is a daily limit on the number of search queries the tool is allowed to make. You may <a href="${request.url | httpsfix, h}&amp;use_engine=0">repeat the check without using the search engine</a>.
  41. % else:
  42. An unknown error occurred.
  43. % endif
  44. </p></div>
  45. % elif not query.site:
  46. <div id="info-box" class="red-box">
  47. <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="https://${query.lang | h}.${query.project | h}.org/">Confirm its URL.</a></p>
  48. </div>
  49. % elif query.oldid and not result:
  50. <div id="info-box" class="red-box">
  51. <p>The revision ID couldn't be found: <a href="https://${query.site.domain | h}/w/index.php?oldid=${query.oldid | h}">${query.oldid | h}</a>.</p>
  52. </div>
  53. % elif query.title and not result:
  54. <div id="info-box" class="red-box">
  55. <p>The page couldn't be found: <a href="${query.page.url}">${query.page.title | h}</a>.</p>
  56. </div>
  57. % endif
  58. %endif
  59. <p>This tool attempts to detect <a href="https://en.wikipedia.org/wiki/WP:COPYVIO">copyright violations</a> in articles. In <i>search mode</i>, it will check for similar content elsewhere on the web using <a href="https://developers.google.com/custom-search/">Google</a>, external links present in the text of the page, or <a href="https://en.wikipedia.org/wiki/Wikipedia:Turnitin">Turnitin</a> (via <a href="https://en.wikipedia.org/wiki/User:EranBot">EranBot</a>), depending on which options are selected. In <i>compare mode</i>, the tool will compare the article to a specific webpage without making additional searches, like the <a href="https://dupdet.toolforge.org/">Duplication Detector</a>.</p>
  60. <p>Running a full check can take up to a minute if other websites are slow or if the tool is under heavy use. Please be patient. If you get a timeout, wait a moment and refresh the page.</p>
  61. <p>Be aware that other websites can copy from Wikipedia, so check the results carefully, especially for older or well-developed articles. Specific websites can be skipped by adding them to the <a href="https://en.wikipedia.org/wiki/User:EarwigBot/Copyvios/Exclusions">excluded URL list</a>.</p>
  62. <form id="cv-form" action="${request.script_root}/" method="get">
  63. <div class="oo-ui-layout oo-ui-horizontalLayout">
  64. <label class="site oo-ui-widget oo-ui-widget-enabled oo-ui-labelElement-label oo-ui-labelElement oo-ui-labelWidget">Site</label>
  65. <div class="oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-dropdownInputWidget oo-ui-dropdownInputWidget-php">
  66. <select name="lang" required="" class="oo-ui-inputWidget-input oo-ui-indicator-down" title="Language">
  67. <% selected_lang = query.orig_lang if query.orig_lang else g.cookies["CopyviosDefaultLang"].value if "CopyviosDefaultLang" in g.cookies else cache.bot.wiki.get_site().lang %>\
  68. % for code, name in cache.langs:
  69. % if code == selected_lang:
  70. <option value="${code | h}" selected="selected">${name}</option>
  71. % else:
  72. <option value="${code | h}">${name}</option>
  73. % endif
  74. % endfor
  75. </select>
  76. </div>
  77. <div class="oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-dropdownInputWidget oo-ui-dropdownInputWidget-php">
  78. <select name="project" required="" class="oo-ui-inputWidget-input oo-ui-indicator-down" title="Project">
  79. <% selected_project = query.project if query.project else g.cookies["CopyviosDefaultProject"].value if "CopyviosDefaultProject" in g.cookies else cache.bot.wiki.get_site().project %>\
  80. % for code, name in cache.projects:
  81. % if code == selected_project:
  82. <option value="${code | h}" selected="selected">${name}</option>
  83. % else:
  84. <option value="${code | h}">${name}</option>
  85. % endif
  86. % endfor
  87. </select>
  88. </div>
  89. </div>
  90. <div class="oo-ui-layout oo-ui-horizontalLayout">
  91. <label for="cv-title" class="page oo-ui-widget oo-ui-widget-enabled oo-ui-labelElement-label oo-ui-labelElement oo-ui-labelWidget">Page</label>
  92. <div class="page-title oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-textInputWidget oo-ui-textInputWidget-type-text oo-ui-textInputWidget-php">
  93. <input id="cv-title" type="text" class="oo-ui-inputWidget-input" name="title" placeholder="Title" title="Page title"
  94. % if query.title:
  95. value="${query.page.title if query.page else query.title | h}"
  96. % endif
  97. >
  98. </div>
  99. <label class="oo-ui-widget oo-ui-widget-enabled oo-ui-labelElement-label oo-ui-labelElement oo-ui-labelWidget">or</label>
  100. <div class="page-oldid oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-textInputWidget oo-ui-textInputWidget-type-text oo-ui-textInputWidget-php">
  101. <input id="cv-oldid" type="text" class="oo-ui-inputWidget-input" name="oldid" placeholder="Revision ID" title="Revision ID"
  102. % if query.oldid:
  103. value="${query.oldid | h}"
  104. % endif
  105. >
  106. </div>
  107. </div>
  108. <div class="oo-ui-layout oo-ui-horizontalLayout">
  109. <span class="oo-ui-widget oo-ui-widget-enabled">
  110. <span class="oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-radioInputWidget">
  111. <input id="action-search" class="oo-ui-inputWidget-input" type="radio" name="action" value="search" ${'checked="checked"' if (query.action == "search" or not query.action) else ""}><span></span>
  112. </span>
  113. <label for="action-search" class="action oo-ui-widget oo-ui-widget-enabled oo-ui-labelElement-label oo-ui-labelElement oo-ui-labelWidget">Copyvio search</label>
  114. </span>
  115. <input type="hidden" name="use_engine" value="0">
  116. <span class="oo-ui-widget oo-ui-widget-enabled">
  117. <span class="cv-search-oo-ui oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-checkboxInputWidget">
  118. <input id="cv-cb-engine" class="cv-search oo-ui-inputWidget-input" type="checkbox" name="use_engine" value="1" ${'checked="checked"' if query.use_engine not in ("0", "false") else ""}>
  119. <span class="oo-ui-checkboxInputWidget-checkIcon oo-ui-widget oo-ui-widget-enabled oo-ui-iconElement-icon oo-ui-icon-check oo-ui-iconElement oo-ui-labelElement-invisible oo-ui-iconWidget oo-ui-image-invert"></span>
  120. </span>
  121. <label for="cv-cb-engine" class="oo-ui-widget oo-ui-widget-enabled oo-ui-labelElement-label oo-ui-labelElement oo-ui-labelWidget">Use search engine</label>
  122. </span>
  123. <input type="hidden" name="use_links" value="0">
  124. <span class="oo-ui-widget oo-ui-widget-enabled">
  125. <span class="cv-search-oo-ui oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-checkboxInputWidget">
  126. <input id="cv-cb-links" class="cv-search oo-ui-inputWidget-input" type="checkbox" name="use_links" value="1" ${'checked="checked"' if query.use_links not in ("0", "false") else ""}>
  127. <span class="oo-ui-checkboxInputWidget-checkIcon oo-ui-widget oo-ui-widget-enabled oo-ui-iconElement-icon oo-ui-icon-check oo-ui-iconElement oo-ui-labelElement-invisible oo-ui-iconWidget oo-ui-image-invert"></span>
  128. </span>
  129. <label for="cv-cb-links" class="oo-ui-widget oo-ui-widget-enabled oo-ui-labelElement-label oo-ui-labelElement oo-ui-labelWidget">Use links in page</label>
  130. </span>
  131. <input type="hidden" name="turnitin" value="0">
  132. <span class="oo-ui-widget oo-ui-widget-enabled">
  133. <span class="cv-search-oo-ui oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-checkboxInputWidget">
  134. <input id="cv-cb-turnitin" class="cv-search oo-ui-inputWidget-input" type="checkbox" name="turnitin" value="1" ${'checked="checked"' if query.turnitin in ("1", "true") else ""}>
  135. <span class="oo-ui-checkboxInputWidget-checkIcon oo-ui-widget oo-ui-widget-enabled oo-ui-iconElement-icon oo-ui-icon-check oo-ui-iconElement oo-ui-labelElement-invisible oo-ui-iconWidget oo-ui-image-invert"></span>
  136. </span>
  137. <label for="cv-cb-turnitin" class="oo-ui-widget oo-ui-widget-enabled oo-ui-labelElement-label oo-ui-labelElement oo-ui-labelWidget">Use Turnitin</label>
  138. </span>
  139. </div>
  140. <div class="oo-ui-layout oo-ui-horizontalLayout">
  141. <span class="oo-ui-widget oo-ui-widget-enabled">
  142. <span class="oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-radioInputWidget">
  143. <input id="action-compare" class="oo-ui-inputWidget-input" type="radio" name="action" value="compare" ${'checked="checked"' if query.action == "compare" else ""}><span></span>
  144. </span>
  145. <label for="action-compare" class="action oo-ui-widget oo-ui-widget-enabled oo-ui-labelElement-label oo-ui-labelElement oo-ui-labelWidget">Copyvio compare</label>
  146. </span>
  147. <div class="compare-url cv-compare-oo-ui oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-textInputWidget oo-ui-textInputWidget-type-text oo-ui-textInputWidget-php">
  148. <input type="text" class="cv-compare oo-ui-inputWidget-input" name="url" placeholder="URL" title="URL to compare"
  149. % if query.url:
  150. value="${query.url | h}"
  151. % endif
  152. >
  153. </div>
  154. </div>
  155. % if query.nocache or (result and result.cached):
  156. <div class="oo-ui-layout oo-ui-horizontalLayout">
  157. <span class="cv-search-oo-ui oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-checkboxInputWidget">
  158. <input id="cb-nocache" class="oo-ui-inputWidget-input" type="checkbox" name="nocache" value="1" ${'checked="checked"' if query.nocache else ""}>
  159. <span class="oo-ui-checkboxInputWidget-checkIcon oo-ui-widget oo-ui-widget-enabled oo-ui-iconElement-icon oo-ui-icon-check oo-ui-iconElement oo-ui-labelElement-invisible oo-ui-iconWidget oo-ui-image-invert"></span>
  160. </span>
  161. <label for="cb-nocache">Bypass cache</label>
  162. </div>
  163. % endif
  164. <div class="oo-ui-layout oo-ui-horizontalLayout">
  165. <span class="oo-ui-widget oo-ui-widget-enabled oo-ui-buttonElement oo-ui-buttonElement-framed oo-ui-labelElement oo-ui-flaggedElement-primary oo-ui-flaggedElement-progressive oo-ui-buttonWidget">
  166. <button type="submit" class="oo-ui-inputWidget-input oo-ui-buttonElement-button">
  167. <span class="oo-ui-labelElement-label">Submit</span>
  168. </button>
  169. </span>
  170. </div>
  171. </form>
  172. % if result:
  173. <div id="generation-time">
  174. Results
  175. % if result.cached:
  176. <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 URLs of the checked sources, but neither their 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>. Originally
  177. % endif
  178. generated in <span class="mono">${round(result.time, 3)}</span>
  179. % if query.action == "search":
  180. seconds using <span class="mono">${result.queries}</span> quer${"y" if result.queries == 1 else "ies"}.
  181. % else:
  182. seconds.
  183. % endif
  184. <a href="${request.script_root | h}/?lang=${query.lang | h}&amp;project=${query.project | h}&amp;oldid=${query.oldid or query.page.lastrevid | h}&amp;action=${query.action | h}&amp;${"use_engine={0}&use_links={1}".format(int(query.use_engine not in ("0", "false")), int(query.use_links not in ("0", "false"))) if query.action == "search" else "" | h}${"url=" if query.action == "compare" else ""}${query.url if query.action == "compare" else "" | u}">Permalink.</a>
  185. </div>
  186. <div id="cv-result" class="${'red' if result.confidence >= T_SUSPECT else 'yellow' if result.confidence >= T_POSSIBLE else 'green'}-box">
  187. <table id="cv-result-head-table">
  188. <colgroup>
  189. <col>
  190. <col>
  191. <col>
  192. </colgroup>
  193. <tr>
  194. <td>
  195. <a href="${query.page.url}">${query.page.title | h}</a>
  196. % if query.oldid:
  197. @<a href="https://${query.site.domain | h}/w/index.php?oldid=${query.oldid | h}">${query.oldid | h}</a>
  198. % endif
  199. % if query.redirected_from:
  200. <br />
  201. <span id="redirected-from">Redirected from <a href="https://${query.site.domain | h}/w/index.php?title=${query.redirected_from.title | u}&amp;redirect=no">${query.redirected_from.title | h}</a>. <a href="${request.url | httpsfix, h}&amp;noredirect=1">Check original.</a></span>
  202. % endif
  203. </td>
  204. <td>
  205. <div>
  206. % if result.confidence >= T_SUSPECT:
  207. Violation suspected
  208. % elif result.confidence >= T_POSSIBLE:
  209. Violation possible
  210. % elif result.sources:
  211. Violation unlikely
  212. % else:
  213. No violation
  214. % endif
  215. </div>
  216. <div>${round(result.confidence * 100, 1)}%</div>
  217. <div>similarity</div>
  218. </td>
  219. <td>
  220. % if result.url:
  221. <a href="${result.url | h}">${result.url | urlstrip, h}</a>
  222. % else:
  223. <span id="result-head-no-sources">No matches found.</span>
  224. % endif
  225. </td>
  226. </tr>
  227. </table>
  228. </div>
  229. <% attrib = get_attribution_info(query.site, query.page) %>
  230. % if attrib:
  231. <div id="attribution-warning" class="yellow-box">
  232. This article contains an attribution template: <code>{{<a href="${attrib[1]}">${attrib[0] | h}</a>}}</code>. Please verify that any potential copyvios are not from properly attributed sources.
  233. </div>
  234. % endif
  235. % if query.turnitin_result:
  236. <div id="turnitin-container" class="${'red' if query.turnitin_result.reports else 'green'}-box">
  237. <div id="turnitin-title">Turnitin Results</div>
  238. % if query.turnitin_result.reports:
  239. <table id="turnitin-table"><tbody>
  240. % for report in turnitin_result.reports:
  241. <tr><td class="turnitin-table-cell"><a href="https://eranbot.toolforge.org/ithenticate.py?rid=${report.reportid}">Report ${report.reportid}</a> for text added at <a href="https://${query.lang}.wikipedia.org/w/index.php?title=${query.title}&amp;diff=${report.diffid}"> ${report.time_posted.strftime("%H:%M, %d %B %Y (UTC)")}</a>:
  242. <ul>
  243. % for source in report.sources:
  244. <li>${source['percent']}% of revision text (${source['words']} words) found at <a href="${source['url'] | h}">${source['url'] | h}</a></li>
  245. % endfor
  246. </ul></td></tr>
  247. % endfor
  248. </tbody></table>
  249. % else:
  250. <div id="turnitin-summary">No matching sources found.</div>
  251. % endif
  252. </div>
  253. % endif
  254. % if query.action == "search":
  255. <% skips = False %>
  256. <div id="sources-container">
  257. <div id="sources-title">Checked Sources</div>
  258. % if result.sources:
  259. <table id="cv-result-sources">
  260. <colgroup>
  261. <col>
  262. <col>
  263. <col>
  264. </colgroup>
  265. <tr>
  266. <th>URL</th>
  267. <th>Similarity</th>
  268. <th>Compare</th>
  269. </tr>
  270. % for i, source in enumerate(result.sources):
  271. <tr ${'class="source-default-hidden"' if i >= 10 else 'id="source-row-selected"' if i == 0 else ""}>
  272. <td><a ${'id="source-selected"' if i == 0 else ""} class="source-url" href="${source.url | h}">${source.url | h}</a></td>
  273. <td>
  274. % if source.excluded:
  275. <span class="source-excluded">Excluded</span>
  276. % elif source.skipped:
  277. <% skips = True %>
  278. <span class="source-skipped">Skipped</span>
  279. % else:
  280. <span class="source-similarity ${"source-suspect" if source.confidence >= T_SUSPECT else "source-possible" if source.confidence >= T_POSSIBLE else "source-novio"}">${round(source.confidence * 100, 1)}%</span>
  281. % endif
  282. </td>
  283. <td>
  284. <a href="${request.script_root | h}/?lang=${query.lang | h}&amp;project=${query.project | h}&amp;oldid=${query.oldid or query.page.lastrevid | h}&amp;action=compare&amp;url=${source.url | u}">Compare</a>
  285. </td>
  286. </tr>
  287. % endfor
  288. </table>
  289. % else:
  290. <div class="cv-source-footer">
  291. No sources checked.
  292. </div>
  293. % endif
  294. % if len(result.sources) > 10:
  295. <div id="cv-additional" class="cv-source-footer">
  296. ${len(result.sources) - 10} URL${"s" if len(result.sources) > 11 else ""} with lower similarity hidden. <a id="show-additional-sources" href="#">Show them.</a>
  297. </div>
  298. % endif
  299. % if skips or result.possible_miss:
  300. <div class="cv-source-footer">
  301. The search ended early because a match was found with high similarity. <a href="${request.url | httpsfix, h}&amp;noskip=1">Do a complete check.</a>
  302. </div>
  303. % endif
  304. </div>
  305. % endif
  306. <table id="cv-chain-table">
  307. <tr>
  308. <td class="cv-chain-cell">Article: <div class="cv-chain-detail"><p>${highlight_delta(result.article_chain, result.best.chains[1] if result.best else None)}</p></div></td>
  309. <td class="cv-chain-cell">Source: <div class="cv-chain-detail"><p>${highlight_delta(result.best.chains[0], result.best.chains[1]) if result.best else ""}</p></div></td>
  310. </tr>
  311. </table>
  312. % endif
  313. <%include file="/support/footer.mako"/>