Skip to content

Commit

Permalink
Update version and changelog, lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
Jared Chapiewsky committed Apr 18, 2019
1 parent 949af56 commit b1eac2d
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 2.9.0 - 2019-04-18
### Added
- Automatically enter captchas (#62)[https://github.com/jpchip/giveaway-grabber/issues/62]


## 2.8.0 - 2019-04-17
### Fixed
- Handle both possible layouts for giveaways (#66)[https://github.com/jpchip/giveaway-grabber/issues/66]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ The script will wait for you to enter your code.

### CAPTCHAs

Every so often Amazon will present a CAPTCHA. The script will pause at this
point and wait for you to enter it. The console will warn you with an `ENTER CAPTCHA!` message,
Every so often Amazon will present a CAPTCHA. The script will attempt to enter it automatically, but if it fails, it will
pause and wait for you to enter it. The console will warn you with an `ENTER CAPTCHA!` message,
and you **should** get a system notification (only tested it on Windows 10).

### Blacklist
Expand Down
143 changes: 141 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "giveaway-grabber",
"version": "2.8.0",
"version": "2.9.0",
"description": "Automates entries for Amazon Giveaways",
"preferGlobal": true,
"main": "index.js",
Expand Down Expand Up @@ -30,6 +30,10 @@
{
"name": "birdlavv",
"url": "https://github.com/birdlavv"
},
{
"name": "KryptoNova",
"url": "https://github.com/KryptoNova"
}
],
"license": "MIT",
Expand Down
7 changes: 5 additions & 2 deletions src/giveaways.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,13 @@ async function checkForCaptcha(page) {
const tessValue = await Tesseract.recognize(url).then(function(result) {
return result;
});
console.log("OCR Value: " + tessValue.text.trim().replace(" ", ""));
console.log('OCR Value: ' + tessValue.text.trim().replace(' ', ''));
await page.waitForSelector('#image_captcha_input');
await page.click('#image_captcha_input');
await page.type('#image_captcha_input', tessValue.text.trim().replace(" ", ""));
await page.type(
'#image_captcha_input',
tessValue.text.trim().replace(' ', '')
);
await page.click('#image_captcha_input');
await page.click('.a-button-input');
await page.waitFor(() => !document.querySelector('#image_captcha'), {
Expand Down

0 comments on commit b1eac2d

Please sign in to comment.