LoginSignup
0

More than 5 years have passed since last update.

chatworkから特定の人の発言だけ抜き出す。

Posted at

現在開いているチャットの内、画面に描画されている範囲のみ。
developer toolsなどで以下を実行。

(function(user_name){var class_name = $('#_timeLine').find('._speakerName span').filter(function(i,x){ return x.innerText == user_name;})[0].className;
var timeline =  $('#_timeLine').find('.chatTimeLineMessageArea');
var array = timeline.map( function(i,x){ var c= $(x).find('._speakerName span')[0]; return c ? c.className : "" } );
$.each( array, function(i,x){if(x == ""){array[i] = array[i-1];}} )
timeline.map(function(i,el){if( array[i] == class_name) {
console.log( new Date($(el).closest('.chatTimeLineMessageInner').find('._timeStamp').data('tm')*1000 ).toLocaleString()+'\n'+ $(el).find('pre').text()  );
} })})("抜き出す人の氏名");

結果


2013/8/26 12:00:00
こんにちは
2013/8/27 18:00:00
こんばんは

チャット全てのログから抜き出したい場合は、頑張ってスクロールした後に実行するか、
または、秋に出るらしいAPIを待ちましょう。

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