Skip to content

dpapathanasiou/photojournalism

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

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.

Architecture & Design

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).

Getting Started

Build and run as a local binary

  • Install Rust and clone this repo
  • All the tests should pass: cargo test
  • Set the required PHOTOJOURNALISM_ environment variables (confg.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:

  • /health is 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 of NewsPhoto structs (the actual number of results produced depends on the value of the PHOTOJOURNALISM_PAGE_SIZE environment 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"
    }
]

Host your own instance

All 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 (confg.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).

Contribute

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.

About

This is an experiment in photojournalism, consuming the news of the day primarily as images, rather than text.

Resources

License

Stars

Watchers

Forks

Packages

No packages published