def toOwnWebsite(service, rMin, rMax):
    return len(
        filterDict(
            service["third_parties"],
            lambda key, value: "ONCLICK" in value["embed_as"] and key.name ==
            service["service"].name and not value["receives_identifier"],
        ))
def CDNs(service, rMin, rMax):
    return countToRating(
        len(
            filterDict(
                service["third_parties"],
                lambda key, value: "ONVIEW" in value["embed_as"] and (
                    (key.sector != "tracker" and key.sector != "unknown"
                     ) or key.name == service["service"].name),
            )),
        rMin,
        rMax,
    )
def toTrackers(service, rMin, rMax):
    return countToRating(
        len(
            filterDict(
                service["third_parties"],
                lambda key, value: "ONCLICK" in value["embed_as"] and key.name
                != service["service"].name and (
                    key.sector == "tracker"
                ),  # This unknown might be over sensitv because a lot of thirdparties are not classified yet
            )),
        rMin,
        rMax,
    )
def toThirdParties(
        service, rMin,
        rMax):  # TODO should I filter the links to the newsletters own site?

    diffrentCountries = len(
        filterDict(
            service["third_parties"],
            lambda key, value: "ONCLICK" in value["embed_as"] and key.name !=
            service["service"].name and not value["receives_identifier"] and
            key.country_of_origin != service["service"].country_of_origin,
        ))
    sameCountry = len(
        filterDict(
            service["third_parties"],
            lambda key, value: "ONCLICK" in value["embed_as"] and key.name !=
            service["service"].name and not value["receives_identifier"] and
            key.country_of_origin == service["service"].country_of_origin,
        ))
    return countToRating(
        diffrentCountries * 1.5 + sameCountry,
        rMin,
        rMax,
    )
def highNumber(service, rMin, rMax):
    return countToRating(
        len(
            filterDict(
                service["third_parties"],
                lambda key, value:
                (("ONVIEW" in value["embed_as"] and
                  (key.sector == "tracker" or key.sector == "unknown")) or
                 ("ONCLICK" in value["embed_as"] and (key.sector == "tracker")
                  )) and key.name != service["service"].name,
            )),
        rMin,
        rMax,
    )
def smallTrackers(service):
    return len(
        filterDict(
            service["third_parties"],
            lambda key, value:
            ((("ONVIEW" in value["embed_as"] and
               (key.sector == "tracker" or key.sector == "unknown")) or
              ("ONCLICK" in value["embed_as"] and (key.sector == "tracker")))
             and key.name != service["service"].name and len(
                 cache.get(
                     Thirdparty
                     .objects.get(host=key.name).derive_thirdparty_cache_path(
                     ))["services"]) <= 10  # what defines a big tracker
             ),
        ))
Beispiel #7
0
def calculatePersonalizedLinksToOwnWebsite(service, rMin, rMax):  # TODO
    if (
        len(
            filterDict(
                service["third_parties"],
                lambda key, value: "ONCLICK" in value["embed_as"]
                and key.name == service["service"].name
                and value["receives_identifier"],
            )
        )
        >= 1
    ):
        return 1
    else:
        return 0
Beispiel #8
0
def calculatePersonalizedLinksThirdParties(
    service, rMin, rMax
):  # TODO should I filter the links to the newsletters own site?
    return countToRating(
        len(
            filterDict(
                service["third_parties"],
                lambda key, value: "ONCLICK" in value["embed_as"]
                and key.name != service["service"].name
                and value["receives_identifier"],
            )
        ),
        rMin,
        rMax,
    )