This is a dockerized wrapper of Singlefile that allows you to create standalone archives of webpages by calling into a http service. It is intended to be used alonside Lynx, a self-hostable read-it-later app.
Note
This is a forked version of Singlefile-dockerized which is in turn a wrapper around single-file-cli. Take a look at the documentation for those projects to see how it all fits together. The only thing this project adds on to those is the ability to pass in cookies for creating archives of pages behind a login.
Run this container using a docker-compose.yaml file similar to this:
version: '3'
services:
singlefile:
container_name: singlefile
image: ghcr.io/brendanv/lynx-singlefile
entrypoint: python3
command: webserver.py
expose:
- 80
Then any HTTP POST on port 80 with url parameter will respond with the HTML output of SingleFile in the payload:
curl -d 'url=http://www.example.com/' singlefile:80
If you want to create an archive of pages that are behind a login, this image supports a cookies parameter that will be passed along when loading your page.
The cookie parameter expects a JSON-encoded list of strings where each string represents a single cookie. Each individual cookie string must be a comma-separated list of the cookie's (name, value, domain, path, expires, httpOnly, secure, sameSite, url). The first three parameters are required but the rest are optional.
Some python pseudocode:
import json
import requests
cookie = ','.join(['cookie-name', 'cookie-value', 'domain'])
cookies = json.dumps([cookie])
requests.post('singlefile:80', data={'url': url, 'cookies': cookies})