1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 18:21:07 +01:00
Files
niveum/configs/lb.nix

29 lines
880 B
Nix
Raw Permalink Normal View History

2021-10-07 00:29:50 +02:00
{
2022-03-10 21:52:12 +01:00
lib,
pkgs,
...
2025-12-27 22:22:54 +01:00
}:
{
2021-10-07 00:29:50 +02:00
systemd.services.lb-subscription = {
enable = true;
2025-12-27 22:22:54 +01:00
wants = [ "network-online.target" ];
2021-10-07 00:29:50 +02:00
startAt = "weekly";
serviceConfig = {
user = "kfm";
2023-08-10 17:52:03 +02:00
WorkingDirectory = "/home/kfm/cloud/nextcloud/Books/Germanistik/LB";
2021-10-07 00:29:50 +02:00
};
script = ''
first_year=2019
for year in $(${pkgs.coreutils}/bin/seq "$first_year" "$(date +%Y)"); do
${pkgs.curl}/bin/curl -sSL "https://www.literarische-blaetter.de/jahrgang-$year/" \
2022-01-11 23:18:43 +01:00
| ${pkgs.htmlq}/bin/htmlq --attribute href 'ul.slides a' \
2021-10-07 00:29:50 +02:00
| while read -r month; do
${pkgs.curl}/bin/curl -sSL "$month" \
2022-01-11 23:18:43 +01:00
| ${pkgs.htmlq}/bin/htmlq --attribute src iframe \
2021-10-07 00:29:50 +02:00
| ${pkgs.gnused}/bin/sed 's/.*?pdf=//;s/?wp-hosted.*//'
done
done | ${pkgs.findutils}/bin/xargs ${pkgs.wget}/bin/wget --no-clobber
'';
};
}