Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hacky way to export synced tabs of Firefox Sync / Weave and import them in OneTab

Hacky way to export synced tabs of Firefox Sync / Weave and import them in OneTab

Background

I am guilty beeing a tab messy and was searching for a while for a good solution to move my open tabs to OneTab. Especially on mobile the tab situation was extremely bad. When I realized that I had over 3000 (!!) tabs on my iPhone opened I acknowledge that I got to do something.

First I tried to just open the tabs in Firefox. When you rightclick a device on the "Synced Tabs" sidebar there is an "Open all tabs" entry. For 3000 tabs already my computer was already overloaded when opening them… Closing every other open program and removing every browser extension other then blockers also didn't do the trick. After some time the tabs seemed to be in an open state, but Firefox was not really responding. I tried closing the tabs via OneTab and also to save them all as bookmark via Bookmarks -> Bookmark all Tabs but that also didn't work.

So I played around with various accessible API implementations. After a few hours I almost gave up. The libraries that I found were either that old that installing was really complex (old dependencies) or I couldn't get past the authorization.

So that's how I ended up getting the data that I wanted by using this ugly trick:

Steps

  1. Download and install "About Sync" Firefox extension https://addons.mozilla.org/en-US/firefox/addon/about-sync/ This extension is made for debugging the Firefox Sync.

  2. Navigate in Firefox to about:sync (Since this is not a valid URL, a markdown link is not possible)

  3. Go to the Firefox Debugger and add response under Watch Expressions and add a breakpoint to the fetchCollection function in the line where the response variable gets declared.

  4. Click the "Refresh" button on the page

  5. Resume through breakpoints until response.url is the tab endpoint of the api. Will be something like https://sync-1-us-west1-g.sync.services.mozilla.com/1.5/143199178/storage/tabs?full=1&limit=1000

  6. The expression variable is now declared in the console. Go there.

You can inspect the data with:

console.log(response)

Copy the urls of the tabs to the clipboard in a format that is understandable by the OneTab import:

// this is the index of the record (aka synced device)
const SYNCED_DEVICE_INDEX = 1;

const { tabs } = response.records[SYNCED_DEVICE_INDEX].cleartext

// format to OneTab CSV
const oneTabEntries = tabs
  .map(({ urlHistory, title, lastUsed }) => {
    return urlHistory[0] + ' | ' + title + ', ' + lastUsed
  })
  .join(('\n'))

// copy to clipboard
copy(oneTabEntries)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment