Compare commits
4 Commits
7e37ea86d0
...
70cd2a41b1
Author | SHA1 | Date | |
---|---|---|---|
70cd2a41b1 | |||
d498203147 | |||
69fdad8f4e | |||
982f4ca7a7 |
@ -226,7 +226,11 @@ class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
|
||||
private function getDailyFree(Browser $browser)
|
||||
{
|
||||
$browser->visit('https://hellcase.com/dailyfree');
|
||||
$browser->waitForText("Get Daily free loot", 30, true);
|
||||
try {
|
||||
$browser->waitForText("Get Daily free loot", 30, true);
|
||||
} catch (\Exception $e) {
|
||||
return; // Pobably means we do not have access to a daily free loot
|
||||
}
|
||||
|
||||
// Do we fill the conditions ?
|
||||
if (sizeof(value: $browser->driver->findElements(WebDriverBy::xpath('//p[contains(text(), "Fulfill the conditions below")]'))) > 0) {
|
||||
|
@ -127,8 +127,13 @@ class InstagramRepostJob extends BrowserJob implements ShouldBeUniqueUntilProces
|
||||
|
||||
// Add unreposted reels to the job run if not enough reels were downloaded
|
||||
if (count($toDownloadReels) < self::MAX_REPOSTS_PER_JOB) {
|
||||
$toDownloadReelsIds = array_map(function ($reel) {
|
||||
return $reel->reel_id;
|
||||
}, $toDownloadReels);
|
||||
|
||||
$unrepostedReels = InstagramRepost::where("reposted", false)
|
||||
->where("repost_tries", "<", self::MAX_REPOST_TRIES) // Limit to 3 tries
|
||||
->whereNotIn("reel_id", $toDownloadReelsIds) // Avoid already downloaded reels
|
||||
->whereIn("account_id", InstagramAccount::whereIn("username", $accounts)->pluck("id"))
|
||||
->take(self::MAX_REPOSTS_PER_JOB - count($toDownloadReels))
|
||||
->get();
|
||||
@ -184,7 +189,8 @@ class InstagramRepostJob extends BrowserJob implements ShouldBeUniqueUntilProces
|
||||
"content" => ""
|
||||
]));
|
||||
} catch (\Exception $e) {
|
||||
dump($e->getMessage());
|
||||
$browser->screenshot(JobDebugScreenshot::getFileName($this->jobId));
|
||||
AllNotification::send(new JobDebugNotification($this->jobId, "Unknown error when trying to repost reels : " . $e->getMessage()));
|
||||
} finally {
|
||||
// Removes all videos in the download folder
|
||||
$files = glob($this->downloadFolder . '*'); // Get all files in the download folder
|
||||
|
@ -14,7 +14,7 @@ class JobDebugNotification extends Notification {
|
||||
private string|null $title;
|
||||
private string|null $screenShotProjectPath;
|
||||
|
||||
public function __construct(int $jobId, string $body, string $title = null, string $error = null, ?string $screenshotProjectPath = "", bool $isError = false) {
|
||||
public function __construct(int $jobId, string $body, string $title = null, string $error = null, ?string $screenshotProjectPath = "", bool $isError = true) {
|
||||
parent::__construct($jobId, isError:$isError);
|
||||
$this->title = $title;
|
||||
if ($screenshotProjectPath === "") {
|
||||
|
Reference in New Issue
Block a user