Scraping leaderboards for inactive members

Scraping leaderboards for inactive members

in API Development

Posted by: Kuzzi.2198

Kuzzi.2198

Hey guys,

Every week, it takes me about 2 hours to manually look through the list achievement leaderboards to identify inactive members among our 450+ members. Is there an API that would give us access to this leaderboards information?

If not, I have started trying to do this myself by attempting to scrape the leaderboard webpage – but I haven’t been successful due to having to login to the website. I’m trying to write a python script to login and then retrieve the webpage that contains the leaderboard for my guild. I’m using the python library requests to try to achieve this. However, the login is not successful and when I access the leaderboard for my guild it redirects to the general leaderboard.

Could anyone please help me login to the gw2 website with python-requests?

Here is my code so far:

import requests

EMAIL = ‘my_email’
PASSWORD = ‘my_pw’
URL = ‘https://account.guildwars2.com/login

session = requests.session()

login_data = dict(email=EMAIL, password=PASSWORD)
r = session.post(URL, data=login_data)

req = session.get(‘https://leaderboards.guildwars2.com/en/na/achievements/guild/Darkhaven%20Elite’)

print req.content

(edited by Kuzzi.2198)

Scraping leaderboards for inactive members

in API Development

Posted by: Healix.5819

Healix.5819

Assuming you have basic programming knowledge, everything you need to know can be found in this project (c#):

https://code.google.com/p/gw2-lastonline-leaderboards/

Scraping leaderboards for inactive members

in API Development

Posted by: Kuzzi.2198

Kuzzi.2198

Awesome, thank you.

Scraping leaderboards for inactive members

in API Development

Posted by: famfamfam.9137

famfamfam.9137

If you don’t want to run a script to do it, the following Javascript can be be used directly in the Developer console of a browser after selecting your guild, and will add an extra column containing the last date to the achievements list and sort them by that:

https://gist.github.com/markjames/96a7f6c272fa32a31e44

Screenshot attached.

Attachments: