通过命令行获取Google Chrome中当前打开的标签页


19

我想编写一个Shell脚本,该脚本会自动将所有选项卡从Chrome传输到Firefox(通过从Chrome获取选项卡列表,然后使用脚本在Firefox中打开它们)。在Google Chrome中,是否可以获取列表通过命令行打开的选项卡?

Answers:


8

这个问题没有得到解决,上面的解决方案是针对Chrome开发工具的,在CLI中要求OP,因此这是我找到的解决方案:

strings ~/'.config/chromium/Default/Current Session' | 'grep' -E '^https?://'


1

您也可以使用开源实用程序chrome-cli。您可以使用Homebrew安装:

brew install chrome-cli

另外,请注意自述文件中的一件事:

要执行javascript,您必须首先在下允许它View > Developer > Allow JavaScript from Apple Events

看起来是这样的:

$ chrome-cli list tabs
[1889] Edit - Super User
[1918] prasmussen/chrome-cli: Control Google Chrome from the command line
[1905] Yotto Winter Mix 19 by Yotto
$ chrome-cli list links
[1889] /superuser//posts/1407956/edit
[1918] https://github.com/prasmussen/chrome-cli
[1905] https://soundcloud.com/yotto/yotto-winter-mix-2019
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.