Improvements and docker

This commit is contained in:
Krzysztof Płaczek
2025-09-18 15:37:41 +02:00
parent 9a66134469
commit 3046780f1b
15 changed files with 356 additions and 889 deletions

View File

@@ -1,9 +1,19 @@
<?php
if (!file_exists('public/posts_2023.json')) {
file_put_contents('public/posts_2023.json', file_get_contents('https://bookmeter.xyz/api/posts?edition=2023'));
file_put_contents('public/posts_2023.json', download_posts('https://bookmeter.xyz/api/posts?edition=2023'));
}
if (!file_exists('public/posts_2024.json')) {
file_put_contents('public/posts_2024.json', file_get_contents('https://bookmeter.xyz/api/posts?edition=2024'));
file_put_contents('public/posts_2024.json', download_posts('https://bookmeter.xyz/api/posts?edition=2024'));
}
file_put_contents('public/posts_2025.json', download_posts('https://bookmeter.xyz/api/posts?edition=2025'));
function download_posts(string $url): false|string
{
$posts = file_get_contents($url);
$posts = json_decode($posts, true);
array_walk($posts, function (&$item) {
unset($item['image']);
});
return json_encode($posts);
}
file_put_contents('public/posts_2025.json', file_get_contents('https://bookmeter.xyz/api/posts?edition=2025'));