[GH-ISSUE #648] Documentation: document how to pull bookmarks from Firefox Sync #405

Closed
opened 2026-03-01 14:43:16 +03:00 by kerem · 3 comments
Owner

Originally created by @khimaros on GitHub (Feb 6, 2021).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/648

Wiki Page URL

https://github.com/ArchiveBox/ArchiveBox/wiki/Quickstart#2-get-your-list-of-urls-to-archive

Suggested Edit

document how to pull bookmarks and/or history from the Firefox Sync server.

this enables the user to simply bookmark pages they want to archive on their desktop and mobile browser and they will automatically be archived by archivebox.

here's what worked for me.

determine your Firefox Sync client id:

$ python3 -m pip install PyFxA

$ fxa-client --bearer -u <YOUR EMAIL> \
    --account-server https://api.accounts.firefox.com/v1 \
    --oauth-server https://oauth.accounts.firefox.com/v1
# ---- BEARER TOKEN INFO ----
# User: <YOUR EMAIL>
# Scopes: profile
# Account: https://api.accounts.firefox.com/v1
# Oauth: https://oauth.accounts.firefox.com/v1
# Client ID: <YOUR CLIENT ID>
# ---------------------------

import all of your bookmarks into archivebox:

$ git clone https://github.com/eNote-GmbH/syncclient

$ cd syncclient

$ python3 -m pip install -e .

$ python3 syncclient/main.py -u <YOUR EMAIL> --client-id <YOUR CLIENT ID> \
    get_records bookmarks \
        | jq '.[].payload | fromjson | select(.type == "bookmark") | .bmkUri)' \
        | archivebox add

this also works with a self hosted Firefox Sync server by setting the env var TOKENSERVER_URL="https://<YOUR SYNC SERVER>/token". you can configure this to run on a regular schedule eg. via cron.

with a bit of work, you could make this only archive bookmarks with a specific tag or folder.

Originally created by @khimaros on GitHub (Feb 6, 2021). Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/648 ## Wiki Page URL <!-- e.g. https://github.com/pirate/ArchiveBox/wiki/Configuration#use_color --> https://github.com/ArchiveBox/ArchiveBox/wiki/Quickstart#2-get-your-list-of-urls-to-archive ## Suggested Edit <!-- e.g. Please add more example usages, or please fix `xyz` typo to be `abc`. --> document how to pull bookmarks and/or history from the Firefox Sync server. this enables the user to simply bookmark pages they want to archive on their desktop and mobile browser and they will automatically be archived by archivebox. here's what worked for me. determine your Firefox Sync client id: ``` $ python3 -m pip install PyFxA $ fxa-client --bearer -u <YOUR EMAIL> \ --account-server https://api.accounts.firefox.com/v1 \ --oauth-server https://oauth.accounts.firefox.com/v1 # ---- BEARER TOKEN INFO ---- # User: <YOUR EMAIL> # Scopes: profile # Account: https://api.accounts.firefox.com/v1 # Oauth: https://oauth.accounts.firefox.com/v1 # Client ID: <YOUR CLIENT ID> # --------------------------- ``` import all of your bookmarks into archivebox: ``` $ git clone https://github.com/eNote-GmbH/syncclient $ cd syncclient $ python3 -m pip install -e . $ python3 syncclient/main.py -u <YOUR EMAIL> --client-id <YOUR CLIENT ID> \ get_records bookmarks \ | jq '.[].payload | fromjson | select(.type == "bookmark") | .bmkUri)' \ | archivebox add ``` this also works with a self hosted Firefox Sync server by setting the env var `TOKENSERVER_URL="https://<YOUR SYNC SERVER>/token"`. you can configure this to run on a regular schedule eg. via cron. with a bit of work, you could make this only archive bookmarks with a specific tag or folder.
Author
Owner

@kominoshja commented on GitHub (Nov 30, 2021):

Note: This requires disabling 2FA while setting it up

<!-- gh-comment-id:983052336 --> @kominoshja commented on GitHub (Nov 30, 2021): Note: This requires disabling 2FA while setting it up
Author
Owner

@kominoshja commented on GitHub (Nov 30, 2021):

When you issue python3 syncclient/main.py -u <YOUR EMAIL> --client-id <YOUR CLIENT ID> get_records bookmarks, you get something like

"6J***********3Vk"
"3_***********Iw7"
"U1***********ah"

therefore, jq fails. You'd need to run python3 syncclient/main.py -u <YOUR EMAIL> --client-id <YOUR CLIENT ID> get_record bookmarks --decrypt 6J***********3Vk | jq '.payload | fromjson | select(.type == "bookmark") | .bmkUri'

I created the following script to iterate over the response and add bookmarks to archivebox (Keep in mind you need to change BATCH_SIZE to archive more than 4 at a time): https://gist.github.com/kominoshja/484dd83f978079daf6c3bacebb21fe37

<!-- gh-comment-id:983072369 --> @kominoshja commented on GitHub (Nov 30, 2021): When you issue `python3 syncclient/main.py -u <YOUR EMAIL> --client-id <YOUR CLIENT ID> get_records bookmarks`, you get something like ``` "6J***********3Vk" "3_***********Iw7" "U1***********ah" ``` therefore, jq fails. You'd need to run `python3 syncclient/main.py -u <YOUR EMAIL> --client-id <YOUR CLIENT ID> get_record bookmarks --decrypt 6J***********3Vk | jq '.payload | fromjson | select(.type == "bookmark") | .bmkUri'` I created the following script to iterate over the response and add bookmarks to archivebox (Keep in mind you need to change `BATCH_SIZE` to archive more than 4 at a time): https://gist.github.com/kominoshja/484dd83f978079daf6c3bacebb21fe37
Author
Owner

@pirate commented on GitHub (Jan 19, 2024):

Going to close this for now, I'll add a link to this issue from the README in case it helps ppl in the future trying to set this up.

<!-- gh-comment-id:1899771928 --> @pirate commented on GitHub (Jan 19, 2024): Going to close this for now, I'll add a link to this issue from the README in case it helps ppl in the future trying to set this up.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ArchiveBox#405
No description provided.