This is an experiment in photojournalism, consuming the news of the day primarily as images, rather than text.
It is a kaleidescope of the world right now, an instagram without the narcissism.
This is an RSS feed parser, written in Rust, using a simple shared memory construct for its internal "database".
The images are presented as direct links from their sources, and are not stored beyond their availability in the live feed, nor are they altered or processed in any way.
All credits and IP ownership remain with their respective owners.
In addition to the web view, which is based on the boostrap album, there is a rudimentary API for fetching the next batch of images from a given starting point.
The site does not issue cookies, nor is there any type of authentication required.
An example is now up and running at saruzai.com (see the section below on how to host your own instance).
- Install Rust and clone this repo
- All the tests should pass:
cargo test - Set the required
PHOTOJOURNALISM_environment variables (config.toml has appropriate defaults) and run:cargo run
Opening a browser to http://0.0.0.0:9000/ (or whatever value you used for PHOTOJOURNALISM_SERVER) should result in an album view of the first set of current photos.
You can also confirm using the two API endpoints:
/healthis a health check that also returns a summary of the currently loaded content
curl http://0.0.0.0:9000/health
{
"feeds": 10,
"photos": 272
}/api/next/{start_at_index}returns a list ofNewsPhotostructs (the actual number of results produced depends on the value of thePHOTOJOURNALISM_PAGE_SIZEenvironment variable)
curl http://0.0.0.0:9000/api/next/0
[
{
"image_url": "https://static01.nyt.com/images/2023/11/23/multimedia/23finland-border-kmbp/23finland-border-kmbp-mediumSquareAt3X.jpg",
"story_url": "https://www.nytimes.com/2023/11/23/world/europe/finland-russia-border-migrants.html",
"description": "Finnish border guards escorting migrants at the international crossing with Russia near Salla, Finland, on Thursday.",
"credit": "Jussi Nukari/Lehtikuva, via Associated Press"
},
{
"image_url": "https://static01.nyt.com/images/2023/11/23/multimedia/23themorning-lead-promo/23themorning-lead-bmhq-mediumSquareAt3X.jpg",
"story_url": "https://www.nytimes.com/2023/11/23/briefing/thanksgiving-pep-talk.html",
"description": "A Thanksgiving Pep Talk",
"credit": "Johnny Miller for The New York Times"
}
]Use the Dockerfile to create and run this application in a container; in addition to docker, this code and instructions have been confirmed to work under Rancher Desktop, and colima (use --arch x86_64 if it's not the default) as well:
DOCKER_BUILDKIT=1 docker build --tag photojournalism --file Dockerfile .docker run -p 9000:9000 \
-e PHOTOJOURNALISM_SERVER='0.0.0.0:9000' \
-e PHOTOJOURNALISM_PAGE_SIZE=6 \
-e PHOTOJOURNALISM_FETCH_INTERVAL=3600 \
-e PHOTOJOURNALISM_FEED_LIST='/app/feeds.txt' \
-e PHOTOJOURNALISM_STATIC_PATH='/app' \
-e RUST_BACKTRACE=1 \
-e RUST_LOG='debug' \
--name photojournalism-container \
photojournalismnote that the host defined in PHOTOJOURNALISM_SERVER must be 0.0.0.0 otherwise connecting from outside the container fails.
Opening a browser to http://0.0.0.0:9000/ or running these commands from outside the container should result in successful responses:
curl http://0.0.0.0:9000/health
curl http://0.0.0.0:9000/api/next/0Attach to the running image:
docker exec -it photojournalism-container /bin/shAll you need are the bundle of files in the static folder, and a self-contained executable file, which you can create by running cargo build --release (the single photojournalism binary file gets built in the target/release folder).
Set the required PHOTOJOURNALISM_ environment variables (config.toml has appropriate defaults) to match your filesystem layout before running it.
Optionally, you can use something like systemd on linux to run it as a service, so that it starts automatically on system start and reboots.
If you host it under your own domain, a proxy service such as nginx, along with free SSL certificates from Let's Encrypt are useful add-ons.
Digital Ocean is a particularly good hosting provider to consider, especially given their excellent tutorials for all of the above (using this link to sign up gets you $200 in credit, and I gain a small referral credit as well).
Pull requests, for either improving the code, or adding to the list of feeds (or both) are welcome!
In particular, if you come across (yet) another feed which provides images differently than what the parser can currently process, please consider taking a snapshot, adding it to the test fixtures, and updating the parsing logic, with a corresponding test case.