Created
January 28, 2021 19:14
-
-
Save philsnow/780b131608878d93e9a8ad379359471b to your computer and use it in GitHub Desktop.
some ways of getting tabs out of chrome/firefox because I don't trust their session restore 100%
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
# source this from your shell | |
chrome_tabs () { | |
for win in $(seq 1 $(osascript -e 'tell application "Chrome" to get count every window')) | |
do | |
for tab in $(seq 1 $(osascript -e "tell application \"Chrome\" to get count every tab of window ${win}")) | |
do | |
echo -n "win $win tab $tab: " | |
osascript -e "tell application \"Chrome\" to get URL of tab $tab of window $win" | |
done | |
done | |
} |
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
# source this from your shell | |
chrome_tabs_for_emacs () { | |
local tabs | |
local wins | |
echo "* dumped bookmarks as of $(date)" | |
wins=$(osascript -e 'tell application "Chrome" to get count every window') | |
for win in $(seq 1 $wins) | |
do | |
tabs=$(osascript -e "tell application \"Chrome\" to get count every tab of window ${win}") | |
echo " - window $win/$wins with $tabs tabs" | |
for tab in $(seq 1 $tabs) | |
do | |
echo " - [[$(chrome_fetch URL $tab $win)][$(chrome_fetch Title $tab $win | tr '[]' '{}')]]" | |
done | |
done | |
} |
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/bash | |
# setup step to be able to read the .jsonlz4 files that firefox uses: | |
# brew install lz4 && \ | |
# mkdir -p ~/dev && \ | |
# cd ~/dev && \ | |
# git clone https://github.com/lilydjwg/mozlz4-tool && \ | |
# cd mozlz4-tool && \ | |
# cargo build --release | |
~/dev/mozlz4-tool/target/release/mozlz4-tool \ | |
"$(find ~/Library/Application\ Support/Firefox/Profiles/ -name recovery.jsonlz4 | head -1)" | \ | |
jq '["* \(.windows | length) Firefox windows as of '$(date +%Y-%m-%dT%H:%M:%S)'", (.windows | . as $windows | length as $num_windows | keys | .[] | $windows[.] as $window | [" - window \(. + 1) out of \($num_windows), \($window.tabs | length) tabs", ($window.tabs[] | .entries[-1] as $last | " - [[\($last.url)][\($last.title)]]")])] | flatten | .[]' -r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment