LoginSignup
6
9

More than 5 years have passed since last update.

チャットワーク(Chatwork)のログを保存するメモ

Posted at

チャットワークのログを保存しようとして躓いたのでメモを残します。

環境

  • Mac OS X El Capitan 10.11.6
  • ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]

参考

≫ChatWorkからファイルも含めてログをエクスポートしたいならgoodbye_chatworkだ!KDDI ChatWork対応

上の記事が最終的にやりたいことです。しかしインストールで躓いてしまったので今後のための記録を残しておきます。

必要なツールをインストール

まずはsuです。

console
# su

specific_installのインストール

これは問題なし。

console
# gem install specific_install

goodbye_chatworkをインストール

specific_installを使ってgoodbye_chatworkをインストール。ここでエラーが出ました。

console
# gem specific_install https://github.com/hirokishirai/goodbye_chatwork.git
結果
git installing from https://github.com/hirokishirai/goodbye_chatwork.git
Cloning into '/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20170116-8689-1s7ctph'...
remote: Counting objects: 82, done.
remote: Total 82 (delta 0), reused 0 (delta 0), pack-reused 82
Unpacking objects: 100% (82/82), done.
Checking connectivity... done.
  Successfully built RubyGem
  Name: goodbye_chatwork
  Version: 0.0.5
  File: goodbye_chatwork-0.0.5.gem
Building native extensions.  This could take a while...
ERROR:  While executing gem ... (Gem::Installer::ExtensionBuildError)
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for main() in -lstdc++... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
    --with-static-libstdc++
    --without-static-libstdc++
    --with-stdc++lib
    --without-stdc++lib
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:513:in `block in try_link0'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tmpdir.rb:88:in `mktmpdir'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:510:in `try_link0'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:534:in `try_link'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:714:in `try_func'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:944:in `block in have_library'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:889:in `block in checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:888:in `checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:939:in `have_library'
    from extconf.rb:6:in `<main>'


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/unf_ext-0.0.7.2 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/unf_ext-0.0.7.2/ext/unf_ext/gem_make.out

Command Line Developer Toolsをインストール

Command Line Developer Toolsというのが必要らしいのでインストールします。
参考:MavericksでC拡張を含むgemをインストールできない場合の対処法

console
# xcode-select --install

さらに Xcode のライセンスに同意します。

console
# xcodebuild -license

ずらずらと条文が出てくるので [space] で読み進めて、最後に agree と入力します。
「それ、アグリー」

goodbye_chatworkのインストール再挑戦

環境は整ったはずなのでgoodbye_chatworkのインストールに再度チャレンジです。

console
# gem specific_install https://github.com/hirokishirai/goodbye_chatwork.git
結果
git installing from https://github.com/hirokishirai/goodbye_chatwork.git
Cloning into '/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/d20170116-9611-ag0vlz'...
remote: Counting objects: 82, done.
remote: Total 82 (delta 0), reused 0 (delta 0), pack-reused 82
Unpacking objects: 100% (82/82), done.
Checking connectivity... done.
  Successfully built RubyGem
  Name: goodbye_chatwork
  Version: 0.0.5
  File: goodbye_chatwork-0.0.5.gem
Building native extensions.  This could take a while...
Fetching: unf-0.1.4.gem (100%)
Fetching: domain_name-0.5.20161129.gem (100%)
Fetching: http-cookie-1.0.3.gem (100%)
Fetching: faraday-cookie_jar-0.0.6.gem (100%)
Successfully installed

ビルドが上手くいきました!  いよいよインストールです。

console
# gem install goodbye_chatwork
結果
Successfully installed goodbye_chatwork-0.0.5
Parsing documentation for goodbye_chatwork-0.0.5
Installing ri documentation for goodbye_chatwork-0.0.5
1 gem installed

インストール成功!

チャットワークのログを保存

参加しているチャットルームの一覧

console
# goodbye_chatwork -i メールアドレス -p パスワード
結果
2017-01-16T01:07:06+09:00 login as ***@***.jp ...
2017-01-16T01:07:06+09:00 load initial data...
2017-01-16T01:07:09+09:00 load account info
2017-01-16T01:07:14+09:00 A JSON text must at least contain two octets!
19****** チャットルーム1
19****** チャットルーム2
19****** チャットルーム3

できました!!

ログの保存

-d オプションで保存先が指定できますが、手作業なので cd コマンドで移動しちゃいます。
ファイルも保存したいので -e オプションではなく -x オプションを指定します。

オプションなどは元記事を参考にしてください。
ChatWorkからファイルも含めてログをエクスポートしたいならgoodbye_chatworkだ!KDDI ChatWork対応

console
# cd /Users/dada/chatwork_log
# goodbye_chatwork -i メールアドレス -p パスワード -x 部屋ID
結果
2017-01-16T01:17:48+09:00 login as ***@***.jp ...
2017-01-16T01:17:48+09:00 load initial data...
2017-01-16T01:17:50+09:00 load account info
2017-01-16T01:17:56+09:00 A JSON text must at least contain two octets!
2017-01-16T01:17:57+09:00 mkdir chatwork_logs
2017-01-16T01:17:57+09:00 export logs ******** ...
2017-01-16T01:17:57+09:00 get old chat 0- ...
2017-01-16T01:17:59+09:00 get file info ******** ...
2017-01-16T01:18:01+09:00 download ********.jpg ...
2017-01-16T01:18:01+09:00 mkdir chatwork_logs/********_files_********
2017-01-16T01:18:01+09:00 create chatwork_logs/********_********.csv

chatwork_log.png

でーきーたー!!

6
9
2

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
6
9