Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
venv
env
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ I offer no support or anything related to this script. May have more success if
# Installation
From PowerShell:

```
git clone https://github.com/ima9rd/psdirect-queue.git
cd psdirect-queue
python -m venv env
./env/Scripts/activate
pip install -r requirements.txt
python app.py
```

If you encounter errors such as `No module named win32com.client, No module named win32, or No module named win32api`, you will need to install `pypiwin32`:
```
pip install pypiwin32
```
34 changes: 26 additions & 8 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
from selenium import webdriver
from selenium import webdriver, common
from webdriver_manager.chrome import ChromeDriverManager
from random import randint
import time
import winsound
import pyttsx3

CAPTCHA_TIME_ALLOWANCE = 30

def beep(repeat):
speakengine = pyttsx3.init()

def say(message, repeat=1):
for i in range(repeat):
winsound.Beep(400, 500)
time.sleep(1)
speakengine.say(message)
speakengine.runAndWait()

def schedule_refresh():
time.sleep(randint(4, 10))
sel.refresh()
print('refreshing')

options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
Expand All @@ -22,7 +30,17 @@ def beep(repeat):
body = sel.find_element_by_tag_name('body')
if body.get_attribute('class') == 'queue challenge':
queue = True
beep(5)
say("ps5 queue is active")
elif body.get_attribute('class') == 'softblock':
say("captcha-challenge block")
time.sleep(CAPTCHA_TIME_ALLOWANCE) # allow 20 seconds to solve captcha before attempting to refresh
else:
time.sleep(randint(4, 10))
sel.refresh()
try:
add_to_cart_button = sel.find_element_by_class_name('add-to-cart') # first add-to-cart button
if "hide" not in add_to_cart_button.get_attribute('class'):
say("ps5 is potentially available for purchase!", 3)
else:
schedule_refresh()

except common.exceptions.NoSuchElementException:
schedule_refresh()
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pyttsx3==2.90
selenium==3.141.0
webdriver_manager==3.2.2
chromedriver-py==86.0.4240.22
chromedriver-py==86.0.4240.22
webdriver-manager==3.2.2