{"id":2203,"date":"2010-12-04T15:25:00","date_gmt":"2010-12-04T06:25:00","guid":{"rendered":"https:\/\/hdmr.org\/d\/?e=960"},"modified":"2010-12-04T15:25:00","modified_gmt":"2010-12-04T06:25:00","slug":"blogn-960","status":"publish","type":"post","link":"https:\/\/hdmr.org\/d\/?e=960","title":{"rendered":"\u308a\u3080\u3063\u305f\u30fc\u306b\u7fd2\u3063\u305f\u30b7\u30b9\u30c6\u30e0\u3092\u81ea\u5206\u3067\u4f5c\u308b"},"content":{"rendered":"<p>\u304b\u3064\u3066Twitter\u306b\u308a\u3080\u3063\u305f\u30fc\u3068\u3044\u3046\u30b5\u30fc\u30d3\u30b9\u304c\u3042\u3063\u305f\u3002<\/p>\n<p><a href=\"https:\/\/twitter.com\/remtter\">\u308a\u3080\u3063\u305f\u30fc(remtter) on Twitter<\/a><\/p>\n<p>Follow\u89e3\u9664\u3055\u308c\u305f\u3089\u3001\u305d\u306e\u3053\u3068\u306b\u3064\u3044\u3066\u30c0\u30a4\u30ec\u30af\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u4f7f\u3063\u3066\u77e5\u3089\u305b\u308b\u30b5\u30fc\u30d3\u30b9\u3067\u3059\u308f\u3002<\/p>\n<p>Follow\u3055\u308c\u305f\u3053\u3068\u306f\u30e1\u30fc\u30eb\u3067\u3082\u901a\u77e5\u304c\u5c4a\u304f\u3057\u3001Follower\u3092\u898b\u308c\u3070\u65b0\u3057\u3044Follower\u304b\u3089\u4e0a\u306e\u65b9\u306b\u4e26\u3076\u304b\u3089\u308f\u304b\u308a\u3084\u3059\u3044\u304c\u3001<\/p>\n<p>Follow\u304c\u89e3\u9664\u3055\u308c\u305f\u3068\u3044\u3046\u306e\u306f\u6c17\u4ed8\u304d\u306b\u304f\u3044\u3002<\/p>\n<p>Follow\u89e3\u9664\u3055\u308c\u305f\u304b\u3089\u50d5\u3082Follow\u89e3\u9664\u3059\u308b\u3068\u304b\u305d\u3046\u3044\u3046\u308f\u3051\u3058\u3083\u306a\u3044\u3051\u3069\u30011\u3064\u76ee\u5b89\u3068\u3057\u3066\u306f\u5f79\u306b\u7acb\u3064\u3082\u306e\u306a\u306e\u3060\u304c\u3001<\/p>\n<p>\u3044\u308d\u3044\u308d\u82e6\u52b4\u304c\u3042\u308b\u3088\u3046\u3067\u4eca\u306e\u3068\u3053\u308d\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u306f\u6b62\u307e\u3063\u3066\u3057\u307e\u3063\u3066\u3044\u308b\u3002<\/p>\n<hr \/>\n<p> \u305d\u3046\u3044\u3046\u308f\u3051\u3067\u81ea\u5206\u3067\u3053\u3046\u3044\u3046\u4ed5\u7d44\u307f\u3092\u4f5c\u308c\u306a\u3044\u304b\u306a\u3068\u8003\u3048\u3066\u307f\u305f\u3002 <\/p>\n<p>\u4ee5\u524dPerl\u3067\u5c4a\u3044\u305f\u30e1\u30fc\u30eb\u306b\u3064\u3044\u3066Twitter\u306b\u6295\u7a3f\u3059\u308b\u4ed5\u7d44\u307f\u3092\u4f5c\u3063\u305f\u3053\u3068\u304c\u3042\u308b\u3002(\u53c2\u8003\u8a18\u4e8b : <a href=\".\/?e=750\">OAuth\u3067\u4f7f\u3046Twitter API<\/a>)<\/p>\n<p>\u3053\u306e\u3068\u304d\u4f5c\u3063\u305fTwitter\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u6d41\u7528\u3057\u3066\u3001\u3053\u3044\u3064\u306b\u8abf\u3079\u3055\u305b\u3088\u3046\u3068\u8003\u3048\u305f\u3002<\/p>\n<p>\u5177\u4f53\u7684\u306a\u65b9\u6cd5\u3060\u304c\u3001CPAN\u306eNet::Twitter\u3092\u898b\u308b\u3068\u3001followers_ids\u3068\u3044\u3046\u30e1\u30bd\u30c3\u30c9\u304c\u3042\u308b\u3002<\/p>\n<p>\u3053\u308c\u3092\u4f7f\u3046\u3068Follower\u306eID\u306e\u4e00\u89a7\u304c\u5f97\u3089\u308c\u308b\u3002ID\u3068\u3044\u3046\u306e\u306f\u6570\u5024\u3067\u8868\u3055\u308c\u3066\u3001\u30e6\u30fc\u30b6\u30fc\u540d\u306a\u3069\u304c\u5909\u308f\u3063\u3066\u3082\u5909\u308f\u3089\u306a\u3044\u3002<\/p>\n<p>\u3053\u308c\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58\u3057\u3066\u304a\u3044\u3066\u3001\u524d\u56de\u4fdd\u5b58\u3057\u305f\u4e00\u89a7\u3068\u6bd4\u8f03\u3057\u3066\u3001\u6e1b\u3063\u3066\u3044\u305f\u4eba\u3092\u5831\u544a\u3055\u305b\u308c\u3070\u3044\u3044\u3068\u3002\u305d\u3057\u3066\u6539\u3081\u3066\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58\u3057\u76f4\u3059\u3068\u3002<\/p>\n<p>\u5831\u544a\u306fE-mail\u3067\u3055\u305b\u308b\u3053\u3068\u306b\u3057\u305f\u3002E-mail\u306b\u3064\u3044\u3066\u3082Perl\u3067\u9001\u4fe1\u3057\u305f\u3053\u3068\u3042\u308b\u3057\u306d\u3002(\u53c2\u8003\u8a18\u4e8b : <a href=\".\/?e=233\">\u4e00\u4eba\u4e00\u4eba\u306b\u5e74\u8cc0\u30e1\u30fc\u30eb\u3092\u9001\u308a\u307e\u3057\u3087\u3046<\/a>)<\/p>\n<p>\u5831\u544a\u3055\u305b\u308b\u306b\u5f53\u305f\u3063\u3066\u306fID\u3067\u306f\u8ab0\u304b\u5206\u304b\u3089\u306a\u3044\u306e\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u540d\u3068\u8868\u793a\u540d\u306b\u3064\u3044\u3066\u3082\u793a\u3057\u3066\u9001\u308b\u3053\u3068\u3068\u3059\u308b\u3002<\/p>\n<hr \/>\n<p> \u305d\u306e\u7d50\u679c\u5b8c\u6210\u3057\u305f\u3082\u306e\u304c\u3053\u308c\u3002 <\/p>\n<pre>#!\/usr\/bin\/perl\nuse strict;\nuse warnings;\nuse utf8;\nuse Encode;\nuse Net::Twitter::OAuth;\nuse FindBin;\nuse Mail::Sendmail;\nmy $client=Net::Twitter::OAuth-&gt;new(consumer_key=&gt;'KEY',consumer_secret=&gt;'SECRET');\nmy $token=do \"$FindBin::Bin\/oauthtoken.pl\";\n$client-&gt;access_token($token-&gt;{'access_token'});\n$client-&gt;access_token_secret($token-&gt;{'access_token_secret'});\nmy @followers=();\nfor(my $cursor=-1,my $r;$cursor;$cursor=$r-&gt;{next_cursor}){\n    $r = $client-&gt;followers_ids({'cursor'=&gt;$cursor});\n    push @followers,@{$r-&gt;{'ids'}};\n}\n@followers=sort{$a&lt;=&gt;$b}(@followers);\nmy @removed=();\nopen(my $ifh,'&lt;',\"$FindBin::Bin\/follower.txt\");\nif($ifh){\n  my $i=0;\n  while(my $line=&lt;$ifh&gt;){\n    chomp $line;\n    $i++ while($followers[$i]&lt;$line);\n    if($followers[$i]!=$line){\n      push @removed,$line;\n    }\n  }\n  close($ifh);\n  if(@removed){\n    my $body=\"\u4ee5\u4e0b\u306e\u30e6\u30fc\u30b6\u30fc\u304b\u3089\u30ea\u30e0\u30fc\u30d6\u3055\u308c\u307e\u3057\u305f\\n\";\n    for(@removed){\n      my $info=$client-&gt;show_user($_);\n      $body.=$info-&gt;{'screen_name'}.' : '.$info-&gt;{'name'}.\"\\n\";\n    }\n    my %params=(\n      'Content-Type'=&gt; 'text\/plain; charset=ISO-2022-JP',\n      'From'        =&gt; encode('MIME-Header-ISO_2022_JP','RemoveChecker &lt;remove@example.com&gt;'),\n      'Subject'     =&gt; encode('MIME-Header-ISO_2022_JP','[Twitter] \u30ea\u30e0\u30fc\u30d6\u306e\u304a\u77e5 \u3089\u305b'),\n      'Message'     =&gt; encode('ISO-2022-JP',$body),\n      'to'          =&gt; 'user@example.com'\n    );\n    sendmail(%params) or die $Mail::Sendmail::error;\n  }\n}\nopen(my $ofh,'&gt;',\"$FindBin::Bin\/follower.txt\");\nprint $ofh \"$_\\n\" for(@followers);\nclose($ofh);<\/pre>\n<p>\u307e\u305a\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u521d\u671f\u5316\u3059\u308b\u3002\u3053\u3053\u306eConsumer key\u3068Comsumer secret\u306fTwitter\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u3063\u305f\u6642\u306b\u767a\u884c\u3055\u308c\u305f\u3082\u306e\u3002<\/p>\n<p>\u305d\u3057\u3066\u30c8\u30fc\u30af\u30f3\u3092\u4e0e\u3048\u308b\u308f\u3051\u3060\u304c\u3001\u3053\u308c\u306f\u304b\u3064\u3066OAuth\u3092\u4f7f\u3046\u8a18\u4e8b\u3067\u66f8\u3044\u305f\u901a\u308a\u3001\u30c8\u30fc\u30af\u30f3\u3092\u5f97\u308b\u305f\u3081\u306e\u8a8d\u8a3c\u3092\u884c\u3063\u3066\u5f97\u3089\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u3088\u308a\u5f97\u308b\u3002<\/p>\n<p>\u305d\u308c\u3067\u521d\u671f\u5316\u5f8cFollower\u306eID\u3092\u5f97\u308b\u305f\u3081\u306bfor\u30eb\u30fc\u30d7\u3092\u66f8\u3044\u3066\u3044\u308b\u308f\u3051\u3060\u304c\u3001<\/p>\n<p>\u5b9f\u306ffollowers_ids\u306f1\u56de\u30675000\u30e6\u30fc\u30b6\u30fc\u5206\u3082\u53d6\u5f97\u3067\u304d\u308b\u3002\u305d\u306e\u305f\u3081\u3088\u3063\u307d\u3069\u306e\u5834\u5408\u3067\u306a\u3044\u9650\u308a\u3001<\/p>\n<pre>my @followers=sort{$a&lt;=&gt;$b}{@{$client-&gt;followers_ids-&gt;{'ids'}});<\/pre>\n<p>\u3053\u308c\u3067\u3082\u3044\u3044\u3002\u3051\u3069\u4e00\u5fdc\u306f\u4f55\u30e6\u30fc\u30b6\u30fc\u3067\u3082\u5bfe\u5fdc\u3067\u304d\u308b\u66f8\u304d\u65b9\u306b\u3057\u3066\u3042\u308b\u3002<\/p>\n<p>\u3055\u3066\u3001Follower\u306eID\u3092\u30bd\u30fc\u30c8\u3057\u3066\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u3044\u3066\u6bd4\u8f03\u3059\u308b\u308f\u3051\u3060\u304c\u3001<\/p>\n<p>\u307e\u305a\u30011\u884c\u8aad\u307f\u53d6\u3063\u3066\u3001\u305d\u308c\u3068\u540c\u3058\u304b\u5927\u304d\u306aID\u306b\u306a\u308b\u307e\u3067\u914d\u5217\u3092\u9032\u3081\u308b\u3002\u305d\u3057\u3066\u540c\u3058\u306e\u304c\u3042\u308b\u304b\u30c1\u30a7\u30c3\u30af\u3057\u3066Follow\u89e3\u9664\u3092\u8abf\u3079\u308b\u3002<\/p>\n<p>\u305d\u3057\u3066\u89e3\u9664\u3055\u308c\u3066\u305f\u3089@removed\u306b\u6295\u3052\u8fbc\u3080\u3002<\/p>\n<p>\u305d\u3057\u3066@removed\u306b1\u3064\u3067\u3082\u5165\u3063\u3066\u305f\u3089\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3059\u308b\u3002<\/p>\n<p>show_user\u30e1\u30bd\u30c3\u30c9\u306bID\u3092\u4e0e\u3048\u308c\u3070\u3044\u308d\u3044\u308d\u60c5\u5831\u304c\u5f97\u3089\u308c\u308b\u304c\u3001\u3053\u3053\u3067\u5fc5\u8981\u306ascreen_name\u3068name\u306e\u307f\u5207\u308a\u51fa\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066Mail::Sendmail\u3092\u4f7f\u3063\u3066\u9001\u4fe1\u3057\u3066\u3084\u308b\u3002From\u3068To\u306f\u81ea\u5206\u306b\u5408\u308f\u305b\u3066\u5909\u66f4\u3059\u308c\u3070\u3044\u3044\u3002<\/p>\n<p>\u3053\u3053\u3067\u306f\u81ea\u5206\u306e\u30b5\u30fc\u30d0\u30fc\u306eMTA\u3092\u4f7f\u3063\u3066\u9001\u308b\u304b\u3089SMTP\u30b5\u30fc\u30d0\u30fc\u306f\u6307\u5b9a\u3057\u3066\u306a\u3044\u3051\u3069\u3001\u6307\u5b9a\u3057\u305f\u3044\u5834\u5408\u306fSmtp\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u4e0e\u3048\u308c\u3070\u3044\u3044\u3002<\/p>\n<p>\u3042\u3068\u306f\u6b21\u56de\u4ee5\u964d\u306e\u305f\u3081\u306b\u4eca\u306eFollower\u306eID\u4e00\u89a7\u3092\u4fdd\u5b58\u3057\u305f\u3089\u7d42\u308f\u308a\u3002<\/p>\n<hr \/>\n<p>\u3042\u3068\u306f\u3053\u308c\u3092\u6bce\u65e5\u52d5\u304b\u3059\u3060\u3051\u3002\u305d\u308c\u306fcron\u306b\u4efb\u305b\u308c\u3070OK\u3067\u3059\u306d\u3002<\/p>\n<p>crontab\u306b\u66f8\u304d\u8db3\u3057\u3066\u5b8c\u4e86\u3002<\/p>\n<p>\u308a\u3080\u3063\u305f\u30fc\u307f\u305f\u3044\u306a\u30b5\u30fc\u30d3\u30b9\u6b32\u3057\u3044\u306a\u3068\u601d\u3063\u305f\u3089\u3001\u3053\u308c\u3092\u53c2\u8003\u306b\u81ea\u5206\u3067\u4f5c\u308c\u3070\u3044\u3044\u3068\u601d\u3044\u307e\u3059\u3088\u3002<\/p>\n<p>\u52d5\u304b\u3059\u74b0\u5883\u3001\u5831\u544a\u65b9\u6cd5\u306a\u3069\u4eba\u306b\u3088\u3063\u3066\u3044\u308d\u3044\u308d\u3060\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u305d\u306e\u3042\u305f\u308a\u306f\u81ea\u5206\u3067\u9069\u5f53\u306b\u9078\u3079\u3070\u3044\u3044\u3068\u601d\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u304b\u3064\u3066Twitter\u306b\u308a\u3080\u3063\u305f\u30fc\u3068\u3044\u3046\u30b5\u30fc\u30d3\u30b9\u304c\u3042\u3063\u305f\u3002 \u308a\u3080\u3063\u305f\u30fc(remtter) on Twitter Follow\u89e3\u9664\u3055\u308c\u305f\u3089\u3001\u305d\u306e\u3053\u3068\u306b\u3064\u3044\u3066\u30c0\u30a4\u30ec\u30af\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u4f7f\u3063\u3066\u77e5\u3089\u305b\u308b\u30b5\u30fc\u30d3\u30b9\u3067\u3059\u308f\u3002 Follow\u3055 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-2203","post","type-post","status-publish","format-standard","hentry","category-computer"],"_links":{"self":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts\/2203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2203"}],"version-history":[{"count":0,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts\/2203\/revisions"}],"wp:attachment":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}