<commit_before>import urllib.request
import json

class Wikia:
    wiki_name = ""

    def __init__(self, wiki):
        self.wiki_name = wiki

    def search(self, term, limit=1):
        # Search for a page on Wikia
        # TODO: make limits over 1 return an array
        searchTerm = term.replace(" ", "+")
        url = "http://starvstheforcesofevil.wikia.com/api/v1/Search/List?query={}&limit=1&minArticleQuality=10&batch=1&namespaces=0%2C14".format(searchTerm)

        jsonString = urllib.request.urlopen(url).read().decode("utf-8")
        json_d = json.loads(jsonString)

        return json_d['items']

    def getPage(self, page_id):
        # Get a page on Wikia based on the page ID
        url = "http://starvstheforcesofevil.wikia.com/api/v1/Articles/AsSimpleJson?id={}".format(page_id)

        jsonString = urllib.request.urlopen(url).read().decode("utf-8")<commit_msg>Fix Wikia API to not be limited to SVTFOE Wikia<commit_after>import urllib.request
import json

class Wikia:
    wiki_name = ""

    def __init__(self, wiki):
        self.wiki_name = wiki

    def search(self, term, limit=1):
        # Search for a page on Wikia
        # TODO: make limits over 1 return an array
        searchTerm = term.replace(" ", "+")
        url = "http://{}.wikia.com/api/v1/Search/List?query={}&limit=1&minArticleQuality=10&batch=1&namespaces=0%2C14".format(self.wiki_name, searchTerm)

        jsonString = urllib.request.urlopen(url).read().decode("utf-8")
        json_d = json.loads(jsonString)

        return json_d['items']

    def getPage(self, page_id):
        # Get a page on Wikia based on the page ID
        url = "http://{}.wikia.com/api/v1/Articles/AsSimpleJson?id={}".format(self.wiki_name, page_id)

        jsonString = urllib.request.urlopen(url).read().decode("utf-8")
{'fraction_non_alphanumeric': 0.13842746400885936, 'fraction_numerical': 0.015503875968992248, 'mean_word_length': 3.106818181818182, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3542621', 'n_tokens_mistral': 635, 'n_tokens_neox': 606, 'n_words': 124}