18
13

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 5 years have passed since last update.

Slackのカスタム絵文字を全てダウンロードする

Posted at

#前提/環境

  • Node.js
  • Windows(Linux系でもパスを読み替えれば多分おk)
  • 画像保存用に「image」ディレクトリをあらかじめ作成しておく

#手順

##必要パッケージインストール

# npm install slack-node
# npm install request
# npm install fs

##画像保存(スクリプト実行)

sample.js
var Slack = require('slack-node');
var request = require('request');
var fs = require('fs');

apiToken = "<apitoken>";
slack = new Slack(apiToken);

slack.api("emoji.list", function (err, response) {
    for(key in response.emoji){
        url = response.emoji[key];
        //エイリアスは無視
        if(url.match(/alias/)){
            continue;
        }
        request
        .get(url)
        .on('response', function (res) {
        })
        .pipe(fs.createWriteStream('image\\'+key+'.png'));
    }
});

#参考
[NodeJS] requestモジュールを使って、サーバーから画像ファイルをダウンロードする - YoheiM .NET http://www.yoheim.net/blog.php?q=20150104

18
13
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
18
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?