-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[WWFAustraliaBridge] Add bridge #4578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Pull request artifacts
last change: Tuesday 2025-06-03 10:11:49 |
fb0b72f
to
3b95814
Compare
], | ||
]); | ||
|
||
$response = file_get_contents($apiUrl, false, $context); |
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
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 | |||
|
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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...
add a new commit to trigger ci |
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 viahttps://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 accessinghttps://wwf.org.au/_next/data/$buildId/news/{$hit['publishedYear']}/$slug.json
(w/ or w/o the published year if a blog or news article).