Note: as of October 12th 2021, this repo will be archived. There's a project that works better than this one, so I decided that I'll no longer mantain this one. Instead, I'll fork that better project and improve it.
This is the link for that next project: ikki4/OneTab-Backup-Automation (forked from busyxiang/OneTab-Backup-Automation)
But since this original project is sort of useful (I'll actually use code from this project in the next one), I'll keep it as "archived" instead of deleting it, so people can still read it and reuse the code.
OneTab-Backup
This is a Python script that will allow you to automatically* backup your OneTab extension's tabs list.
*With Windows Task Scheduler
Requires Python 3.4+ (I've only tested it on Python 3.8.11)
Note: I'm a novice programmer and this script is in its early stages of development, so expect some bugs/crashes. I'll do my best to fix every error I find, so keep checking this page to make sure you have the latest version. If you would like to fork my project and develop it even further, feel free to do so.
What it does
It creates a text file containing your saved tabs' information (url and title), exactly as if you selected "Export/Import URLs" in Onetab and copied the "Export" section contents to a text file.
Then, if you ever need to restore a backup, just open the desired backup file, copy its contents and paste it in the "Import" section in Onetab.
What it does NOT
It does NOT save your tabs groups' name and status (starred, locked, etc). It saves the groups without the name and status.
How to use
- Clone this repository (or download the .py file).
- Open
OneTab-Backup.py
using a text editor or IDE.- In line 18 (variable CHROME_PATH), replace
<Username>
with your system user's username. For example, my path isCHROME_PATH = r'C:\Users\ikki\AppData\Local\Google\Chrome\User Data\Default\Local Extension Settings\chphlpgkkbolifaimnlloiipkdnihall'
.- If you're using another browser that supports OneTab, you'll have to search for the Onetab storage folder (
chphlpgkkbolifaimnlloiipkdnihall
) inside theLocal Extension Settings
folder inside one of that browser's folders, then replace the variable CHROME_PATH content with the new path. In my PC, the Onetab storage folder path for the Opera browser isC:\Users\ikki\AppData\Roaming\Opera Software\Opera Stable\Local Extension Settings\chphlpgkkbolifaimnlloiipkdnihall
. When in doubt, you can try to open Windows Explorer, go toC:\Users\<Username>\AppData
and in the search box (top right corner) search for "chphlpgkkbolifaimnlloiipkdnihall".
- If you're using another browser that supports OneTab, you'll have to search for the Onetab storage folder (
- If you wish to change the backups folder: In line 21 (variable BACKUP_PATH), replace that path with your backups folder path.
- In line 18 (variable CHROME_PATH), replace
- Then, you can run the script using
python OneTab-Backup.py
. - If you want to automate the back ups (and use Windows), open up the Task Scheduler (search using the Windows key). Watch this tutorial or follow the steps below (thanks to itsjoshthedeveloper for writing it):
- In the left pane, click
Task Scheduler Library
. - In the right pane, click
Create Task...
- Name your Task.
- Go to the
Actions
tab and clickNew...
at the bottom. - Under Settings, for
Program/script
input yourpython.exe
path. For example, my path isC:\Users\ikki\anaconda3\python.exe
. - For
Add arguments
inputOneTab-Backup.py
. - For
Start in
input the path of the directory where yourOneTab-Backup.py
script is in. For example, my path isD:\Downloads\OneTab-Backup
. - Hit
OK
, go to theTriggers
tab, and clickNew...
at the bottom. - For
Begin the task
selectAt log on
. - Under Settings, select
Specific user
make sure that is your username. - Hit
OK
twice, and it should work.
- In the left pane, click
- It's also possible to use
pyinstaller
to make an executable of the script to make it easier to run. Follow this tutorial to do that.
How it works
After trying out other solutions, I found out that this folder: C:\Users\<Username>\AppData\Local\Google\Chrome\User Data\Default\Local Extension Settings\chphlpgkkbolifaimnlloiipkdnihall
contains a .log file that has multiple lines, each containing many Onetab backups. I noticed that the string with the latest backup is usually in the end of the .log file, and I also noticed that copying all the files in that folder and later restoring them was not enough for Onetab to restore the saved tabs.
So far, Onetab has not released an official way to parse through that file or to automatically backup the saved tabs, so I wrote my own. It's not perfect, since it does not store information like tab groups' names and their status (stared, locked, etc), but it mimics pretty well Onetab's manual Export feature.