neomanic / save_macos_browser_tabs

Applescripts to save all tab titles and URLs, in a web browser on macOS, to a Markdown text file on the Desktop. *Not* a web extension: good for the privacy conscious.
Other
1 stars 0 forks source link

Contributors Forks Stargazers Issues MIT License


Save macOS Browser Tabs

Applescripts to save all your browser tabs for macOS users. Ideal for the privacy conscious, as all other methods require a web extension install.

Home Page

Report Bug · Request Feature

About The Project

As an unrepentant tab hoarder, I was looking for the best way to save links to all my open tabs when the time comes to declare tab bankruptcy. Most of the options seem to be web extension-based, and ask for a bunch of permissions I'm not inclined to grant. The best option under those circumstances, at least on macOS, was a pure Applescript-based solution, of which there are a few floating around, but many untouched for a few years and a bit of work to install if you don't know how already.

I had a look, picked my favourite script, and made some changes to my taste:

Uploaded to a nice repo with instructions to make it easier for non-geeks to use. I will also add support for browsers other than Safari, since I use it for personal, and Edge for $(dayjob), and pretty sure Firefox (scratch that, it doesn't have Applescript support) and Chrome should be easy enough. And I'll likely have a play with Javascript for Automation at some stage, because Applescript... ugh.

The original readme:

Export All Safari Tabs in All Open Windows to a Markdown File
2018-01-25

// SCRIPT PAGE
    https://gist.github.com/unabridgedxcrpt/3f35aa5aec81289368858e2ba6009451

// ORIGINAL SCRIPT PAGE
    http://hegde.me/urlsafari KSHITEESH ON GIST.GITHUB.COM

// ORIGINAL-ORIGINAL SCRIPT ON WHICH THIS SCRIPT IS BUILT
    http://veritrope.com/code/export-all-safari-tabs-to-a-text-file

// CHANGES COMPARED TO THE ORIGINAL SCRIPT
    1. Save URLs to .md instead of .txt
    2. Save URLs from all windows instead of just the first window
    3. Save the file to Downloads/ instead of Desktop/

// CHANGES TO SCRIPT FORKED FROM KSHITEESH https://gist.github.com/kshiteesh/b72e93d31d65008fcd11#file-urlsafari
    1. Removed dialog asking for filename/location just save to downloads folder.
    2. Filename created uses time stamp YYYYMMDD-HHMMSS so we don't have filename clash in downloads folder.

// DISCLAIMER
    I have made some minor changes to the orginal script which can be found at veritrope.com (full link given above). I'm not affiliated with veritrope.com.

// TERMS OF USE:
    This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 

    To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
*)

Installation

  1. Download this repository via the Github Code > Download ZIP option and expand it, or download just the single script file.

  2. The script is accessed via the macOS global Script menu, which may not be enabled on your Mac. If you don't have the scroll icon in your icons at the right of the menubar, enable it via following Apple's instructions, which in short are:

    a. Open the Script Editor application, on the menu choose Script Editor > Preferences, and open the General tab. b. Down the bottom, make sure 'Show Script menu in menu bar' and 'Show Computer Scripts' are checked. c. I like to have 'Show application scripts' as 'as top'.

  3. Go to Safari (or in future; other browser), and in your shiny new Script menu choose Open Scripts Folder > Open Safari Scripts Folder. (fyi it's at /Users/username/Library/Scripts/Applications/Safari/)

  4. Copy the 'Save Safari Tabs as Markdown.scpt' file into the opened folder.

  5. To install for a different browser, repeat steps 3 & 4 for it.

Usage

So you have 6,231 tabs open across 15 windows and it's time to wipe the slate clean without the anxiety you'll lose something important?

No problem.

Go to the Script Menu and chose 'Save Safari Tabs as Markdown'... a few moments later you will have a file 'Safari Tabs 2022-04-20T23-13.md' (with the current date+time) on your Desktop.

Roadmap

See the open issues for a full list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you are a developer unfamiliar with Applescript, it's not very hard, just annoying due to the syntax and odd limitations.

Open the script in Script Editor.app. You will need to allow Script Editor to control Safari in System Preferences > Security & Privacy > Accessibility, but iirc you will be asked to allow this the first time you run the script from within the editor.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported license, as set by the original author. See license.md for more information.

Contact

Josh Marshall - @josh_m - josh dot p dot marshall at gmail dot com

Project Link: https://github.com/neomanic/save_macos_browser_tabs

Acknowledgments

The original and modified versions:

For prettying up the repo: