Skip to content

Commit

Permalink
docs: Add documentation about how to import from pocket and omnivore
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedBassem committed Nov 9, 2024
1 parent e57937e commit 2b6eb7c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 40 deletions.
52 changes: 25 additions & 27 deletions docs/docs/10-import.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,43 @@
# Importing Bookmarks

## Import using the WebUI

Hoarder supports importing bookmarks using the Netscape HTML Format and Pocket's HTML format. Titles, tags and addition date will be preserved during the import. An automatically created list will contain all the imported bookmarks.

To import the bookmark file, go to the settings and click "Import Bookmarks from HTML file".
Hoarder supports importing bookmarks using the Netscape HTML Format, Pocket's new CSV format & Omnivore's JSONs. Titles, tags and addition date will be preserved during the import. An automatically created list will contain all the imported bookmarks.

:::info
All the URLs in the bookmarks file will be added automatically, you will not be able to pick and choose which bookmarks to import!
:::

## Import using the CLI
## Import from Chrome

:::warning
Importing bookmarks using the CLI requires some technical knowledge and might not be very straightforward for non-technical users. Don't hesitate to ask questions in github discussions or discord though.
:::
- Open Chrome and go to `chrome://bookmarks`
- Click on the three dots on the top right corner and choose `Export bookmarks`
- This will download an html file with all of your bookmarks.
- To import the bookmark file, go to the settings and click "Import Bookmarks from HTML file".

### Import from Chrome
## Import from Pocket

- First follow the steps below to export your bookmarks from Chrome
- To extract the links from this html file, you can run this simple bash one liner (if on windows, you might need to use [WSL](https://learn.microsoft.com/en-us/windows/wsl/install)): `cat <file_path> | grep HREF | sed 's/.*HREF="\([^"]*\)".*/\1/' > all_links.txt`.
- This will create a file `all_links.txt` with all of your bookmarks one per line.
- To import them, we'll use the [hoarder cli](https://docs.hoarder.app/command-line). You'll need a Hoarder API key for that.
- Run the following command to import all the links from `all_links.txt`:
- Go to the [Pocket export page](https://getpocket.com/export) and follow the instructions to export your bookmarks.
- Pocket after a couple of minutes will mail you a zip file with all the bookmarks.
- Unzip the file and you'll get a CSV file.
- To import the bookmark file, go to the settings and click "Import Bookmarks from Pocket export".

```
cat all_links.txt | xargs -I{} hoarder --api-key <key> --server-addr <addr> bookmarks add --link {}
```
## Import from Omnivore

- Follow Omnivore's [documentation](https://docs.omnivore.app/using/exporting.html) to export your bookmarks.
- This will give you a zip file with all your data.
- The zip file contains a lot of JSONs in the format `metadata_*.json`. You can either import every JSON file manually, or merge the JSONs into a single JSON file and import that.
- To merge the JSONs into a single JSON file, you can use the following command in the unzipped directory: `jq -r '.[]' metadata_*.json | jq -s > omnivore.json` and then import the `omnivore.json` file. You'll need to have the [jq](https://github.com/jqlang/jq) tool installed.

### Import from other platforms
## Import using the CLI

:::warning
Importing bookmarks using the CLI requires some technical knowledge and might not be very straightforward for non-technical users. Don't hesitate to ask questions in github discussions or discord though.
:::

If you can get your bookmarks in a text file with one link per line, you can use the following command to import them using the [hoarder cli](https://docs.hoarder.app/command-line):

```
cat all_links.txt | xargs -I{} hoarder --api-key <key> --server-addr <addr> bookmarks add --link {}
while IFS= read -r url; do
hoarder --api-key "<KEY>" --server-addr "<SERVER_ADDR>" bookmarks add --link "$url"
done < all_links.txt
```

## Exporting Bookmarks from Chrome

- Open Chrome and go to `chrome://bookmarks`
- Click on the three dots on the top right corner and choose `Export bookmarks`
- This will download an html file with all of your bookmarks.

You can use this file to import the bookmarks using the UI or CLI method described above
13 changes: 0 additions & 13 deletions docs/versioned_docs/version-v0.18.0/10-import.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,6 @@ If you can get your bookmarks in a text file with one link per line, you can use
cat all_links.txt | xargs -I{} hoarder --api-key <key> --server-addr <addr> bookmarks add --link {}
```

alternatively if you get the error (xargs: command line cannot be assembled, too long), this means your URL is to long. Following bash script can be used to import a file that contains the URLs

```
#!/bin/bash
api_key="<key>"
server_addr="<addr>"
while IFS= read -r url; do
hoarder --api-key "$api_key" --server-addr "$server_addr" bookmarks add --link "$url"
done < all_links.txt
```

## Exporting Bookmarks from Chrome

- Open Chrome and go to `chrome://bookmarks`
Expand Down

0 comments on commit 2b6eb7c

Please sign in to comment.