Giter Club home page Giter Club logo

primelooter's Introduction

THIS PROJECT IS NO LONGER MAINTAINED! Please use srhinos fork from now on.

Primelooter

GitHub tag (latest by date) Python GitHub license

Python bot which automatically claims twitch amazon prime gaming loot :D

Usage

1. ⚙️ General Setup

Local 📌

  1. Install python3
  2. Install package requirements: $> pip install -r requirements.txt
  3. Install playwright: $> python -m playwright install
  4. Create your own cookies.txt and publishers.txt (see example files)

Docker 🐳

If you want to use the provided docker image (only linux/amd64 plattform for now) you must mount the config.txt and providers.txt into the /app path. (example compose file is provided)

2. 🍪 Generate a cookie.txt (Firefox)

  1. Install this addon: cookie.txt
  2. Goto: https://gaming.amazon.com
  3. Login with your credentials
  4. There should be a new add-on icon in the right corner. Click on it and Export Cookies->Current Site

(Be careful not to share your cookie.txt! Keep it a secret like your credentials)

3. 🏢 Create a publishers.txt

Create a publishers.txt like the example file. Each line represents the publisher name used on the https://gaming.amazon.com website (add 'all' to claim all offers).

4. 🏃 Run

The script offers multiple arguments:

  • -c | --cookie: Path to cookies.txt file
  • -p | --publishers: Path to publishers.txt file
  • -l | --loop: loops the script with a cooldown of 24h
  • --dump: print the html-index page (used for issues/website changes)
  • -d | --debug: Print debug messages (used for issues)
  • -nh | --no-headless: starts the script with a visible browser (mainly for debugging)

If you use docker simply start the container.

If you want to use cron.d instead of letting the script wait 24h you must create a new file under /etc/cron.d. Example:

0 0 * * * root : Primelooter ; /usr/bin/python3 /path/to/primelooter.py --cookie /path/to/cookie.txt --publishers /path/to/publishers.txt

ko-fi

Disclaimer

Use this bot at your own risk! For more information read the license file.

primelooter's People

Contributors

github-actions[bot] avatar sharknoon avatar sibalzer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

primelooter's Issues

'NoneType' object has no attribute 'text_content'

I'm getting the following error on version 1.3.0 when i try to run the script:

2022-02-27 14:27:54 [ERROR] Error 'NoneType' object has no attribute 'text_content' File "/root/py/primelooter/primelooter.py", line 339, in <module> looter.run(dump) File "/root/py/primelooter/primelooter.py", line 222, in run self.claim_direct() File "/root/py/primelooter/primelooter.py", line 181, in claim_direct publisher = elem.query_selector( Traceback (most recent call last): File "/root/py/primelooter/primelooter.py", line 343, in <module> raise ex File "/root/py/primelooter/primelooter.py", line 339, in <module> looter.run(dump) File "/root/py/primelooter/primelooter.py", line 222, in run self.claim_direct() File "/root/py/primelooter/primelooter.py", line 181, in claim_direct publisher = elem.query_selector( AttributeError: 'NoneType' object has no attribute 'text_content'

Feedback & FAQ

Post your feedback and questions here. For feature-requests and bugs open a new issue.

feature request: detect game codes and save them into a file

Sometimes when claiming a game (e.g. star wars squadrons) we get a code for steam, origin or uplay. The code is shown in the gms-success-modal-container, but i don't have the html-code because the bot already claimed everything 😄 . It would be nice if somebody could provide me the code of the modal container, otherwise i must wait for new games. (but please remove personal information like name and the code)

Error while looting on Amazon Games

Hi, i'm experiencing this error:

[ERROR] Exception in callback SyncBase._sync.<locals>.callback(<Task finishe...6d8'}, ...}}}>) at C:\Python39\lib\site-packages\playwright\_impl\_sync_base.py:104 handle: <Handle SyncBase._sync.<locals>.callback(<Task finishe...6d8'}, ...}}}>) at C:\Python39\lib\site-packages\playwright\_impl\_sync_base.py:104> Traceback (most recent call last): File "C:\Python39\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) File "C:\Python39\lib\site-packages\playwright\_impl\_sync_base.py", line 105, in callback g_self.switch() File "C:\Python39\lib\site-packages\playwright\_impl\_browser_context.py", line 111, in <lambda> lambda params: self._on_response( File "C:\Python39\lib\site-packages\playwright\_impl\_browser_context.py", line 361, in _on_response page.emit(Page.Events.Response, response) File "C:\Python39\lib\site-packages\pyee\_base.py", line 115, in emit handled = self._call_handlers(event, args, kwargs) File "C:\Python39\lib\site-packages\pyee\_base.py", line 98, in _call_handlers self._emit_run(f, args, kwargs) File "C:\Python39\lib\site-packages\pyee\_asyncio.py", line 43, in _emit_run self.emit("error", exc) File "C:\Python39\lib\site-packages\pyee\_base.py", line 118, in emit self._emit_handle_potential_error(event, args[0] if args else None) File "C:\Python39\lib\site-packages\pyee\_base.py", line 88, in _emit_handle_potential_error raise error File "C:\Python39\lib\site-packages\pyee\_asyncio.py", line 41, in _emit_run coro = f(*args, **kwargs) File "C:\Python39\lib\site-packages\playwright\_impl\_wait_helper.py", line 121, in listener self._fulfill(event_data) File "C:\Python39\lib\site-packages\playwright\_impl\_wait_helper.py", line 99, in _fulfill self._cleanup() File "C:\Python39\lib\site-packages\playwright\_impl\_wait_helper.py", line 96, in _cleanup listener[0].remove_listener(listener[1], listener[2]) File "C:\Python39\lib\site-packages\playwright\_impl\_page.py", line 272, in remove_listener super().remove_listener(event, f) File "C:\Python39\lib\site-packages\pyee\_base.py", line 155, in remove_listener self._remove_listener(event, f) File "C:\Python39\lib\site-packages\pyee\_base.py", line 150, in _remove_listener self._events[event].pop(f)

