Skip to content

Conversation

Scrub000
Copy link
Contributor

@Scrub000 Scrub000 commented Jun 3, 2025

This PR adds a WWF Australia bridge for https://wwf.org.au/. Specifically for the news and blog posts.

The articles cannot be scraped by HTML, as they are not present on a wget. Instead, we fetch the articles via https://291t4y9i4t-dsn.algolia.net/1/indexes/wwf_website_prod_date_sorted/query with the application key and API key. In addition, we fetch individual article data via accessing https://wwf.org.au/_next/data/$buildId/news/{$hit['publishedYear']}/$slug.json (w/ or w/o the published year if a blog or news article).

Copy link

github-actions bot commented Jun 3, 2025

Pull request artifacts

Bridge Context Status
WWFAustralia 1 untitled (pr) ✔️

last change: Tuesday 2025-06-03 10:11:49

@Scrub000 Scrub000 force-pushed the add-wwf-australia-bridge branch from fb0b72f to 3b95814 Compare June 3, 2025 10:10
],
]);

$response = file_get_contents($apiUrl, false, $context);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function is not allowed

$response = file_get_contents($apiUrl, false, $context);

if ($response === false) {
returnServerError('Failed to fetch data from WWF API');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fn is renamed

@@ -0,0 +1,241 @@
<?php

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New code files MUST have declare(strict_types=1); at the top of file

returnServerError('Unable to extract Next.js buildId from main page');
}

$apiUrl = 'https://291t4y9i4t-dsn.algolia.net/1/indexes/wwf_website_prod_date_sorted/query';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm unsure if it's a good idea to depend on this 3rd party service...

@dvikan
Copy link
Contributor

dvikan commented Sep 12, 2025

add a new commit to trigger ci

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants