public void run() {
	    String descriptionText = this.noDescString;
        String shortUrl;
        String searchUrl = this.urlFormat.replaceAll("%%SEARCHTERMS%%", this.searchTerms);
        
 
        // try to be more clever on media wikis
        try {
            URL _searchUrl = new URL(searchUrl);
            String searchUrlBase = _searchUrl.getProtocol() + "://" + _searchUrl.getHost();
            
            // try to find the best match
            
            String matchAPI = searchUrlBase.concat("/api.php?action=query&list=search&srsearch=" + URLEncoder.encode(this.searchTerms, "ISO-8859-1") + "&srprop=titlesnippet&srlimit=1&format=json");
            String matchAPIResponse = readURL(matchAPI);

            String match = ".*\\\"title\\\":\\\"([^\"]+)\\\",\\\"titlesnippet\\\".*";
            if (matchAPIResponse.matches(match)) {
                String matchedTitle = matchAPIResponse.replaceAll(match, "$1");
                if (matchedTitle.length() > 0) this.searchTerms = matchedTitle;
            }


            
            // try to find and parse the description directly
            
            String descriptionAPI = searchUrlBase.concat("/api.php?action=query&titles=" + URLEncoder.encode(this.searchTerms, "ISO-8859-1") + "&prop=revisions&rvprop=content&format=txt");
            String descriptionAPIResponse = readURL(descriptionAPI);
            
            
            int descriptionIndex = descriptionAPIResponse.indexOf("[*] => ");
            if (descriptionIndex != -1) {
                descriptionAPIResponse = descriptionAPIResponse.substring(descriptionIndex + 7);

                while (descriptionAPIResponse.startsWith("{{")) {
                    if (descriptionAPIResponse.startsWith("{{")) {
                        int closeTag = descriptionAPIResponse.indexOf("}}");
                        int openTag = descriptionAPIResponse.substring(0, closeTag).lastIndexOf("{{");
                        descriptionAPIResponse = descriptionAPIResponse.substring(0, openTag) + descriptionAPIResponse.substring(closeTag + 2, descriptionAPIResponse.length()-1);
                        
                    }
                    
                    descriptionAPIResponse = descriptionAPIResponse.trim();
                    if (descriptionAPIResponse.startsWith("\n")) descriptionAPIResponse = descriptionAPIResponse.substring(2);
                }
                
                descriptionAPIResponse = descriptionAPIResponse
                        .replaceAll("\\[\\[[a-zA-Z0-9]*:[^\\]]*\\]\\]", "")
                        .replaceAll("\\[\\[[^\\]]*\\|([^\\|]*)\\]\\]", "$1")
                        .replaceAll("\\[\\[", "")
                        .replaceAll("\\]\\]", "")
                        .replaceAll("'''", "")
                        .replaceAll("<br>", " ")
                        .replaceAll("\\{\\{IS\\|", "\n"+ChatColor.AQUA+"[")
                        .replaceAll("\\}\\}", "]")
                        .replaceAll("===([^=]+)===", " ➜ $1\n"+ChatColor.AQUA)
                        .replaceAll("==([^=]+)==", "\n"+ChatColor.AQUA+" ➜ $1")
                        .replaceAll(" [^\\| ]+\\|([^\\| ]+) ", " $1 ")
                        ;
                
                descriptionText = "\n" + ChatColor.AQUA + (descriptionAPIResponse.length() > 700 ? (descriptionAPIResponse.substring(0,700) + "...") : descriptionAPIResponse) + "\n";                
            }

            
        } catch (Exception e) {
            e.printStackTrace();
        }

	    
		String message = this.resultsFormat
				.replaceAll("%%SEARCHTERMS%%", this.searchTerms)
				.replaceAll("%%SEARCHVIA%%", this.wikiName).replaceAll("%%RESULTTEXT%%", descriptionText);
		

		
		try {
			shortUrl = this.urlShortener.shortenUrl(searchUrl);
			message = message.replaceAll("%%RESULTSURL%%", shortUrl);
		} catch (Exception e) {
			message = "Couldn't shorten search URL.";
			this.recipients = new ArrayList<CommandSender>();
		}
		
		new SearchResult(this.sender, this.recipients, message).runTask(this.plugin);
	}