Last active
May 26, 2022 19:40
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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)