OWAPI icon indicating copy to clipboard operation
OWAPI copied to clipboard

Playtime appears to be off

Open Double0negative opened this issue 6 years ago • 1 comments

Issue

The hero playtime being returned from the API appears to be incorrect. For example,

https://owapi.net/api/v3/u/Double0-11909/blob

shows 10hr playtime on hanzo in competitive whereas

https://playoverwatch.com/en-us/career/pc/Double0-11909

shows 14. Widowmaker shows 56hrs in QP whereas playoverwatch shows 58, etc

Double0negative avatar Jun 20 '18 21:06 Double0negative

OWAPI is using a more accurate Platime Calculation than Blizzard is doing on their Website. Please compare the OWAPI Values with ingame Values. If you want to use the Calculated Value Blizzard is showing on their Website you can use the "time_played" Value in Quickplay and Competitive Section. For example Widowmaker: "eu" -> "heroes" -> "stats" -> "quickplay" -> "widowmaker" -> "time_played" is showing 58 which is the Value on the Blizzard Website.

You can see the code for calculating the Hero Playtime here:

    # Loop over each one, extracting the name and hours counted.
    percent_per_second = None
    for child in reversed(hero_info):
        name, played = child.getchildren()
        name, played = util.sanitize_string(name.text), played.text.lower()

        time = 0
        if played != "--":
            time = util.try_extract(played)

        # More accurate playtime calculation
        # Requires reversing hero_info
        category_item = child.getparent().getparent()
        percent = float(category_item.attrib['data-overwatch-progress-percent'])
        if percent_per_second is None and time < 1 and time > 0:
            seconds = 3600 * time
            percent_per_second = percent / seconds

        built_dict[name] = time
        if percent_per_second != None:
            built_dict[name] = (percent / percent_per_second) / float(3600)

jpylypiw avatar Jul 01 '18 09:07 jpylypiw