Skip to content

Commit

Permalink
Add stealth and increase retries + timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
alistairjcbrown committed Nov 18, 2024
1 parent 94c4020 commit af2ff67
Show file tree
Hide file tree
Showing 4 changed files with 415 additions and 123 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,20 @@ jobs:
echo "currentDate=$(TZ=Europe/London date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
echo "currentTime=$(TZ=Europe/London date +'%H:%M:%S')" >> "$GITHUB_OUTPUT"
# Generate files (order is important)
# Hydration calls to The Movie DB are cached, so earlier calls with more
# specific data may provide better results to subsequent calls which then
# get a cache hit.

# BFI runs needs a full browser and are flaky, so retry if they initially fail
- name: npm run generate bfi.org.uk-imax
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
retry_wait_seconds: 5
max_attempts: 5
timeout_minutes: 15
retry_wait_seconds: 30
max_attempts: 10
command: xvfb-run npm run generate bfi.org.uk-imax
- name: npm run generate bfi.org.uk-southbank
uses: nick-fields/retry@v3
with:
timeout_minutes: 20
retry_wait_seconds: 5
max_attempts: 5
timeout_minutes: 30
retry_wait_seconds: 60
max_attempts: 10
command: xvfb-run npm run generate bfi.org.uk-southbank

# All other cinema site runs use data which can be fetched
Expand Down
5 changes: 4 additions & 1 deletion common/bfi.org.uk/retrieve.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
const cheerio = require("cheerio");
const { format, addYears } = require("date-fns");
const { chromium } = require("playwright");
const { chromium } = require("playwright-extra");
const slugify = require("slugify");
const { dailyCache } = require("../cache");

const stealth = require("puppeteer-extra-plugin-stealth")();
chromium.use(stealth);

const dateFormat = "yyyy-MM-dd";

async function getPageWithPlaywright(url, cacheKey, callback) {
Expand Down
Loading

0 comments on commit af2ff67

Please sign in to comment.