DEPRECATED: see https://github.com/Granitosaurus/ggmt instead

GosuGamers-API

Python unofficial API/Scraper for http://gosugamers.net
See Usage and examples.

Installation and Prerequisites:

Written in Python 3.4 (should work on anything 3+)
install: pip install GIT+https://github.com/Granitas/GosuGamers-API/
prerequisites:
pip install -r requirements.txt or do it manually with pip.
lxml - http://lxml.de/

pip install lxml

Note: installation might be a bit tricky so please see http://lxml.de/installation.html

Requests - https://pypi.python.org/pypi/requests/2.3.0

pip install requests

Example:

See examples folder
i.e.:

def print_dota_teams(game, what_to_print=None):
    dota_team_scraper = gg_team.get_scraper(game)

    if not what_to_print:
        what_to_print = lambda team: team

    teams = dota_team_scraper.get_teams()
    for team in teams:
        print(what_to_print(team))

if __name__ == '__main__':
    print_dota_teams('dota2')

Usage:

Scrapers:

MatchScraper() object - scraper for gosugamers match pages (i.e. http://www.gosugamers.net/dota2/gosubet)

Scraper for gosugamers matches. Scrapers for games:
CsGoMatchScraper : Counter-Strike: Global offensive match scraper
Dota2MatchScraper : Dota2 match scraper
LolMatchScraperr : League Of Legends match scraper
HearthStoneMatchScraper : Hearthstone match scraper
HotsMatchScraperr : Heroes of the Storm match scraper

Use those to scrape games for matches. All of the scraper objects have these methods that you should use to retrieve results:
find_live_matches() - retrieves a list of Match objects of live games.
find_recent_matches() - retrieves a list of Match objects of recent games.
find_upcoming_matches() - retrieves a list of Match objects of upcoming games.

FAQ:
Is it possible to retrieve the whole history of matches displayed on gosugamers?
-Currently the function for that is not available because it would require some asyncronious request system (extra dependancies etc.) though feel free to open an issue or poke me regaring it.
Is it possible to retrieve Matchticker part of the website?
-Yes and No. Gosugamer Matchticker is just upcoming games section from the matches page so you can retrieve the same info by find_live_matches() and find_upcoming_matches().

Match() object - it's a storage object for match data.

game - game name (i.e. 'dota2').
team1 - first team's name (one on the left).
team1_score - first team's score (if exists).
team1_bet - first team's bet percentage.
team2 - second team's name (one on the right).
team2_score - second team's score (if exists).
team2_bet - second teams bet percentage.
live_in - live in, unparsed string that is displayed on the webpage (if exists). tournament - tournament name (if exists). has_vods - True if vods exists otherwise False.
match_id - Match id used by gosugamers.
match_url - Direct url to the match page.

functions:
get_streams() - returns a list of stream urls found on the match page. dict() - returns all data in formatted dict format for easy json output.