auto-archiver


Nameauto-archiver JSON
Version 0.12.0 PyPI version JSON
download
home_pageNone
SummaryEasily archive online media content
upload_time2024-08-21 12:37:38
maintainerNone
docs_urlNone
authorBellingcat
requires_python>=3.10
licenseMIT
keywords archive oosi osint scraping
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center">Auto Archiver</h1>

[![PyPI version](https://badge.fury.io/py/auto-archiver.svg)](https://badge.fury.io/py/auto-archiver)
[![Docker Image Version (latest by date)](https://img.shields.io/docker/v/bellingcat/auto-archiver?label=version&logo=docker)](https://hub.docker.com/r/bellingcat/auto-archiver)
<!-- ![Docker Pulls](https://img.shields.io/docker/pulls/bellingcat/auto-archiver) -->
<!-- [![PyPI download month](https://img.shields.io/pypi/dm/auto-archiver.svg)](https://pypi.python.org/pypi/auto-archiver/) -->
<!-- [![Documentation Status](https://readthedocs.org/projects/vk-url-scraper/badge/?version=latest)](https://vk-url-scraper.readthedocs.io/en/latest/?badge=latest) -->


Read the [article about Auto Archiver on bellingcat.com](https://www.bellingcat.com/resources/2022/09/22/preserve-vital-online-content-with-bellingcats-auto-archiver-tool/).


Python tool to automatically archive social media posts, videos, and images from a Google Sheets, the console, and more. Uses different archivers depending on the platform, and can save content to local storage, S3 bucket (Digital Ocean Spaces, AWS, ...), and Google Drive. If using Google Sheets as the source for links, it will be updated with information about the archived content. It can be run manually or on an automated basis.

There are 3 ways to use the auto-archiver:
1. (easiest installation) via docker
2. (local python install) `pip install auto-archiver`
3. (legacy/development) clone and manually install from repo (see legacy [tutorial video](https://youtu.be/VfAhcuV2tLQ))

But **you always need a configuration/orchestration file**, which is where you'll configure where/what/how to archive. Make sure you read [orchestration](#orchestration).


## How to install and run the auto-archiver

### Option 1 - docker

[![dockeri.co](https://dockerico.blankenship.io/image/bellingcat/auto-archiver)](https://hub.docker.com/r/bellingcat/auto-archiver)

Docker works like a virtual machine running inside your computer, it isolates everything and makes installation simple. Since it is an isolated environment when you need to pass it your orchestration file or get downloaded media out of docker you will need to connect folders on your machine with folders inside docker with the `-v` volume flag.


1. install [docker](https://docs.docker.com/get-docker/)
2. pull the auto-archiver docker [image](https://hub.docker.com/r/bellingcat/auto-archiver) with `docker pull bellingcat/auto-archiver`
3. run the docker image locally in a container: `docker run --rm -v $PWD/secrets:/app/secrets -v $PWD/local_archive:/app/local_archive bellingcat/auto-archiver --config secrets/orchestration.yaml` breaking this command down:
   1. `docker run` tells docker to start a new container (an instance of the image)
   2. `--rm` makes sure this container is removed after execution (less garbage locally)
   3. `-v $PWD/secrets:/app/secrets` - your secrets folder
      1. `-v` is a volume flag which means a folder that you have on your computer will be connected to a folder inside the docker container
      2. `$PWD/secrets` points to a `secrets/` folder in your current working directory (where your console points to), we use this folder as a best practice to hold all the secrets/tokens/passwords/... you use
      3. `/app/secrets` points to the path the docker container where this image can be found
   4.  `-v $PWD/local_archive:/app/local_archive` - (optional) if you use local_storage
       1.  `-v` same as above, this is a volume instruction
       2.  `$PWD/local_archive` is a folder `local_archive/` in case you want to archive locally and have the files accessible outside docker
       3.  `/app/local_archive` is a folder inside docker that you can reference in your orchestration.yml file 

### Option 2 - python package

<details><summary><code>Python package instructions</code></summary>

1. make sure you have python 3.10 or higher installed
2. install the package `pip/pipenv/conda install auto-archiver`
3. test it's installed with `auto-archiver --help`
4. run it with your orchestration file and pass any flags you want in the command line `auto-archiver --config secrets/orchestration.yaml` if your orchestration file is inside a `secrets/`, which we advise
   
You will also need [ffmpeg](https://www.ffmpeg.org/), [firefox](https://www.mozilla.org/en-US/firefox/new/) and [geckodriver](https://github.com/mozilla/geckodriver/releases), and optionally [fonts-noto](https://fonts.google.com/noto). Similar to the local installation. 

</details>


### Option 3 - local installation
This can also be used for development.

<details><summary><code>Legacy instructions, only use if docker/package is not an option</code></summary>


Install the following locally:
1. [ffmpeg](https://www.ffmpeg.org/) must also be installed locally for this tool to work. 
2. [firefox](https://www.mozilla.org/en-US/firefox/new/) and [geckodriver](https://github.com/mozilla/geckodriver/releases) on a path folder like `/usr/local/bin`. 
3. (optional) [fonts-noto](https://fonts.google.com/noto) to deal with multiple unicode characters during selenium/geckodriver's screenshots: `sudo apt install fonts-noto -y`. 

Clone and run:
1. `git clone https://github.com/bellingcat/auto-archiver`
2. `pipenv install`
3. `pipenv run python -m src.auto_archiver --config secrets/orchestration.yaml`


</details><br/>

# Orchestration
The archiver work is orchestrated by the following workflow (we call each a **step**): 
1. **Feeder** gets the links (from a spreadsheet, from the console, ...)
2. **Archiver** tries to archive the link (twitter, youtube, ...)
3. **Enricher** adds more info to the content (hashes, thumbnails, ...)
4. **Formatter** creates a report from all the archived content (HTML, PDF, ...)
5. **Database** knows what's been archived and also stores the archive result (spreadsheet, CSV, or just the console)

To setup an auto-archiver instance create an `orchestration.yaml` which contains the workflow you would like. We advise you put this file into a `secrets/` folder and do not share it with others because it will contain passwords and other secrets. 

The structure of orchestration file is split into 2 parts: `steps` (what **steps** to use) and `configurations` (how those steps should behave), here's a simplification:
```yaml
# orchestration.yaml content
steps:
  feeder: gsheet_feeder
  archivers: # order matters
    - youtubedl_archiver
  enrichers:
    - thumbnail_enricher
  formatter: html_formatter
  storages:
    - local_storage
  databases:
    - gsheet_db

configurations:
  gsheet_feeder:
    sheet: "your google sheet name"
    header: 2 # row with header for your sheet
  # ... configurations for the other steps here ...
```

To see all available `steps` (which archivers, storages, databases, ...) exist check the [example.orchestration.yaml](example.orchestration.yaml).

All the `configurations` in the `orchestration.yaml` file (you can name it differently but need to pass it in the `--config FILENAME` argument) can be seen in the console by using the `--help` flag. They can also be overwritten, for example if you are using the `cli_feeder` to archive from the command line and want to provide the URLs you should do:

```bash
auto-archiver --config secrets/orchestration.yaml --cli_feeder.urls="url1,url2,url3"
```

Here's the complete workflow that the auto-archiver goes through:
```mermaid
graph TD
    s((start)) --> F(fa:fa-table Feeder)
    F -->|get and clean URL| D1{fa:fa-database Database}
    D1 -->|is already archived| e((end))
    D1 -->|not yet archived| a(fa:fa-download Archivers)
    a -->|got media| E(fa:fa-chart-line Enrichers)
    E --> S[fa:fa-box-archive Storages]
    E --> Fo(fa:fa-code Formatter)
    Fo --> S
    Fo -->|update database| D2(fa:fa-database Database)
    D2 --> e
```

## Orchestration checklist
Use this to make sure you help making sure you did all the required steps:
* [ ] you have a `/secrets` folder with all your configuration files including
  * [ ] a orchestration file eg: `orchestration.yaml` pointing to the correct location of other files
  * [ ] (optional if you use GoogleSheets) you have a `service_account.json` (see [how-to](https://gspread.readthedocs.io/en/latest/oauth2.html#for-bots-using-service-account))
  * [ ] (optional for telegram) a `anon.session` which appears after the 1st run where you login to telegram
    * if you use private channels you need to add `channel_invites` and set `join_channels=true` at least once
  * [ ] (optional for VK) a `vk_config.v2.json`
  * [ ] (optional for using GoogleDrive storage) `gd-token.json` (see [help script](scripts/create_update_gdrive_oauth_token.py))
  * [ ] (optional for instagram) `instaloader.session` file which appears after the 1st run and login in instagram
  * [ ] (optional for browsertrix) `profile.tar.gz` file

#### Example invocations
The recommended way to run the auto-archiver is through Docker. The invocations below will run the auto-archiver Docker image using a configuration file that you have specified

```bash
# all the configurations come from ./secrets/orchestration.yaml
docker run --rm -v $PWD/secrets:/app/secrets -v $PWD/local_archive:/app/local_archive bellingcat/auto-archiver --config secrets/orchestration.yaml
# uses the same configurations but for another google docs sheet 
# with a header on row 2 and with some different column names
# notice that columns is a dictionary so you need to pass it as JSON and it will override only the values provided
docker run --rm -v $PWD/secrets:/app/secrets -v $PWD/local_archive:/app/local_archive bellingcat/auto-archiver --config secrets/orchestration.yaml --gsheet_feeder.sheet="use it on another sheets doc" --gsheet_feeder.header=2 --gsheet_feeder.columns='{"url": "link"}'
# all the configurations come from orchestration.yaml and specifies that s3 files should be private
docker run --rm -v $PWD/secrets:/app/secrets -v $PWD/local_archive:/app/local_archive bellingcat/auto-archiver --config secrets/orchestration.yaml --s3_storage.private=1
```

The auto-archiver can also be run locally, if pre-requisites are correctly configured. Equivalent invocations are below.

```bash
# all the configurations come from ./secrets/orchestration.yaml
auto-archiver --config secrets/orchestration.yaml
# uses the same configurations but for another google docs sheet 
# with a header on row 2 and with some different column names
# notice that columns is a dictionary so you need to pass it as JSON and it will override only the values provided
auto-archiver --config secrets/orchestration.yaml --gsheet_feeder.sheet="use it on another sheets doc" --gsheet_feeder.header=2 --gsheet_feeder.columns='{"url": "link"}'
# all the configurations come from orchestration.yaml and specifies that s3 files should be private
auto-archiver --config secrets/orchestration.yaml --s3_storage.private=1
```

### Extra notes on configuration
#### Google Drive
To use Google Drive storage you need the id of the shared folder in the `config.yaml` file which must be shared with the service account eg `autoarchiverservice@auto-archiver-111111.iam.gserviceaccount.com` and then you can use `--storage=gd`

#### Telethon + Instagram with telegram bot
The first time you run, you will be prompted to do a authentication with the phone number associated, alternatively you can put your `anon.session` in the root.

#### Atlos
When integrating with [Atlos](https://atlos.org), you will need to provide an API token in your configuration. You can learn more about Atlos and how to get an API token [here](https://docs.atlos.org/technical/api). You will have to provide this token to the `atlos_feeder`, `atlos_storage`, and `atlos_db` steps in your orchestration file. If you use a custom or self-hosted Atlos instance, you can also specify the `atlos_url` option to point to your custom instance's URL. For example:

```yaml
# orchestration.yaml content
steps:
  feeder: atlos_feeder
  archivers: # order matters
    - youtubedl_archiver
  enrichers:
    - thumbnail_enricher
    - hash_enricher
  formatter: html_formatter
  storages:
    - atlos_storage
  databases:
    - console_db
    - atlos_db

configurations:
  atlos_feeder:
    atlos_url: "https://platform.atlos.org" # optional
    api_token: "...your API token..."
  atlos_db:
    atlos_url: "https://platform.atlos.org" # optional
    api_token: "...your API token..."
  atlos_storage:
    atlos_url: "https://platform.atlos.org" # optional
    api_token: "...your API token..."
  hash_enricher:
    algorithm: "SHA-256"
```

## Running on Google Sheets Feeder (gsheet_feeder)
The `--gsheet_feeder.sheet` property is the name of the Google Sheet to check for URLs. 
This sheet must have been shared with the Google Service account used by `gspread`. 
This sheet must also have specific columns (case-insensitive) in the `header` as specified in [Gsheet.configs](src/auto_archiver/utils/gsheet.py). The default names of these columns and their purpose is:

Inputs:

* **Link** *(required)*: the URL of the post to archive
* **Destination folder**: custom folder for archived file (regardless of storage)

Outputs:
* **Archive status** *(required)*: Status of archive operation
* **Archive location**: URL of archived post
* **Archive date**: Date archived
* **Thumbnail**: Embeds a thumbnail for the post in the spreadsheet
* **Timestamp**: Timestamp of original post
* **Title**: Post title
* **Text**: Post text
* **Screenshot**: Link to screenshot of post
* **Hash**: Hash of archived HTML file (which contains hashes of post media) - for checksums/verification
* **Perceptual Hash**: Perceptual hashes of found images - these can be used for de-duplication of content
* **WACZ**: Link to a WACZ web archive of post
* **ReplayWebpage**: Link to a ReplayWebpage viewer of the WACZ archive

For example, this is a spreadsheet configured with all of the columns for the auto archiver and a few URLs to archive. (Note that the column names are not case sensitive.)

![A screenshot of a Google Spreadsheet with column headers defined as above, and several Youtube and Twitter URLs in the "Link" column](docs/demo-before.png)

Now the auto archiver can be invoked, with this command in this example: `docker run --rm -v $PWD/secrets:/app/secrets -v $PWD/local_archive:/app/local_archive bellingcat/auto-archiver:dockerize --config secrets/orchestration-global.yaml --gsheet_feeder.sheet "Auto archive test 2023-2"`. Note that the sheet name has been overridden/specified in the command line invocation.

When the auto archiver starts running, it updates the "Archive status" column.

![A screenshot of a Google Spreadsheet with column headers defined as above, and several Youtube and Twitter URLs in the "Link" column. The auto archiver has added "archive in progress" to one of the status columns.](docs/demo-progress.png)

The links are downloaded and archived, and the spreadsheet is updated to the following:

![A screenshot of a Google Spreadsheet with videos archived and metadata added per the description of the columns above.](docs/demo-after.png)

Note that the first row is skipped, as it is assumed to be a header row (`--gsheet_feeder.header=1` and you can change it if you use more rows above). Rows with an empty URL column, or a non-empty archive column are also skipped. All sheets in the document will be checked.

The "archive location" link contains the path of the archived file, in local storage, S3, or in Google Drive.

![The archive result for a link in the demo sheet.](docs/demo-archive.png)

---
## Development
Use `python -m src.auto_archiver --config secrets/orchestration.yaml` to run from the local development environment.

#### Docker development
working with docker locally:
  * `docker build . -t auto-archiver` to build a local image
  * `docker run --rm -v $PWD/secrets:/app/secrets auto-archiver  --config secrets/orchestration.yaml`
    * to use local archive, also create a volume `-v` for it by adding `-v $PWD/local_archive:/app/local_archive`


manual release to docker hub
  * `docker image tag auto-archiver bellingcat/auto-archiver:latest`
  * `docker push bellingcat/auto-archiver`

#### RELEASE
* update version in [version.py](src/auto_archiver/version.py)
* go to github releases > new release > use `vx.y.z` for matching version notation
  * package is automatically updated in pypi
  * docker image is automatically pushed to dockerhup

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "auto-archiver",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "archive, oosi, osint, scraping",
    "author": "Bellingcat",
    "author_email": "tech@bellingcat.com",
    "download_url": "https://files.pythonhosted.org/packages/e9/4d/cd3b56cdb32af4991d582c8ffc1e8d28019fbf530f948fcc26daa08efad7/auto_archiver-0.12.0.tar.gz",
    "platform": "any",
    "description": "<h1 align=\"center\">Auto Archiver</h1>\n\n[![PyPI version](https://badge.fury.io/py/auto-archiver.svg)](https://badge.fury.io/py/auto-archiver)\n[![Docker Image Version (latest by date)](https://img.shields.io/docker/v/bellingcat/auto-archiver?label=version&logo=docker)](https://hub.docker.com/r/bellingcat/auto-archiver)\n<!-- ![Docker Pulls](https://img.shields.io/docker/pulls/bellingcat/auto-archiver) -->\n<!-- [![PyPI download month](https://img.shields.io/pypi/dm/auto-archiver.svg)](https://pypi.python.org/pypi/auto-archiver/) -->\n<!-- [![Documentation Status](https://readthedocs.org/projects/vk-url-scraper/badge/?version=latest)](https://vk-url-scraper.readthedocs.io/en/latest/?badge=latest) -->\n\n\nRead the [article about Auto Archiver on bellingcat.com](https://www.bellingcat.com/resources/2022/09/22/preserve-vital-online-content-with-bellingcats-auto-archiver-tool/).\n\n\nPython tool to automatically archive social media posts, videos, and images from a Google Sheets, the console, and more. Uses different archivers depending on the platform, and can save content to local storage, S3 bucket (Digital Ocean Spaces, AWS, ...), and Google Drive. If using Google Sheets as the source for links, it will be updated with information about the archived content. It can be run manually or on an automated basis.\n\nThere are 3 ways to use the auto-archiver:\n1. (easiest installation) via docker\n2. (local python install) `pip install auto-archiver`\n3. (legacy/development) clone and manually install from repo (see legacy [tutorial video](https://youtu.be/VfAhcuV2tLQ))\n\nBut **you always need a configuration/orchestration file**, which is where you'll configure where/what/how to archive. Make sure you read [orchestration](#orchestration).\n\n\n## How to install and run the auto-archiver\n\n### Option 1 - docker\n\n[![dockeri.co](https://dockerico.blankenship.io/image/bellingcat/auto-archiver)](https://hub.docker.com/r/bellingcat/auto-archiver)\n\nDocker works like a virtual machine running inside your computer, it isolates everything and makes installation simple. Since it is an isolated environment when you need to pass it your orchestration file or get downloaded media out of docker you will need to connect folders on your machine with folders inside docker with the `-v` volume flag.\n\n\n1. install [docker](https://docs.docker.com/get-docker/)\n2. pull the auto-archiver docker [image](https://hub.docker.com/r/bellingcat/auto-archiver) with `docker pull bellingcat/auto-archiver`\n3. run the docker image locally in a container: `docker run --rm -v $PWD/secrets:/app/secrets -v $PWD/local_archive:/app/local_archive bellingcat/auto-archiver --config secrets/orchestration.yaml` breaking this command down:\n   1. `docker run` tells docker to start a new container (an instance of the image)\n   2. `--rm` makes sure this container is removed after execution (less garbage locally)\n   3. `-v $PWD/secrets:/app/secrets` - your secrets folder\n      1. `-v` is a volume flag which means a folder that you have on your computer will be connected to a folder inside the docker container\n      2. `$PWD/secrets` points to a `secrets/` folder in your current working directory (where your console points to), we use this folder as a best practice to hold all the secrets/tokens/passwords/... you use\n      3. `/app/secrets` points to the path the docker container where this image can be found\n   4.  `-v $PWD/local_archive:/app/local_archive` - (optional) if you use local_storage\n       1.  `-v` same as above, this is a volume instruction\n       2.  `$PWD/local_archive` is a folder `local_archive/` in case you want to archive locally and have the files accessible outside docker\n       3.  `/app/local_archive` is a folder inside docker that you can reference in your orchestration.yml file \n\n### Option 2 - python package\n\n<details><summary><code>Python package instructions</code></summary>\n\n1. make sure you have python 3.10 or higher installed\n2. install the package `pip/pipenv/conda install auto-archiver`\n3. test it's installed with `auto-archiver --help`\n4. run it with your orchestration file and pass any flags you want in the command line `auto-archiver --config secrets/orchestration.yaml` if your orchestration file is inside a `secrets/`, which we advise\n   \nYou will also need [ffmpeg](https://www.ffmpeg.org/), [firefox](https://www.mozilla.org/en-US/firefox/new/) and [geckodriver](https://github.com/mozilla/geckodriver/releases), and optionally [fonts-noto](https://fonts.google.com/noto). Similar to the local installation. \n\n</details>\n\n\n### Option 3 - local installation\nThis can also be used for development.\n\n<details><summary><code>Legacy instructions, only use if docker/package is not an option</code></summary>\n\n\nInstall the following locally:\n1. [ffmpeg](https://www.ffmpeg.org/) must also be installed locally for this tool to work. \n2. [firefox](https://www.mozilla.org/en-US/firefox/new/) and [geckodriver](https://github.com/mozilla/geckodriver/releases) on a path folder like `/usr/local/bin`. \n3. (optional) [fonts-noto](https://fonts.google.com/noto) to deal with multiple unicode characters during selenium/geckodriver's screenshots: `sudo apt install fonts-noto -y`. \n\nClone and run:\n1. `git clone https://github.com/bellingcat/auto-archiver`\n2. `pipenv install`\n3. `pipenv run python -m src.auto_archiver --config secrets/orchestration.yaml`\n\n\n</details><br/>\n\n# Orchestration\nThe archiver work is orchestrated by the following workflow (we call each a **step**): \n1. **Feeder** gets the links (from a spreadsheet, from the console, ...)\n2. **Archiver** tries to archive the link (twitter, youtube, ...)\n3. **Enricher** adds more info to the content (hashes, thumbnails, ...)\n4. **Formatter** creates a report from all the archived content (HTML, PDF, ...)\n5. **Database** knows what's been archived and also stores the archive result (spreadsheet, CSV, or just the console)\n\nTo setup an auto-archiver instance create an `orchestration.yaml` which contains the workflow you would like. We advise you put this file into a `secrets/` folder and do not share it with others because it will contain passwords and other secrets. \n\nThe structure of orchestration file is split into 2 parts: `steps` (what **steps** to use) and `configurations` (how those steps should behave), here's a simplification:\n```yaml\n# orchestration.yaml content\nsteps:\n  feeder: gsheet_feeder\n  archivers: # order matters\n    - youtubedl_archiver\n  enrichers:\n    - thumbnail_enricher\n  formatter: html_formatter\n  storages:\n    - local_storage\n  databases:\n    - gsheet_db\n\nconfigurations:\n  gsheet_feeder:\n    sheet: \"your google sheet name\"\n    header: 2 # row with header for your sheet\n  # ... configurations for the other steps here ...\n```\n\nTo see all available `steps` (which archivers, storages, databases, ...) exist check the [example.orchestration.yaml](example.orchestration.yaml).\n\nAll the `configurations` in the `orchestration.yaml` file (you can name it differently but need to pass it in the `--config FILENAME` argument) can be seen in the console by using the `--help` flag. They can also be overwritten, for example if you are using the `cli_feeder` to archive from the command line and want to provide the URLs you should do:\n\n```bash\nauto-archiver --config secrets/orchestration.yaml --cli_feeder.urls=\"url1,url2,url3\"\n```\n\nHere's the complete workflow that the auto-archiver goes through:\n```mermaid\ngraph TD\n    s((start)) --> F(fa:fa-table Feeder)\n    F -->|get and clean URL| D1{fa:fa-database Database}\n    D1 -->|is already archived| e((end))\n    D1 -->|not yet archived| a(fa:fa-download Archivers)\n    a -->|got media| E(fa:fa-chart-line Enrichers)\n    E --> S[fa:fa-box-archive Storages]\n    E --> Fo(fa:fa-code Formatter)\n    Fo --> S\n    Fo -->|update database| D2(fa:fa-database Database)\n    D2 --> e\n```\n\n## Orchestration checklist\nUse this to make sure you help making sure you did all the required steps:\n* [ ] you have a `/secrets` folder with all your configuration files including\n  * [ ] a orchestration file eg: `orchestration.yaml` pointing to the correct location of other files\n  * [ ] (optional if you use GoogleSheets) you have a `service_account.json` (see [how-to](https://gspread.readthedocs.io/en/latest/oauth2.html#for-bots-using-service-account))\n  * [ ] (optional for telegram) a `anon.session` which appears after the 1st run where you login to telegram\n    * if you use private channels you need to add `channel_invites` and set `join_channels=true` at least once\n  * [ ] (optional for VK) a `vk_config.v2.json`\n  * [ ] (optional for using GoogleDrive storage) `gd-token.json` (see [help script](scripts/create_update_gdrive_oauth_token.py))\n  * [ ] (optional for instagram) `instaloader.session` file which appears after the 1st run and login in instagram\n  * [ ] (optional for browsertrix) `profile.tar.gz` file\n\n#### Example invocations\nThe recommended way to run the auto-archiver is through Docker. The invocations below will run the auto-archiver Docker image using a configuration file that you have specified\n\n```bash\n# all the configurations come from ./secrets/orchestration.yaml\ndocker run --rm -v $PWD/secrets:/app/secrets -v $PWD/local_archive:/app/local_archive bellingcat/auto-archiver --config secrets/orchestration.yaml\n# uses the same configurations but for another google docs sheet \n# with a header on row 2 and with some different column names\n# notice that columns is a dictionary so you need to pass it as JSON and it will override only the values provided\ndocker run --rm -v $PWD/secrets:/app/secrets -v $PWD/local_archive:/app/local_archive bellingcat/auto-archiver --config secrets/orchestration.yaml --gsheet_feeder.sheet=\"use it on another sheets doc\" --gsheet_feeder.header=2 --gsheet_feeder.columns='{\"url\": \"link\"}'\n# all the configurations come from orchestration.yaml and specifies that s3 files should be private\ndocker run --rm -v $PWD/secrets:/app/secrets -v $PWD/local_archive:/app/local_archive bellingcat/auto-archiver --config secrets/orchestration.yaml --s3_storage.private=1\n```\n\nThe auto-archiver can also be run locally, if pre-requisites are correctly configured. Equivalent invocations are below.\n\n```bash\n# all the configurations come from ./secrets/orchestration.yaml\nauto-archiver --config secrets/orchestration.yaml\n# uses the same configurations but for another google docs sheet \n# with a header on row 2 and with some different column names\n# notice that columns is a dictionary so you need to pass it as JSON and it will override only the values provided\nauto-archiver --config secrets/orchestration.yaml --gsheet_feeder.sheet=\"use it on another sheets doc\" --gsheet_feeder.header=2 --gsheet_feeder.columns='{\"url\": \"link\"}'\n# all the configurations come from orchestration.yaml and specifies that s3 files should be private\nauto-archiver --config secrets/orchestration.yaml --s3_storage.private=1\n```\n\n### Extra notes on configuration\n#### Google Drive\nTo use Google Drive storage you need the id of the shared folder in the `config.yaml` file which must be shared with the service account eg `autoarchiverservice@auto-archiver-111111.iam.gserviceaccount.com` and then you can use `--storage=gd`\n\n#### Telethon + Instagram with telegram bot\nThe first time you run, you will be prompted to do a authentication with the phone number associated, alternatively you can put your `anon.session` in the root.\n\n#### Atlos\nWhen integrating with [Atlos](https://atlos.org), you will need to provide an API token in your configuration. You can learn more about Atlos and how to get an API token [here](https://docs.atlos.org/technical/api). You will have to provide this token to the `atlos_feeder`, `atlos_storage`, and `atlos_db` steps in your orchestration file. If you use a custom or self-hosted Atlos instance, you can also specify the `atlos_url` option to point to your custom instance's URL. For example:\n\n```yaml\n# orchestration.yaml content\nsteps:\n  feeder: atlos_feeder\n  archivers: # order matters\n    - youtubedl_archiver\n  enrichers:\n    - thumbnail_enricher\n    - hash_enricher\n  formatter: html_formatter\n  storages:\n    - atlos_storage\n  databases:\n    - console_db\n    - atlos_db\n\nconfigurations:\n  atlos_feeder:\n    atlos_url: \"https://platform.atlos.org\" # optional\n    api_token: \"...your API token...\"\n  atlos_db:\n    atlos_url: \"https://platform.atlos.org\" # optional\n    api_token: \"...your API token...\"\n  atlos_storage:\n    atlos_url: \"https://platform.atlos.org\" # optional\n    api_token: \"...your API token...\"\n  hash_enricher:\n    algorithm: \"SHA-256\"\n```\n\n## Running on Google Sheets Feeder (gsheet_feeder)\nThe `--gsheet_feeder.sheet` property is the name of the Google Sheet to check for URLs. \nThis sheet must have been shared with the Google Service account used by `gspread`. \nThis sheet must also have specific columns (case-insensitive) in the `header` as specified in [Gsheet.configs](src/auto_archiver/utils/gsheet.py). The default names of these columns and their purpose is:\n\nInputs:\n\n* **Link** *(required)*: the URL of the post to archive\n* **Destination folder**: custom folder for archived file (regardless of storage)\n\nOutputs:\n* **Archive status** *(required)*: Status of archive operation\n* **Archive location**: URL of archived post\n* **Archive date**: Date archived\n* **Thumbnail**: Embeds a thumbnail for the post in the spreadsheet\n* **Timestamp**: Timestamp of original post\n* **Title**: Post title\n* **Text**: Post text\n* **Screenshot**: Link to screenshot of post\n* **Hash**: Hash of archived HTML file (which contains hashes of post media) - for checksums/verification\n* **Perceptual Hash**: Perceptual hashes of found images - these can be used for de-duplication of content\n* **WACZ**: Link to a WACZ web archive of post\n* **ReplayWebpage**: Link to a ReplayWebpage viewer of the WACZ archive\n\nFor example, this is a spreadsheet configured with all of the columns for the auto archiver and a few URLs to archive. (Note that the column names are not case sensitive.)\n\n![A screenshot of a Google Spreadsheet with column headers defined as above, and several Youtube and Twitter URLs in the \"Link\" column](docs/demo-before.png)\n\nNow the auto archiver can be invoked, with this command in this example: `docker run --rm -v $PWD/secrets:/app/secrets -v $PWD/local_archive:/app/local_archive bellingcat/auto-archiver:dockerize --config secrets/orchestration-global.yaml --gsheet_feeder.sheet \"Auto archive test 2023-2\"`. Note that the sheet name has been overridden/specified in the command line invocation.\n\nWhen the auto archiver starts running, it updates the \"Archive status\" column.\n\n![A screenshot of a Google Spreadsheet with column headers defined as above, and several Youtube and Twitter URLs in the \"Link\" column. The auto archiver has added \"archive in progress\" to one of the status columns.](docs/demo-progress.png)\n\nThe links are downloaded and archived, and the spreadsheet is updated to the following:\n\n![A screenshot of a Google Spreadsheet with videos archived and metadata added per the description of the columns above.](docs/demo-after.png)\n\nNote that the first row is skipped, as it is assumed to be a header row (`--gsheet_feeder.header=1` and you can change it if you use more rows above). Rows with an empty URL column, or a non-empty archive column are also skipped. All sheets in the document will be checked.\n\nThe \"archive location\" link contains the path of the archived file, in local storage, S3, or in Google Drive.\n\n![The archive result for a link in the demo sheet.](docs/demo-archive.png)\n\n---\n## Development\nUse `python -m src.auto_archiver --config secrets/orchestration.yaml` to run from the local development environment.\n\n#### Docker development\nworking with docker locally:\n  * `docker build . -t auto-archiver` to build a local image\n  * `docker run --rm -v $PWD/secrets:/app/secrets auto-archiver  --config secrets/orchestration.yaml`\n    * to use local archive, also create a volume `-v` for it by adding `-v $PWD/local_archive:/app/local_archive`\n\n\nmanual release to docker hub\n  * `docker image tag auto-archiver bellingcat/auto-archiver:latest`\n  * `docker push bellingcat/auto-archiver`\n\n#### RELEASE\n* update version in [version.py](src/auto_archiver/version.py)\n* go to github releases > new release > use `vx.y.z` for matching version notation\n  * package is automatically updated in pypi\n  * docker image is automatically pushed to dockerhup\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Easily archive online media content",
    "version": "0.12.0",
    "project_urls": {
        "Bellingcat": "https://www.bellingcat.com",
        "Bug Tracker": "https://github.com/bellingcat/auto-archiver/issues",
        "Source Code": "https://github.com/bellingcat/auto-archiver"
    },
    "split_keywords": [
        "archive",
        " oosi",
        " osint",
        " scraping"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "be5392e96ef0af31b8527653a014d38ba27dfbf81ac4f612a4e11d3c7ebaeba9",
                "md5": "d0f7fab0763bc7a9aa1e2dff594b3ce2",
                "sha256": "3cee45b9a17feba214503eb1be4e8552e40cadbba128964585e0f53a45966fc8"
            },
            "downloads": -1,
            "filename": "auto_archiver-0.12.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d0f7fab0763bc7a9aa1e2dff594b3ce2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 95014,
            "upload_time": "2024-08-21T12:37:36",
            "upload_time_iso_8601": "2024-08-21T12:37:36.795424Z",
            "url": "https://files.pythonhosted.org/packages/be/53/92e96ef0af31b8527653a014d38ba27dfbf81ac4f612a4e11d3c7ebaeba9/auto_archiver-0.12.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e94dcd3b56cdb32af4991d582c8ffc1e8d28019fbf530f948fcc26daa08efad7",
                "md5": "30970fe8977b2782a3074265165cc03f",
                "sha256": "b9f1fb490fc268462325ec3f3c97c425a9c62dd0a2b4e58c771b64e8d29f0a87"
            },
            "downloads": -1,
            "filename": "auto_archiver-0.12.0.tar.gz",
            "has_sig": false,
            "md5_digest": "30970fe8977b2782a3074265165cc03f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 73128,
            "upload_time": "2024-08-21T12:37:38",
            "upload_time_iso_8601": "2024-08-21T12:37:38.540480Z",
            "url": "https://files.pythonhosted.org/packages/e9/4d/cd3b56cdb32af4991d582c8ffc1e8d28019fbf530f948fcc26daa08efad7/auto_archiver-0.12.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-21 12:37:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bellingcat",
    "github_project": "auto-archiver",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "auto-archiver"
}
        
Elapsed time: 1.25460s