Android - How can I export the list of open Chrome tabs?

You can use the Remote Devices feature in the Chrome debugger to connect to Chrome on the device and access the tabs. Just expand the list of tabs visible to get the full list and then highlight & copy everything shown (including the URLs) to the clipboard: https://developers.google.com/web/tools/chrome-devtools/remote-debugging/

I just managed to export ~400 tabs this way.


Just joined this StackExchange to show some appreciation for Jeremy's answer above, and also add the few lines of JS I used to export the tabs list (since copying with the cursor isn't ideal!)

As Jeremy said, select Remote devices under More tools on Chrome devtools icon (top right of the panel):

  • set up USB debugging on your phone (under SettingsDeveloper options, root not required)
    • note that you must enable the Developer options menu, it's hidden by default to protect users
    • on my phone this required tapping multiple times on the build number under SettingsAbout Device
  • once this is done, plug your USB in and allow MTP connection
  • when the Chrome devtools remote device panel is open, the phone will then request to allow USB debugging
    • you can opt to always trust the computer

Now the device is connected,

  • open a 2nd devtools view on the devtools view from which you selected Remote devices to be able to retrieve the list of tabs using JavaScript
    • note that you must have devtools in pop-out mode (use the vertical ellipsis symbol in the top right of the panel) to be able to get this up, otherwise Command+Option+J(MAC) Ctrl+Shift+J(WINDOWS) will just close the first devtools panel.
  • expand the list from the first few items to all tabs by clicking 'Show more'
  • to script against the list, use the following few lines of code [entered in the console of the 2nd devtools window]

To export a list of all URLs open on Chrome for Android, I chose to just make the list into a markdown formatted text string and copy it to the clipboard

let bookmarkList = Array.from(document.querySelectorAll('.widget>.vbox'))
  .map(e => e.shadowRoot)
  .map(e => e && e.querySelector('.device-page-list'))
  .find(e => e);

let bookmarks = Array.from(bookmarkList.querySelectorAll('.vbox'))
  .map(e => `[${e.querySelector('.device-page-title').innerHTML}](${e.querySelector('x-link').innerHTML})`);

copy(bookmarks.join('\n'));

You will then have a list on your clipboard looking like this:

[How can I export the list of open Chrome tabs? - Android Enthusiasts Stack Exchange](https://android.stackexchange.com/questions/56635/how-can-i-export-the-list-of-open-chrome-tabs)
[Get Started with Remote Debugging Android Devices  |  Tools for Web Developers  |  Google Developers](https://developers.google.com/web/tools/chrome-devtools/remote-debugging/)
[How To Enable USB Debugging On Your Android Phone](https://www.groovypost.com/howto/mobile/how-to-enable-usb-debugging-android-phone/)
[Configure On-Device Developer Options | Android Studio](https://developer.android.com/studio/debug/dev-options.html)
...

tl;dr:

  • have the Android command line tools installed on a development machine, and USB debugging enabled on your device. The device does not need to be rooted
  • adb forward tcp:9222 localabstract:chrome_devtools_remote
  • wget -O tabs.json http://localhost:9222/json/list

Details:

If you have the Android command line tools installed on a development machine, and have enabled USB debugging on your Android device, then you can do the following:

  • Execute adb forward tcp:9222 localabstract:chrome_devtools_remote on your development machine.

    Chrome instances expose access to a debugging protocol via a unix domain socket with the abstract address "chrome_devtools_remote". The above adb command forwards requests made to port 9222 on your development machine, onwards to that unix domain socket. (You can get a list of all the unix domain sockets on the Android device by typing adb shell cat /proc/net/unix.)

    Using this, we can run wget or curl (or indeed, a browser) and retrieve information from the mobile device's chrome instance.

  • Debugging information is provided as JSON data over HTTP. A JSON file listing the open tabs can be got by executing wget -O tabs.json http://localhost:9222/json/list.

    (Other endpoints of the API can be found at https://github.com/buggerjs/bugger-daemon/blob/master/README.md#api.)

See here for more details on enabling USB debugging, and here for an overview of how it works.