A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

160 righe
9.8 KiB

  1. <%!
  2. from flask import g, request
  3. %>\
  4. <%include file="/support/header.mako" args="title='Earwig\'s Copyvio Detector'"/>
  5. <%namespace module="copyvios.highlighter" import="highlight_delta"/>\
  6. <%namespace module="copyvios.misc" import="urlstrip"/>\
  7. % if query.project and query.lang and (query.title or query.oldid):
  8. % if not query.site:
  9. <div id="info-box" class="red-box">
  10. <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>
  11. </div>
  12. % elif query.title and not result:
  13. <div id="info-box" class="red-box">
  14. <p>The given page doesn't seem to exist: <a href="${query.page.url}">${query.page.title | h}</a>.</p>
  15. </div>
  16. % elif query.oldid and not result:
  17. <div id="info-box" class="red-box">
  18. <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>
  19. </div>
  20. % elif query.url and result == "bad URI":
  21. <% result = None %>
  22. <div id="info-box" class="red-box">
  23. <p>Unsupported URI scheme: <a href="${query.url | h}">${query.url | h}</a>.</p>
  24. </div>
  25. % endif
  26. %endif
  27. <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>
  28. <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>
  29. <p><i>Note:</i> The tool is still in beta. 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>
  30. <form action="${request.base_url}" 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 query.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 query.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 | 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"/>