Primelooter is latest version (1.3.0), i didn't change anything else.

Primelooter not looting

Hi,

i've followed your instructions, launched the script using:

python primelooter.py --loop

(cookie and publishers files are in the same directory), the script starts and finish looting cicle without redeeming any game. Should i enter the path of both txt files?

I'm running it on Windows 10, both Firefox and Chrome installed, latest PIP and all requirements installed.

Automatic Code Redemption On Gog And Origin

Feature Request:

Since these promotional keys frequently have an expiry date, it would be a great feature to have the script parse the code from the success modal, then automatically activate the code on the respective webstore.

For example, if our GOG key is Z6XR90XX645998XX3C, then we can form a target URL as: https://gog.com/redeem/Z6XR90XX645998XX3C. After navigating to that URL, we can then simulate a click on the "Continue" submit button to activate the code.

If we run into any issues with ReCaptcha, open the target URL in non-headless mode and let the user click that one button to activate.

GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing

weird error

2021-09-24 01:19:31 [WARNING] Loop <_UnixSelectorEventLoop running=False closed=True debug=False> that handles pid 12136 is closed
primelooter    | 2021-09-25 01:20:37 [ERROR] Error Timeout 30000ms exceeded.
primelooter    | =========================== logs ===========================
primelooter    | <launching> /ms-playwright/firefox-1281/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-LfYaYc -juggler-pipe -silent
primelooter    | <launched> pid=13084
primelooter    | [pid=13084][err] *** You are running in headless mode.
primelooter    | [pid=13084][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=20.1245) [GFX1-]: glxtest: libpci missing
primelooter    | [pid=13084][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=20.1245) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=20.1656) [GFX1-]: glxtest: Unable to open a connection to the X server
primelooter    | [pid=13084][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=20.1245) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=20.1656) |[2][GFX1-]: glxtest: libEGL initialize failed (t=20.1656) [GFX1-]: glxtest: libEGL initialize failed
primelooter    | [pid=13084][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=20.1245) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=20.1656) |[2][GFX1-]: glxtest: libEGL initialize failed (t=20.1656) |[3][GFX1-]: No GPUs detected via PCI (t=20.1861) [GFX1-]: No GPUs detected via PCI
primelooter    | ============================================================
primelooter    | 2021-09-25 01:21:38 [ERROR] Error It looks like you are using Playwright Sync API inside the asyncio loop.
primelooter    | Please use the Async API instead.

Error 'NoneType' object has no attribute 'click'

This is the error i got from 01/09/2021 when trying to loot new games:

2021-09-03 22:47:50 [ERROR] Error 'NoneType' object has no attribute 'click'
File "C:\Users\Marco\Documents\GitHub\primelooter\primelooter.py", line 229, in
loot(cookies, publishers, headless, dump)
File "C:\Users\Marco\Documents\GitHub\primelooter\primelooter.py", line 154, in loot
elem.query_selector("button[data-a-target=FGWPOffer]").click()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.