Skip to content

Instantly share code, notes, and snippets.

@dchakro
Last active May 26, 2022 19:40
Show Gist options
  • Save dchakro/fa43b0e89f884826d3bd60f51e48b078 to your computer and use it in GitHub Desktop.
Save dchakro/fa43b0e89f884826d3bd60f51e48b078 to your computer and use it in GitHub Desktop.
script to import pocket entries into shiori with text, images etc. instead of plain bookmarks.
#!/bin/sh
# Extracting URLs from the exported HTML from getpocket.com/export
# In the following line $1 is the exported HTML from pocket
# which will be passed to this script as a CLI parameter
grep -Eoi '<a [^>]+>' $1 | grep -Eo 'href="[^\"]+"' | cut -d'=' -f 2 | tr -d '"' | tac > pocket2shiori.txt
# Reading the URLs one by one and adding to shiori
while IFS= read -r line; do
shiori add $line
done < pocket2shiori.txt
rm pocket2shiori.txt
exit 0
@questor
Copy link

questor commented May 12, 2022

urls in the form of "www.youtube.com?v=abcd" do not work, the fix is rather easy:

grep -Eoi '<a [^>]+>' $1 | grep -Eo 'href="[^\"]+"' | cut -d'=' -f 2- | tr -d '"' | tac > pocket2shiori.txt

(please note the additional - argument in the cut command)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment