Page MenuHomePhabricator

Help Copyvio Detector migrate to a new API
Closed, ResolvedPublic8 Estimated Story Points

Description

Now that we're losing access to Yahoo's index, we need to migrate existing copyvio tools to using a different API.

Tool: http://tools.wmflabs.org/copyvios/

Event Timeline

DannyH created this task.Mar 29 2016, 5:28 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 29 2016, 5:28 PM
kaldari updated the task description. (Show Details)Mar 29 2016, 5:29 PM
DannyH set the point value for this task to 8.Mar 29 2016, 5:30 PM
DannyH triaged this task as Medium priority.Mar 29 2016, 5:39 PM
kaldari added a subscriber: Earwig.Apr 2 2016, 5:22 PM
kaldari added a subscriber: kaldari.Apr 2 2016, 5:57 PM

The authorization for the new API is done through a basic authorization header passed as part of the API request.

In PHP this would be implemented something like:

$accountKey = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';
$webSearchURL = 'https://api.datamarket.azure.com/Bing/Search/Web?$format=json&Query=';
$context = stream_context_create(array(
  'http' => array(
    'request_fulluri' => true,
    'header'  => "Authorization: Basic " . base64_encode($accountKey . ":" . $accountKey)
  )
));
$request = $webSearchURL . urlencode( '\'' . $_POST["searchText"] . '\'');
$response = file_get_contents($request, 0, $context);
$jsonobj = json_decode($response);
Earwig closed this task as Resolved.Apr 3 2016, 4:04 AM
Earwig claimed this task.

It works. Hallelujah.

DannyH moved this task from Ready to Q1 2018-19 on the Community-Tech-Sprint board.
DannyH moved this task from Estimated to Archive on the Community-Tech board.May 3 2016, 4:20 PM