diff --git a/copyvios/api.py b/copyvios/api.py index d11c19f..1d803dd 100644 --- a/copyvios/api.py +++ b/copyvios/api.py @@ -37,6 +37,7 @@ def _serialize_source(source, show_skip=True): )) if show_skip: data["skipped"] = source.skipped + data["excluded"] = source.excluded return data def format_api_error(code, info): diff --git a/templates/api.mako b/templates/api.mako index 27ace7c..c55ae35 100644 --- a/templates/api.mako +++ b/templates/api.mako @@ -193,8 +193,8 @@ "meta": { "time": float time to generate results, in seconds, "queries": int number of search engine queries made, - "cached": boolean whether or not these results are cached from an earlier search (always false in the case of action=compare), - "redirected": boolean whether or not a redirect was followed, + "cached": boolean whether these results are cached from an earlier search (always false in the case of action=compare), + "redirected": boolean whether a redirect was followed, only if cached=true "cache_time": string human-readable time of the original search that the results are cached from }, "page": { @@ -215,12 +215,13 @@ "url": string the URL of the source, "confidence": float the confidence of a violation in the source, "violation": string one of "suspected", "possible", or "none", - "skipped": boolean whether or not the source was skipped due to the check finishing early (see note about noskip above) + "skipped": boolean whether the source was skipped due to the check finishing early (see note about noskip above), + "excluded": boolean whether the source was skipped for being in the excluded URL list ("skipped" will also be true in this case, even when using noskip) }, ... ] } -

In the case of action=search, sources will contain one entry for each source checked (or skipped if the check ends early), sorted in order of confidence, with skipped sources at the bottom.

+

In the case of action=search, sources will contain one entry for each source checked (or skipped if the check ends early), sorted in order of confidence, with skipped and excluded sources at the bottom.

In the case of action=compare, best will always contain information about the URL that was given, so response["best"]["url"] will never be null. Also, sources will always contain one entry, with the same data as best, since only one source is checked in comparison mode.

Valid responses for action=sites are formatted like this:

{
@@ -246,7 +247,7 @@
                     
  • Requests are typically not rate-limited, but the tool uses the same workers to handle all requests, so making simultaneous API calls is only going to slow you down. In general, you are fine making an unlimited number of requests, as long as they are not concurrent and you wait a few seconds between them.
  • Example

    -

    https://tools.wmflabs.org/copyvios/api.json?version=1&action=search&project=wikipedia&lang=en&title=User:The_Earwig/Sandbox/CopyvioExample

    +

    https://tools.wmflabs.org/copyvios/api.json?version=1&action=search&project=wikipedia&lang=en&title=User:EarwigBot/Copyvios/Tests/2

    {
         "status": "ok",
         "meta": {
    @@ -256,8 +257,8 @@
             "redirected": false
         },
         "page": {
    -        "title": "User:The Earwig/Sandbox/CopyvioExample",
    -        "url": "https://en.wikipedia.org/wiki/User:The_Earwig/Sandbox/CopyvioExample"
    +        "title": "User:EarwigBot/Copyvios/Tests/2",
    +        "url": "https://en.wikipedia.org/wiki/User:EarwigBot/Copyvios/Tests/2"
         },
         "best": {
             "url": "http://www.whitehouse.gov/administration/president-obama/",
    @@ -269,31 +270,36 @@
                 "url": "http://www.whitehouse.gov/administration/president-obama/",
                 "confidence": 0.9886608511242603,
                 "violation": "suspected",
    -            "skipped": false
    +            "skipped": false,
    +            "excluded": false
             },
             {
                 "url": "http://maige2009.blogspot.com/2013/07/barack-h-obama-is-44th-president-of.html",
                 "confidence": 0.9864798816568047,
                 "violation": "suspected",
    -            "skipped": false
    +            "skipped": false,
    +            "excluded": false
             },
             {
                 "url": "http://jeuxdemonstre-apkdownload.rhcloud.com/luo-people-of-kenya-and-tanzania---wikipedia--the-free",
                 "confidence": 0.0,
                 "violation": "none",
    -            "skipped": false
    +            "skipped": false,
    +            "excluded": false
             },
             {
                 "url": "http://www.whitehouse.gov/about/presidents/barackobama",
                 "confidence": 0.0,
                 "violation": "none",
    -            "skipped": true
    +            "skipped": true,
    +            "excluded": false
             },
             {
                 "url": "http://jeuxdemonstre-apkdownload.rhcloud.com/president-barack-obama---the-white-house",
                 "confidence": 0.0,
                 "violation": "none",
    -            "skipped": true
    +            "skipped": true,
    +            "excluded": false
             }
         ]
     }