0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

一時的にテキストにメモったURLを後でブラウザで一気に開きたいときのメモ

Last updated at Posted at 2023-04-23

前置き

普段からブラウザを複数タブ開いて閲覧して、必要なくなったら消していくというスタイルを取っているのだが、特性と時間の都合上、タブ数が膨大になってしまう時がある(特に論文調査の時とか)
Pocketなどのブックマークツールを使っていてもいいが、入れたり消したりが手間だし時間がかかるし面倒である。
そういう時には一旦Copy All Urlsなどの拡張機能を使ってURL一覧をテキストファイルに保存し、後でまた見なおすことにしている。その時のちょっとしたテクニックのご紹介。

やり方

  1. テキストファイルのあるディレクトリで、コマンドプロンプト等からpythonのインタプリタモードに入り、以下を実行

    with open("テキストファイル.txt") as f:
        linkList = [s.rstrip() for s in f.readlines()]
        print(linkList)
    

    表示されたものをコピーしておくこと。

  2. 上で取得したものをurlListの部分にコピペし、以下のコードをchrome等ブラウザの開発者ツールのコンソールタブで実行する

    urlList = ["url1","url2","url3","url4"]
    for(i=0;i<list.length;i++){
        window.open(urlList[i])
    }
    

開くときはブラウザのメモリを一気に消費するため注意すること。

参考

Pythonでファイルの読み込み、書き込み(作成・追記)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?