[GH-ISSUE #252] Improved import from Pocket (HTML export) #184

Closed
opened 2026-02-25 23:33:39 +03:00 by kerem · 8 comments
Owner

Originally created by @dchakro on GitHub (May 29, 2020).
Original GitHub issue: https://github.com/go-shiori/shiori/issues/252

Hi,

I am not familiar with Go or this project's codebase, but I am running shiori on docker.
I figured out a way to import pocket links where the links from pocket is used to popualate shiori's database.

Feature:
Import links from pocket so that they have the title, image (if any) and

Proposed Solution:
This shell script (uses commands bundled within the shiori docker):

#!/bin/sh
# optional: wget -O pocket.html <link to your pocket exports>
grep -Eoi '<a [^>]+>' pocket.html | grep -Eo 'href="[^\"]+"' | cut -d'=' -f 2 | tr -d '"' | tac > Pocket2Shiori.txt

while IFS= read -r line; do
    shiori add $line
done < Pocket2Shiori.txt

rm Pocket2Shiori.txt

shiori add does all the heavy lifting here. The shell script just parses the pocket output to fish out the html URLs.

Originally created by @dchakro on GitHub (May 29, 2020). Original GitHub issue: https://github.com/go-shiori/shiori/issues/252 Hi, I am not familiar with Go or this project's codebase, but I am running shiori on docker. I figured out a way to import pocket links where the links from pocket is used to popualate shiori's database. **Feature:** Import links from pocket so that they have the title, image (if any) and **Proposed Solution:** This shell script (uses commands bundled within the shiori docker): ```sh #!/bin/sh # optional: wget -O pocket.html <link to your pocket exports> grep -Eoi '<a [^>]+>' pocket.html | grep -Eo 'href="[^\"]+"' | cut -d'=' -f 2 | tr -d '"' | tac > Pocket2Shiori.txt while IFS= read -r line; do shiori add $line done < Pocket2Shiori.txt rm Pocket2Shiori.txt ``` ```shiori add``` does all the heavy lifting here. The shell script just parses the pocket output to fish out the html URLs.
kerem closed this issue 2026-02-25 23:33:39 +03:00
Author
Owner

@deanishe commented on GitHub (Aug 6, 2020):

Nice solution. (I use something similar to import URLs from Pinboard.)

Would you add this to the wiki? It's a useful tip and I think more people will find it there.

<!-- gh-comment-id:670205668 --> @deanishe commented on GitHub (Aug 6, 2020): Nice solution. (I use something similar to import URLs from Pinboard.) Would you add this to the wiki? It's a useful tip and I think more people will find it there.
Author
Owner

@dchakro commented on GitHub (Aug 7, 2020):

Hi @deanishe
Thank you for taking responsibility of this lovely project.
I have happily added the instructions to the wiki.
https://github.com/go-shiori/shiori/wiki/Usage#improved-import-from-pocket

Marking this issue as closed.

<!-- gh-comment-id:670501631 --> @dchakro commented on GitHub (Aug 7, 2020): Hi @deanishe Thank you for taking responsibility of this lovely project. I have happily added the instructions to the wiki. https://github.com/go-shiori/shiori/wiki/Usage#improved-import-from-pocket Marking this issue as closed.
Author
Owner

@z3cko commented on GitHub (Jan 17, 2021):

Sadly the current importer does not take into account the title of the URLs as exported by pocket. I created a issue #292 describing the problem.

<!-- gh-comment-id:761752709 --> @z3cko commented on GitHub (Jan 17, 2021): Sadly the current importer does not take into account the title of the URLs as exported by pocket. I created a issue #292 describing the problem.
Author
Owner

@robflate commented on GitHub (Feb 25, 2022):

I ran this and it correctly imported my bookmarks with images and the title but it did not import my tags.

I also ran the built in shiori pocket method which correctly imported my tags but not the title or images.

How can I get titles, images and tags from Pocket? Thanks.

Note: I'm running the latest version in docker using a MYSQL database.

<!-- gh-comment-id:1051358549 --> @robflate commented on GitHub (Feb 25, 2022): I ran this and it correctly imported my bookmarks with images and the title but it did not import my tags. I also ran the built in `shiori pocket` method which correctly imported my tags but not the title or images. How can I get titles, images and tags from Pocket? Thanks. Note: I'm running the latest version in docker using a MYSQL database.
Author
Owner

@rafacouto commented on GitHub (Jun 3, 2025):

I've succesfully imported 1338 bookmarks with the exported csv from pocket (title and tags included).

Write this python script as pocket_csv.py and adapt the shiori_cmd variable to your shiori command:

import csv
import sys

#shiori_cmd = "shiori"
shiori_cmd = "docker exec -t shiori shiori"
#shiori_cmd = "docker compose exec -T shiori shiori"

reader = csv.DictReader(sys.stdin)

for row in reader:
    url = row['url']
    tags = row['tags'].replace("'", "''").replace("|", ",")
    title = row['title'].replace("'", "''")
    try:
       print(f"{shiori_cmd} add '{url}' -t '{tags}' -i '{title}'")
    except BrokenPipeError:
        sys.exit(0)

To execute the import with the exported csv from getpocket:

cat part_000000.csv | python3 convert.py | sh

Happy bookmarking!

<!-- gh-comment-id:2934962779 --> @rafacouto commented on GitHub (Jun 3, 2025): I've succesfully imported 1338 bookmarks with the exported csv from pocket (title and tags included). Write this python script as `pocket_csv.py` and adapt the `shiori_cmd` variable to your shiori command: ```python import csv import sys #shiori_cmd = "shiori" shiori_cmd = "docker exec -t shiori shiori" #shiori_cmd = "docker compose exec -T shiori shiori" reader = csv.DictReader(sys.stdin) for row in reader: url = row['url'] tags = row['tags'].replace("'", "''").replace("|", ",") title = row['title'].replace("'", "''") try: print(f"{shiori_cmd} add '{url}' -t '{tags}' -i '{title}'") except BrokenPipeError: sys.exit(0) ``` To execute the import with the exported csv from `getpocket`: ```sh cat part_000000.csv | python3 convert.py | sh ``` Happy bookmarking!
Author
Owner

@LoisGNS commented on GitHub (Jun 14, 2025):

I'm not sure there's a "cat" command available in the Windows command line. Does the above work only in Docker (which I don't use)? In general, it seems that the "add" command does what I want more than the pocket import, since the add command creates the archive & ebook, while the import doesn't seem to. I'd like to be able to feed a list of titles & urls (don't really use tags) and have it add them all & create the archives & ebooks from them. Even just the urls without titles would be ok.

<!-- gh-comment-id:2972219598 --> @LoisGNS commented on GitHub (Jun 14, 2025): I'm not sure there's a "cat" command available in the Windows command line. Does the above work only in Docker (which I don't use)? In general, it seems that the "add" command does what I want more than the pocket import, since the add command creates the archive & ebook, while the import doesn't seem to. I'd like to be able to feed a list of titles & urls (don't really use tags) and have it add them all & create the archives & ebooks from them. Even just the urls without titles would be ok.
Author
Owner

@rafacouto commented on GitHub (Jun 19, 2025):

I'm not sure there's a "cat" command available in the Windows command line. Does the above work only in Docker (which I don't use)?

Sorry, I don't use Windowz so I can't say how to use this shell commands there. It was tested on Debian 12 (python 3.11) and probably runs in any GNU/Linux with python 3.

It works with docker and command version: please, modify the shiori_cmd to your shiori setup.

You could modify the python by adding these options:

  -a, --no-archival      Save bookmark without creating offline archive
  -o, --offline          Save bookmark without fetching data from internet
<!-- gh-comment-id:2987518497 --> @rafacouto commented on GitHub (Jun 19, 2025): > I'm not sure there's a "cat" command available in the Windows command line. Does the above work only in Docker (which I don't use)? Sorry, I don't use Windowz so I can't say how to use this shell commands there. It was tested on Debian 12 (python 3.11) and probably runs in any GNU/Linux with python 3. It works with docker and command version: please, modify the `shiori_cmd` to your shiori setup. You could modify the python by adding these options: ``` -a, --no-archival Save bookmark without creating offline archive -o, --offline Save bookmark without fetching data from internet ```
Author
Owner

@LoisGNS commented on GitHub (Jun 20, 2025):

I understand how to modify the shiori_cmd; what I don't get is this part (since you need linux or maybe docker):

To execute the import with the exported csv from getpocket:

cat part_000000.csv | python3 convert.py | sh

Windows doesn't have a "cat" command, and I'm not sure what "sh" is for.

<!-- gh-comment-id:2989687239 --> @LoisGNS commented on GitHub (Jun 20, 2025): I understand how to modify the shiori_cmd; what I don't get is this part (since you need linux or maybe docker): ``` To execute the import with the exported csv from getpocket: cat part_000000.csv | python3 convert.py | sh ``` Windows doesn't have a "cat" command, and I'm not sure what "sh" is for.
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/shiori#184
No description provided.