summaryrefslogtreecommitdiff
path: root/content/shell-snippets.md
diff options
context:
space:
mode:
authorMiran Bastaja <miran.bastaja04@gmail.com>2023-11-15 02:53:51 +0100
committerMiran Bastaja <miran.bastaja04@gmail.com>2023-11-15 13:57:29 +0100
commitff5fdcd170e6565f225c4d47caed14c2c8d73ca5 (patch)
treecec896a54ffa48927e6dc503bc9856f9bc772bd6 /content/shell-snippets.md
Initial commit
Diffstat (limited to 'content/shell-snippets.md')
-rw-r--r--content/shell-snippets.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/content/shell-snippets.md b/content/shell-snippets.md
new file mode 100644
index 0000000..257cc0b
--- /dev/null
+++ b/content/shell-snippets.md
@@ -0,0 +1,23 @@
++++
+title = "Shell snippets"
++++
+## Scraping images from open tabs
+```zsh
+jaq --raw-output --from-file export.json '..["url"]? | strings' \
+ | rg --fixed-strings "wallhaven.cc/w" \
+ | gallery-dl --input-file -
+```
+I exported my current session to json with tab session manager. This command
+takes that json export (referred to as `export.json`), finds all the urls
+that contain `wallhaven.cc/w` (i.e. all urls that are wallhaven images) and
+passes them to gallery-dl. Gallery-dl then neatly downloads all of those images
+in their original quality.
+
+This workflow could be made better by creating a version of tab session manager
+that exports in a simpler (or more configurable format), and I could also turn
+this into a script that takes the wanted website formats as an argument.
+Invocation of the script might look something like:
+```zsh
+tabsession-dl --format "wallhaven.cc/w" --format "reddit.com/r" \
+ --input-file export.json
+```