Forum Jump :

Author Message

wom  



Posts: 9
Rank:


Level: Member

Country: fi
Location:
Occupation:
Age:
In-game name: wom

 
#1 Posted at 2013-09-02 07:58        
     
Hi all,

I made small Python script that gets download stats from Armaholic and from Steam Workshop for your missions. It simply fetches web pages for mission and parses download count from Armaholic and current subscriptions from Steam Workshop.

Because script doesn't log in to the Steam Workshop it can't get all time subscriptions.

I was kind of tired of checking from two places how missions are doing so I made a script to help me.

Script now checks my two missions "Who is the bad guy?" and "Counter Attack" stats. To put your own missions just change urls for the missions.

Feel free to use, modify or ignore :)

import urllib2

armaholic_pos_start = "Downloaded :</strong> "
armaholic_pos_end = " times "

def armaholic_stats(url):
        print ""
        print "Armaholic"
        page = urllib2.urlopen(url)

        content = page.read()

        amount_start = content.find(armaholic_pos_start)
        amount_end =  content.find(armaholic_pos_end)
        downloads =  content[amount_start + len(armaholic_pos_start):amount_end]
        print "    Downloads: " + downloads

        return int(downloads)

def steam_stats(url):
        print ""
        print "Steam Workshop"
        page = urllib2.urlopen(url)

        content = page.read()

        subscribers_end = content.find("<td>Current Subscribers</td>")
        subscribers_start = content.rfind("<td>", subscribers_end-20, subscribers_end)
        amount_str =  content[subscribers_end-20:subscribers_end]
        subscribers = amount_str[amount_str.find("<td>")+len("<td>"):amount_str.find("</td>")]
        print "    Subscribers: " + subscribers

        return int(subscribers)


# Get stats for Counter Attack

total_downloads = 0

print "-----------------------------------------------------------------------"
print " Mission: Counter Attack"
print "-----------------------------------------------------------------------"

mission_downloads = armaholic_stats("http://www.armaholic.com/page.php?id=22327")
mission_downloads  = mission_downloads + steam_stats("http://steamcommunity.com/sharedfiles/filedetails/?id=174004372")

total_downloads = total_downloads + mission_downloads

print ""
print "Total downloads: " + str(mission_downloads)

print ""

print "-----------------------------------------------------------------------"
print " Mission: Who is the bad guy?"
print "-----------------------------------------------------------------------"

mission_downloads = armaholic_stats("http://www.armaholic.com/page.php?id=19111")
mission_downloads = mission_downloads + steam_stats("http://steamcommunity.com/sharedfiles/filedetails/?id=174666757")

total_downloads = total_downloads + mission_downloads

print ""
print "Total downloads: " + str(mission_downloads)

print ""
print "-----------------------------------------"
print " Total downloads (all missions): " + str(total_downloads)
print "-----------------------------------------"
print ""


Author Message


Posts: 20279
Rank:


Level: Super Admin

Country: nl
Location: The Netherlands
Occupation:
Age: 41
In-game name: Foxhound

 
#2 Posted at 2013-09-02 10:08        
     
Interesting development :-)

I just need to say that our counter is not showing the correct count though, it only counts downloads on link 1, not link 2. That will be fixed on our new website though so than you get proper count.

Visit my family webshop desteigerhoutshop.nl.