LoginSignup
2
3

More than 5 years have passed since last update.

chatwork から特定の人への発言と返信を抜き出す。

Last updated at Posted at 2013-08-29

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

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

結果

ヤマダ タロウ
2013/8/26 10:00:00
RE ○○さん
 こんにちは

ヤマダ タロウ
2013/8/28 19:00:00
TO ○○さん
こんばんは

ヤマダ ジロウ
2013/8/29 16:00:00
TO ○○さん
 こんにちは こんにちは

http://qiita.com/ooooooo_q/items/e759312c3df99916e82c から改造

2
3
1

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
2
3