Esempio n. 1
0
    def search(self, name):
        url = "https://search.nintendo-europe.com/" + country + "/select?q=" + urllib.parse.quote(name) + "&fq=type%3A*%20AND%20*%3A*&start=0&rows=24&wt=json&group=true&group.field=pg_s&group.limit=" + \
            str(limit) + "&group.sort=score%20desc,%20date_from%20desc&sort=score%20desc,%20date_from%20desc"

        payload = utils.get_json_response(url)

        return_offers = []

        for group in payload['grouped']['pg_s']['groups']:
            if group['groupValue'] == "GAME":
                for game in group['doclist']['docs']:
                    price = game['price_lowest_f']
                    return_offers.append(
                        GameOffer(
                            id=game["fs_id"],
                            cid=self._encode_id(id=game["fs_id"],
                                                name=game["title"]),
                            url=game["url"],
                            name=game["title"],
                            type=game["type"],
                            prices=[
                                Price(
                                    value=price if price > 0 else None,
                                    # TODO add currency
                                    currency="",
                                    offer_type="LOWEST"),
                            ],
                            platforms=game['system_names_txt'],
                            picture_url=game['image_url']
                            if 'image_url' in game else None))

        return return_offers
Esempio n. 2
0
def _search_for_items_by_name(name, store):

    encodedName = quote(name)
    url = apiRoot + "/bucket-search/" + store + "/" + apiVersion + \
        "/" + encodedName + "?size=" + fetchSize + "&start=0"
    data = utils.get_json_response(url)
    links = data['categories']['games']['links']
    return links
Esempio n. 3
0
def _search_for_items_by_name(name, store):

    encodedName = quote(name)
    url = apiRoot + "/bucket-search/" + store + "/" + apiVersion + \
        "/" + encodedName + "?size=" + fetchSize + "&start=0"
    data = utils.get_json_response(url)
    links = data['categories']['games']['links']
    return links
Esempio n. 4
0
def _getItemForCid(cid, store):
    try:
        url = apiRoot + "/viewfinder/" + store + "/" + \
            apiVersion + "/" + cid + "?size=" + fetchSize
        data = utils.get_json_response(url)
        return data
    except Exception as e:
        logging.error("Got error '" + str(e) +
                      "' while retrieving cid '" + cid + "' in store " + store)
        return None
Esempio n. 5
0
def _getItemForCid(cid, store):
    try:
        url = apiRoot + "/viewfinder/" + store + "/" + \
            apiVersion + "/" + cid + "?size=" + fetchSize
        data = utils.get_json_response(url)
        return data
    except Exception as e:
        logging.error("Got error '" + str(e) + "' while retrieving cid '" +
                      cid + "' in store " + store)
        return None
Esempio n. 6
0
def _get_item_for_cid(cid, store):
    try:
        url = (api_root + "/viewfinder/" + store + "/" + api_version + "/" +
               cid + "?size=" + fetch_size)
        data = utils.get_json_response(url)
        return data
    except Exception as e:
        logging.error("Got error '" + str(e) + "' while retrieving cid '" +
                      cid + "' in store " + store)
        return None
Esempio n. 7
0
def _get_items_by_container(container, store, filters_dict):
    url = api_root + "/viewfinder/" + store + "/" + api_version + "/" + container + "?size=" + fetch_size

    for i in filters_dict:
        url = url + "&" + quote(i) + "=" + quote(filters_dict[i])

    data = utils.get_json_response(url)
    links = data["links"]

    return links
Esempio n. 8
0
def _get_items_by_container(container, store, filtersDict):

    url = apiRoot + "/viewfinder/" + store + "/" + \
        apiVersion + "/" + container + "?size=" + fetchSize

    for i in filtersDict:
        url = url + "&" + quote(i) + "=" + quote(filtersDict[i])

    data = utils.get_json_response(url)
    links = data['links']

    return links
Esempio n. 9
0
    def search(self, name):
        url = "https://search.nintendo-europe.com/" + country + "/select?q=" + urllib.parse.quote(
            name
        ) + "&fq=type%3A*%20AND%20*%3A*&start=0&rows=24&wt=json&group=true&group.field=pg_s&group.limit=" + str(
            limit
        ) + "&group.sort=score%20desc,%20date_from%20desc&sort=score%20desc,%20date_from%20desc"

        payload = utils.get_json_response(url)

        return_offers = []

        for group in payload["grouped"]["pg_s"]["groups"]:
            if group["groupValue"] == "GAME":
                for game in group["doclist"]["docs"]:
                    price = game["price_lowest_f"]
                    return_offers.append(
                        GameOffer(
                            id=game["fs_id"],
                            cid=self._encode_id(encode_id=game["fs_id"],
                                                name=game["title"]),
                            url=game["url"],
                            name=game["title"],
                            type=game["type"],
                            prices=[
                                Price(
                                    value=price,
                                    offer_type="OFFER",
                                ) if price > 0 else Price(value=-1,
                                                          offer_type="NONE"),
                            ],
                            platforms=game["system_names_txt"],
                            picture_url=game["image_url"]
                            if "image_url" in game else None,
                        ))

        return return_offers
Esempio n. 10
0
def _search_for_items_by_name(name, store):
    encoded_name = quote(name)
    url = api_root + "/bucket-search/" + store + "/" + api_version + "/" + encoded_name + "?size=" + fetch_size + "&start=0"
    data = utils.get_json_response(url)
    links = data["categories"]["games"]["links"]
    return links