Compare commits
5 Commits
7079206658
...
jobs/epic-
Author | SHA1 | Date | |
---|---|---|---|
d33d0ba6a1 | |||
fcb3f8d7d8 | |||
1bebf03a70 | |||
025711e09d | |||
5a30cdeae5 |
@ -14,6 +14,7 @@ database/database.sqlite
|
|||||||
**/.dockerignore
|
**/.dockerignore
|
||||||
**/.env
|
**/.env
|
||||||
**/.git
|
**/.git
|
||||||
|
.gitea/
|
||||||
**/.gitignore
|
**/.gitignore
|
||||||
**/.project
|
**/.project
|
||||||
**/.settings
|
**/.settings
|
||||||
@ -67,3 +68,5 @@ yarn-error.log
|
|||||||
app/Browser/console/**
|
app/Browser/console/**
|
||||||
app/Browser/screenshots/**
|
app/Browser/screenshots/**
|
||||||
app/Browser/source/**
|
app/Browser/source/**
|
||||||
|
|
||||||
|
undetectedChromedriver
|
||||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -21,6 +21,11 @@ yarn-error.log
|
|||||||
/.nova
|
/.nova
|
||||||
/.vscode
|
/.vscode
|
||||||
/.zed
|
/.zed
|
||||||
|
|
||||||
|
# Python projet
|
||||||
|
venv
|
||||||
|
__pycache__
|
||||||
|
|
||||||
# Browser
|
# Browser
|
||||||
app/Browser/console
|
app/Browser/console
|
||||||
app/Browser/screenshots
|
app/Browser/screenshots
|
||||||
|
@ -156,6 +156,7 @@ abstract class BrowserJob implements ShouldQueue
|
|||||||
'--whitelisted-ips=""',
|
'--whitelisted-ips=""',
|
||||||
'--disable-dev-shm-usage',
|
'--disable-dev-shm-usage',
|
||||||
'--user-data-dir=/home/seluser/profile/',
|
'--user-data-dir=/home/seluser/profile/',
|
||||||
|
'--auto-open-devtools-for-tabs',
|
||||||
])->all());
|
])->all());
|
||||||
|
|
||||||
return RemoteWebDriver::create(
|
return RemoteWebDriver::create(
|
||||||
|
@ -4,15 +4,9 @@ namespace App\Browser\Jobs\EpicGames;
|
|||||||
|
|
||||||
use App\Browser\BrowserJob;
|
use App\Browser\BrowserJob;
|
||||||
use App\Browser\Components\Hellcase\EpicGamesLogin;
|
use App\Browser\Components\Hellcase\EpicGamesLogin;
|
||||||
use App\Browser\Components\Hellcase\MainNav;
|
|
||||||
use App\Browser\Jobs\Hellcase\HellcaseLoginQrCode;
|
|
||||||
use App\Models\JobArtifact;
|
|
||||||
use App\Models\JobInfo;
|
use App\Models\JobInfo;
|
||||||
use App\Models\JobRun;
|
use App\Models\JobRun;
|
||||||
use App\Notification\NotificationBody\Hellcase\HellcaseNotificationDailyFreeBody;
|
use App\Notification\Notifications\SimpleNotification;
|
||||||
use App\Notification\NotificationBody\Hellcase\HellcaseNotificationLoginBody;
|
|
||||||
use App\Notification\Notifications\Hellcase\HellcaseNotificationDailyFree;
|
|
||||||
use App\Notification\Notifications\Hellcase\HellcaseNotificationLogin;
|
|
||||||
use App\Notification\Providers\AllNotification;
|
use App\Notification\Providers\AllNotification;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Facebook\WebDriver\WebDriverBy;
|
use Facebook\WebDriver\WebDriverBy;
|
||||||
@ -36,7 +30,8 @@ class EpicGamesJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
|
|||||||
|
|
||||||
public function run(Browser $browser): ?JobRun
|
public function run(Browser $browser): ?JobRun
|
||||||
{
|
{
|
||||||
sleep(40);
|
// $browser->visit("https://bscscan.com/contractsVerified");
|
||||||
|
// sleep(3);
|
||||||
Log::info("Running " . self::class);
|
Log::info("Running " . self::class);
|
||||||
$this->jobRun = new JobRun([
|
$this->jobRun = new JobRun([
|
||||||
"job_id" => $this->jobId,
|
"job_id" => $this->jobId,
|
||||||
@ -44,8 +39,8 @@ class EpicGamesJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
|
|||||||
]);
|
]);
|
||||||
$this->jobRun->save();
|
$this->jobRun->save();
|
||||||
|
|
||||||
$this->goToEpicGamesWebsite($browser);
|
// $this->goToEpicGamesWebsite($browser);
|
||||||
$this->removePopups($browser);
|
// $this->removePopups($browser);
|
||||||
sleep(5);
|
sleep(5);
|
||||||
$this->signin($browser);
|
$this->signin($browser);
|
||||||
$this->getFreeGames($browser);
|
$this->getFreeGames($browser);
|
||||||
@ -94,15 +89,16 @@ class EpicGamesJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
|
|||||||
|
|
||||||
private function signin(Browser $browser)
|
private function signin(Browser $browser)
|
||||||
{
|
{
|
||||||
$browser->visit("https://store.epicgames.com/login?state=%2Fen-US%2F");
|
// $browser->visit("https://store.epicgames.com/login?state=%2Fen-US%2F");
|
||||||
|
$browser->driver->executeScript('window.open("https://store.epicgames.com/login?state=%2Fen-US%2F")');
|
||||||
sleep(5);
|
sleep(5);
|
||||||
$this->assertNotDetected($browser);
|
$this->assertNotDetected($browser);
|
||||||
$browser->waitForText("Sign In", 30, true);
|
$browser->waitForText("Sign In", 30, true);
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
|
||||||
$jobInfos = JobInfo::where("job_id", $this->jobId)->get();
|
$jobInfos = JobInfo::where("job_id", $this->jobId)->get();
|
||||||
$email = $jobInfos->where("key", "email")->first()->value;
|
$email = $jobInfos->where("key", "epicgames_account_email")->first()->value;
|
||||||
$password = $jobInfos->where("key", "password")->first()->value;
|
$password = $jobInfos->where("key", "epicgames_account_password")->first()->value;
|
||||||
$browser->within(new EpicGamesLogin, function (Browser $browser) use ($email, $password) {
|
$browser->within(new EpicGamesLogin, function (Browser $browser) use ($email, $password) {
|
||||||
$browser->fillForm($email, $password);
|
$browser->fillForm($email, $password);
|
||||||
});
|
});
|
||||||
@ -112,7 +108,52 @@ class EpicGamesJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
|
|||||||
|
|
||||||
private function getFreeGames(Browser $browser)
|
private function getFreeGames(Browser $browser)
|
||||||
{
|
{
|
||||||
$browser->visit('https://www.epicgames.com/store/en-US/free-games');
|
$browser->driver->executeScript('window.open("https://www.epicgames.com/store/en-US/free-games")');
|
||||||
|
// $browser->visit('https://www.epicgames.com/store/en-US/free-games');
|
||||||
|
$browser->waitForText("Free Games", 30, true);
|
||||||
|
$freeGamesLinkElements = $browser->driver->findElements(WebDriverBy::xpath('//a[contains(@aria-label, "Free Now")]'));
|
||||||
|
$freeGamesLinks = [];
|
||||||
|
foreach ($freeGamesLinkElements as $element) {
|
||||||
|
$freeGamesLinks[] = $element->getAttribute("href");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($freeGamesLinks as $link) {
|
||||||
|
$browser->visit($link);
|
||||||
|
$this->claimCurrentGame($browser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function claimCurrentGame(Browser $browser)
|
||||||
|
{
|
||||||
|
sleep(5);
|
||||||
|
$this->assertNotDetected($browser);
|
||||||
|
if ($this->unratedContent($browser)) {
|
||||||
|
throw new Exception("Le jeu demande un âge et datboi a la flemme de le mettre");
|
||||||
|
}
|
||||||
|
$this->waitForAndClickElementContainingText($browser, '//button', "Get", 30, true);
|
||||||
|
sleep(5);
|
||||||
|
$this->assertNotDetected($browser);
|
||||||
|
$browser->waitForText("Place Order", 30, true);
|
||||||
|
$browser->click("Place Order");
|
||||||
|
sleep(5);
|
||||||
|
$this->assertNotDetected($browser);
|
||||||
|
$browser->waitForText("Order Confirmation", 30, true);
|
||||||
|
$browser->click("Close");
|
||||||
|
sleep(5);
|
||||||
|
|
||||||
|
AllNotification::send(
|
||||||
|
new SimpleNotification($this->jobId, "Un jeu a été ajouté à votre bibliothèque", "Un jeu a été ajouté à votre bibliothèque EpicGames")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function unratedContent(Browser $browser)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$browser->waitForText("please provide your date of birth", 5, true);
|
||||||
|
return true;
|
||||||
|
} catch (Exception $_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function removePopups(Browser $browser)
|
private function removePopups(Browser $browser)
|
||||||
|
1
todo.md
1
todo.md
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
|
- Fix hellcase, fermer lespopups à chaque nouvelle visite
|
||||||
- Voir si le scheduler fonctionne au démmarage
|
- Voir si le scheduler fonctionne au démmarage
|
||||||
- Mettre un timeout pour pas overwhelm le pc au démmarage
|
- Mettre un timeout pour pas overwhelm le pc au démmarage
|
||||||
- Image pour le join de giveaway
|
- Image pour le join de giveaway
|
||||||
|
BIN
undetectedChromedriver/chromedriver
Executable file
BIN
undetectedChromedriver/chromedriver
Executable file
Binary file not shown.
@ -1 +1,20 @@
|
|||||||
sudo docker run --rm -it -p 3389:3389 -v ./undetectedChromedriver:/root/.local/share/undetected_chromedriver/ ultrafunk/undetected-chromedriver:latest
|
#!/bin/bash
|
||||||
|
|
||||||
|
# From undetected chromedriver docker
|
||||||
|
#sudo docker run --rm -it -p 3389:3389 -v ./undetectedChromedriver:/root/.local/share/undetected_chromedriver/ ultrafunk/undetected-chromedriver:latest
|
||||||
|
|
||||||
|
# With undetected chromedriver patcher
|
||||||
|
# Run the selenium/standalone-chrome:latest with a specific container name in the background
|
||||||
|
sudo docker run -d --name standalone-chrome selenium/standalone-chrome:latest
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
# Copy the chromedriver binary from the container to the host
|
||||||
|
sudo docker cp -L standalone-chrome:/bin/chromedriver ./chromedriver
|
||||||
|
# Stop the container
|
||||||
|
sudo docker stop standalone-chrome
|
||||||
|
|
||||||
|
sudo chmod 777 ./chromedriver
|
||||||
|
|
||||||
|
# Patch the chromedriver binary
|
||||||
|
python3 ./patchChromedriver.py
|
||||||
|
8
undetectedChromedriver/patchChromedriver.py
Normal file
8
undetectedChromedriver/patchChromedriver.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/python3
|
||||||
|
|
||||||
|
import undetected_chromedriver as uc
|
||||||
|
|
||||||
|
options = uc.ChromeOptions()
|
||||||
|
# Chromedriver is in current directory
|
||||||
|
driver = uc.Chrome(options = options, browser_executable_path="/usr/bin/google-chrome", driver_executable_path="/home/ninluc/Documents/codage/DatBrowser/undetectedChromedriver/chromedriver")
|
||||||
|
driver.get('https://nowsecure.nl')
|
@ -1,6 +1,7 @@
|
|||||||
FROM selenium/standalone-chrome:108.0 AS final
|
# FROM selenium/standalone-chrome:108.0 AS final
|
||||||
|
FROM selenium/standalone-chrome:latest AS final
|
||||||
|
|
||||||
COPY undetectedChromedriver/chromedriver-linux /bin/chromedriver
|
COPY undetectedChromedriver/chromedriver /bin/chromedriver
|
||||||
RUN mkdir -p /home/seluser/profile/
|
RUN mkdir -p /home/seluser/profile/
|
||||||
|
|
||||||
ENV TZ=Europe/Brussels
|
ENV TZ=Europe/Brussels
|
||||||
|
Reference in New Issue
Block a user