Browse Source

fix wikipedia URL bug which was finding google search results and mixing 'this is a wikipedia' detection with a different method for extracting data

pull/811/merge
Joe Germuska 9 years ago
parent
commit
120df50496
  1. 4
      source/js/Core/Media/VMM.MediaType.js

4
source/js/Core/Media/VMM.MediaType.js

@ -125,11 +125,11 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaType == 'undefined') {
media.type = "googledoc";
media.id = d;
success = true;
} else if (d.match('(www.)?wikipedia\.org')) {
} else if (d.match('^(?:http|https)://.*wikipedia\.org/wiki/([^\s#]+)')) {
media.type = "wikipedia";
//media.id = d.split("wiki\/")[1];
// TODO Issue #618 better splitting
var wiki_id = d.split("wiki\/")[1].split("#")[0].replace("_", " ");
var wiki_id = d.match('^(?:http|https)://.*wikipedia\.org/wiki/([^\s#]+)')[1].replace("_", " ");
media.id = wiki_id.replace(" ", "%20");
media.lang = d.split("//")[1].split(".wikipedia")[0];
success = true;

Loading…
Cancel
Save