{"id":15588119,"url":"https://github.com/david-lor/pysgapi","last_synced_at":"2025-03-29T09:21:31.522Z","repository":{"id":104269548,"uuid":"135898713","full_name":"David-Lor/pysgapi","owner":"David-Lor","description":"A Python \"API\" for the Steamgifts website","archived":false,"fork":false,"pushed_at":"2019-08-03T17:58:22.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-03T23:56:08.505Z","etag":null,"topics":["api","giveaway","python","requests-html","scraper","scraping","scraping-api","scraping-python","sgapi","steam","steamgifts","steamgiftsapi"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/David-Lor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-03T11:37:14.000Z","updated_at":"2019-08-03T17:58:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"b7f0846f-6f2d-495c-918c-0663d86d1d41","html_url":"https://github.com/David-Lor/pysgapi","commit_stats":{"total_commits":5,"total_committers":2,"mean_commits":2.5,"dds":0.4,"last_synced_commit":"1d7196889fd7707b6c0c037e8a85ff2ed05ecb49"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/David-Lor%2Fpysgapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/David-Lor%2Fpysgapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/David-Lor%2Fpysgapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/David-Lor%2Fpysgapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/David-Lor","download_url":"https://codeload.github.com/David-Lor/pysgapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246162671,"owners_count":20733461,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","giveaway","python","requests-html","scraper","scraping","scraping-api","scraping-python","sgapi","steam","steamgifts","steamgiftsapi"],"created_at":"2024-10-02T22:21:30.879Z","updated_at":"2025-03-29T09:21:31.506Z","avatar_url":"https://github.com/David-Lor.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PySgApi\n\nPySgApi is a Python tool that works as some sort of unofficial \"API\" for the [SteamGifts](http://www.steamgifts.com) website.\n\nIt can fetch active giveaways on the page with many useful information about them, like:\n\n* Game's name\n* Giveaway URL and ID\n* Cost in points\n* Required level\n* Datetime when it was created and ends\n* How much time is left for the giveaway to end; how much time it has been active\n* How many users entered the giveaway and their usernames\n* Probability to win the giveaway (1/entries)\n\n## Requirements\n\n* Python \u003e=3.6\n* requests-html\n\n## Examples\n\n```python\nfrom pysgapi import SG\nsg = SG()\n\n#Find giveaways on the first 5 pages\ngiveaways = sg.find_giveaways(page=5)\n\n#Find giveaways that cost no more than 10 points\n#By default only giveaways on first page will be returned\ngiveaways = sg.find_giveaways(max_points=10)\n\n#Find giveaways with no more than 1000 entries, and with a required level not higher than 3\ngiveaways = sg.find_giveaways(max_entries=1000, max_level=3)\n\n#Find giveaways where there I have 50% of probabilities of wining it\ngiveaways = sg.find_giveaways(min_probability=0.5, page=10)\n\n#You can get many things from a giveaway object\nga = giveaways[0]\n#Game's name\nprint(ga.name)\n#Giveaway URL\nprint(ga.url)\n#Game's Steam URL\nprint(ga.steam_url)\n#Game's Steam ID\nprint(ga.steam_id)\n#Entries (how many users entered the GA)\nprint(ga.entries)\n#Giveaway required level and cost in points\nprint(ga.level, ga.points)\n#Datetime when giveaway was created and ends (in UTC time)\nprint(ga.created_utc, ga.end_utc)\n#Get the probability to win (1/number of entries)\nprint(ga.calculate_probability())\n\n#Useful methods related with time (all of them return time in seconds)\n#How much time is left until giveaway ends?\nprint(ga.get_remaining_time())\n#How much time has the giveaway been active?\nprint(ga.get_elapsed_time())\n#How much time will the giveaway be active?\nprint(ga.get_total_time())\n\n#Get users that entered the giveaway\nusers = ga.get_users()\nprint(\"Users that entered the giveaway for\", ga.name, \"URL:\", ga.url)\nfor u in users:\n    print(u)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavid-lor%2Fpysgapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavid-lor%2Fpysgapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavid-lor%2Fpysgapi/lists"}