æ°ãã MacBook Air ãã»ããã§ãã
MacBook Air 11ã¤ã³ã欲ããï¼
éããªãã®ã§ MacBook ã¨ããååã«ãªã£ãæåã®ç½ããã¤ãé·å¹´ä½¿ã£ã¦ããã§ãããä¸åº¦ãã¡ã³ã交æããã«ããããããã¾ããã¡ã³ã®é³ããããããªã£ã¦ãã¦ãã¾ããããä¸åº¦äº¤æããã°ããããããªãã®ã¨ããæãããããã©ã
http://gameport.ocnk.net/product/134
ãè¦ãã¨6000åã5å¹´é使ã£ããã·ã³ã®ãã¼ã ã¬ã¹ããå²ãããªã¹ã¯ã¨6000åãæãã¦éé³åã¨ãã¡ãã£ã¨èããããªãã§ãã
ãã¨é»æ± ã交æãã¾ãããããã¯éç´æ£ã«ããããããæããã«éåãåããã®ãåé«ã«ç©ãè¨ãã㦠DealExtreme.com 㧠$48 ç¨åº¦ã§è³¼å ¥ãã¾ãããDealExtreme.com ã¯çºéãé ã以å¤ã¯å¤§å¤å®ãéæãã ãããç¡æã ã PayPal ã使ãã¦å®å¿ä¾¿å©ãªã®ã§ãã´ããè³¼å ¥ããã¨ãã«ã¯ãã²ä½¿ãã¨ããã¨æãã¾ãããã ãã®é»æ± ãæ®éã«ã¤ãã£ã¦ãã ãã§çªç¶é»æºãè½ã¡ããããããå¾®å¦ã«ã¤ãããããããã®ãã¡å¤ãããã§ãã8ã¶æã§å£ããã¨ããæ®å¿µãªã¬ãã¥ã¼ãããã¾ããããä»ã¿ãã¨ã¡ãã£ã¨å®¹éã®ã§ãããã¤ã $38.90 ã§å£²ã£ã¦ãã大å¤ãã¡ãã¯ã§ããã
ããã¾ã§ãã¦ä»ã® MacBook ã使ã£ã¦ãã®ã¯éã®ãã¨ãããã¾ãããtumblr ã¹ããã«ã¼ããã£ãããªãã¨ããã®ããããæ°ãã tumblr ã¹ããã«ã¼ãã»ããã§ãããTumblr ã¹ããã«ã¼æ¬²ããï¼
fuba_recorderã«ã¤ãã¦
çµç·¯
éçºããªã·ã¼
- ã¢ã³ã人工ç¥è½
- è¦æ±ã®åé¡ã¯ãã¹ã¦ãã¿ã¼ã³ãããã§
- ä¼è©±ã¯ã¹ãã¼ãã¬ã¹ã«
- ç¨æãããçºè¨ããããªã
- é«ééçº
- ã¿ã¤ã ã©ã¤ã³ãã¿ã¦è¦æ±ãã¿ã¼ã³ã©ãã©ãæ¡ç¨
- æ°æ©è½ã¯å¿ããããªããã¡ã«å®è£
- ãã¹ãããã«å³éç¨
ãã£ã©ä»ãããªã·ã¼
- ä¿¡é ¼ã§ããç¸æ¹ã¨ãã¦ãåºæ¬çã«æ³å®ã®ç¯å²å
ã®è¿çãè¿ã
- 話ããããããªãã¨è©±ããªã
- ãã¾ã«é ããããããªã
- æ¤ç´¢ãã¦ããæ å ±ã®æå¤æ§
- text converter
- ãã°
- 2å以å ã«è¦æã«å¯¾å¿ãã¦æ©è½è¿½å
fuba_recorderã®åºæ¬åä½
- 1ã¤ã®è¦æ±ã«å¯¾ãã¦ã1ã¤ã®åçãè¿ã
- ãã¯ãµã¼
- æ¨ä¹æ¬æ¡
- ãããã¿
- ã¬ã·ãææ¡
- HDDæ®ééç¥
- é²ç»äºç´
- çªçµé²ç»
- é²ç»è¦ç´
- çªçµææ¡
- èªåfollow
ã²ã¨ã¤ã®è¦æ±ãå¦çãããã¾ã§ã®æµã
- ã¿ã¤ã ã©ã¤ã³ã®ã¯ãã¼ã«
- tweetãåè¦æ±ã¿ã¤ãã«åé¡
- è¦æ±ã¿ã¤ãã«å¿ãã¦è¿ä¿¡ãçæ
- è¿ä¿¡ã®post
- text converter
ã¿ã¤ã ã©ã¤ã³ã®ã¯ãã¼ã«
- Perl Net::Twitterã¢ã¸ã¥ã¼ã«
- 2åã«1åãcronã§ã
- friend_timelineã¨timelineãããèªåã¸ã®è¦æ±ã§ãããtweetã«å¯¾ãã¦è¿ä¿¡ããã
my @msgs = reverse (@{$twit->replies}, @{$twit->friends_timeline});
èªåã¸ã®è¦æ±ãã©ãããå¤å¥
for my $nickname (@nicknames) { if (($text =~ s/^\@$nickname//) || ( ($msg->{in_reply_to_screen_name}) && ($msg->{in_reply_to_screen_name} eq $nickname) )) { return $text; } }
my @nicknames = qw/ fuba_recorder fuba_recoder fuba_recoder fuba_ãã«ã¡ã¡ã ããã³ã¬ ï¾ï¾ï¾ï½ºï¾ ããã¬ã³ ï¾ï¾ï¾ï¾ï½º ãããã ããã¬ã³ãã ããã¬ã³ã¡ãã ãã³ã¬ã ï¾ï½ºï¾ï¾ï¾ ãã³ã㬠ï¾ï½ºï¾ï¾ï¾ ãã¬ã³ã ï¾ï¾ï½ºï¾ï¾ ãã¬ãã³ ï¾ï¾ï¾ï¾ï½º ãã´ã¡ã¬ã³ ï¾ï½³ï¾ï½§ï¾ï½º ãµゔããã ãµã³ãããã ããæ§ã®ãã·ã¼ã³ ãã¦ã¢ãã³ã·å°éº¦ç²ã¬ã³ã¼ãã¼ ãããªã³ã¼ãã¼ fuba_recorder /;
è¦æ±ã¿ã¤ãã®åé¡
- å ¨é¨ãã¿ã¼ã³ãããã§
replyããã¤é²ç»ã®è¦æ±ã®å ´å
if ($text =~ /^(.*?)(?:æ¯å|å ¨é¨)(?:é²ç»|äºç´|(?:é²|ã¨)ã£ã¨ãã¦)/) { $keyword = $1; $is_repeat = 1; } elsif ($text =~ /^(.*?)(?:(?:ã(?:ãªãã¨ã)ãé¡ã)|(?:ã®|ã|ã«)?(?:é¢ãã|åºã¦ã|é²ç»|äºç´|(?:(?:ã§|åº)ã)?çªçµ|(?:é²|ã¨)ã£ã¨ãã¦))+/) { $keyword = $1; } elsif (($text !~ /(飲|ã®)ã¿ãã/) && ($text =~ /^(.*?)(?:ãã¤ããã®|(?:ã|ã)?(?:è¦|ã¿|観)ãã)/)) { $is_qa = 1; $keyword = $1; }
replyããã¤é²ç»é¢é£ã®è¦æ±ã§ãªãå ´å
- ã¬ã·ãæ¨è¦
if ($m =~ /(?:(?:ãªã«|ãªã|ä½)ã)?(.*)(?:ã|ã)?(?:(?:(?:飲|ã®)(?:ã¿|ã¾)|(?:ã|é£)ã¹ã?|(?:å°|é£|ã)(?:ã|ã))(?:ã(?:ã|ã)|ã(?:ã|ã¦)))/) { if (my $str = $1) { if (server_avail($avail_dir, 'cookpad')) { my $recipe = retrieve_keyword_cookpad($str); if ($recipe) { $new_message = join('ã', @{$recipe->{ingredients}}).'ã¨ãè²·ã£ã¦ãã¦'.$recipe->{title}.'ãä½ã '.$recipe->{url}; } else { $new_message = 'ä½ãéããã®é£ã¹ãã»ããããã§ãã'; } } else { $new_message = 'æ¤ç´¢ããã'; } } }
- replyçãã¯ã·ã³ã°
elsif (my $boxing = text_boxing( message => $m, ngwords => \@ngwords )) { $new_message = $boxing->{dump_message}; }
- ãããã¿
elsif ($m =~ /ãã|è¡åã?éå§|ãã|ãã|ãã¦|ç |ãããã¿|å¯|ãã¿ãª|ã¹ã¤|ãã«ã½ã³/) { $new_message = $goodnights[floor(rand(scalar(@goodnights)))]; }
- é»ã
elsif ($m =~ /é»ã/) { $new_message = '...'; }
- ãã£ããã ããããã¶ã ã
elsif ($m =~ /è¡ã.*åºã|失æ¥|åå|çã|é²ã¾ãªã|ãã¡|ï¼¼\(ï¼¾oï¼¾\)ï¼|çãæãç¡ã|ãã¼|ããã|鬱|ãã«ã|ã¸ãã·|help|諦ã|è¦ãã|ã¤ãã|å¸æããªã|ã ã|ãã¡|é§ç®|æ»|ãã¬|ãã«ãã|èªæ®º|ãããã¦|å©ãã¦|åããããªã|ãã |ãã|ç¡ç|ãããã/) { $new_message = $cheerups[floor(rand(scalar(@cheerups)))]; }
- è¬é
elsif ($m =~ /ããã§ã¨|ããã°ã§ãã|ã§ããã|(?:ãã|å)ã|ã(?:ç²|ã¤ã)ã|ããã|ãã(?:ã§ã)?ã|ãããã¨|thx|ãµã³ã¯ã¹|ãµã³ãã¥ã¼|thank/) { $new_message = $yourwelcomes[floor(rand(scalar(@yourwelcomes)))]; }
- replyåæ°å¶éã®ç¢ºèª
elsif ($m =~ /å|å¶é/) { my $avail = server_avail($avail_dir, 'twitter_'.$req->{user}); $new_message = ($avail - 1); }
- HDDæ®éããã¾ãã«ç¢ºèª
if (!$new_message) { if (int(rand(6))) { my $disk = disk_rest(); if ($disk < 10) { # 10GBæªæº $new_message = $dies[floor(rand(scalar(@dies)))]; } elsif ($disk < 40) { # 40GBæªæº $new_message = $noes[floor(rand(scalar(@noes)))]; } else { $new_message = $yeses[floor(rand(scalar(@yeses)))]; } } } $req->{dump_message} = $new_message; return $req; }
replyãããªãå ´å
- éreplyçãã¯ã·ã³ã°
- just_do_quizã®ã¯ã¤ãºã«ãããã
if ($req->{message} =~ /^\[quiz\]/) { if ($req->{message} =~ /\[\s+\]|次ã®é¸æè¢/) { $req->{is_quiz} = 1; return $req; } }
è¿ä¿¡ã®çæ
é²ç»é¢é£
if ($req->{is_quiz}) { post('@'.$req->{user}.' '.answer_quiz(map {$_->{message}} @quiz[0..1], $ua), $mid); } if ($req->{too_many}) { post('@'.$req->{user}.' æ¤ç´¢çµæå¤ãããããã¡ãã£ã¨çµã£ã¦ãã ãã', $mid); } elsif ($req->{is_forbidden}) { post('@'.$req->{user}.' ãã®iepgå½ç©ã£ã½ã', $mid); } elsif ($req->{has_collision}) { post('@'.$req->{user}.' '.$req->{collision_title}.'ã¨ãã¶ãã®ã§ãã', $mid); } elsif ($req->{is_expired}) { post('@'.$req->{user}.' ãã®iepgå¤ã', $mid); } elsif ($req->{is_qa}) { if ($req->{url}) { post('@'.$req->{user}.' '.$req->{keyword}.'ãããã¯ã©ãã§ãã '.$req->{url}, $mid); } else { post('@'.$req->{user}.' '.$req->{keyword}.'ãã', $mid); } } elsif ($req->{is_reserved}) { if ($req->{keyword}) { post('@'.$req->{user}.' '.$req->{keyword}.'ãããäºç´ãã¦ã', $mid); } else { post('@'.$req->{user}.' ããäºç´ãã¦ã', $mid); } } elsif ($req->{is_repeat}) { if (grep {$req->{user} eq $_} @superusers) { my $date = DateTime->from_epoch(epoch => $req->{repeat_expire}); my $hdate = $date->ymd('-'); post('@'.$req->{user}.' '.$req->{keyword}.'ã'.$hdate.'ã¾ã§å ¨é¨é²ç»ãã¾ã', $mid); $refresh_repeat_flag = 1; } else { post('@'.$req->{user}.' éãã', $mid); } } elsif ($req->{default_iepg}) { if ($req->{has_collision}) { post('@'.$req->{user}.' '.$req->{collision_title}.'ã¨ãã¶ããããã', $mid); } else { post('@'.$req->{user}.' äºç´ãã', $mid); } } elsif ($req->{iepg}) { my $justified_flag = ($req->{retrieve_result}->{justify}) ? 'ã¨ãããã' : ''; post('@'.$req->{user}.' '.$req->{keyword}.'ã'.$justified_flag.'ããäºç´ãã '.$req->{url}, $mid); } elsif ($req->{keyword}) { if ($req->{search_result_num}) { post('@'.$req->{user}.' '.$req->{keyword}.'ãããçªçµè¡¨ã«ã¯ãã£ããã©ãªããã¨ãã¶ã£ã¦ã', $mid); } else { post('@'.$req->{user}.' '.$req->{keyword}.'ãããæ¤ç´¢ã«ã²ã£ããããªã', $mid); } } elsif ($req->{dump_message}) { if ($req->{is_reply}) { if (grep {$req->{user} eq $_} @uzaiuser) { post('@'.$req->{user}.' '.$req->{dump_message}, $mid) if (int(rand(3))); } else { post('@'.$req->{user}.' '.$req->{dump_message}, $mid); } } if ($req->{is_boxer}) { # ãã¯ãµã¼ã®ç¢ºçèª¿æ´ post($req->{dump_message}, $mid) if (grep {$req->{user} eq $_} @boxeruser); if (grep {$req->{user} eq $_} @boxeruser_light) { post($req->{dump_message}, $mid) if (int(rand(3))); next; } next if (grep {$req->{user} eq $_} @nguser); if (grep {$req->{user} eq $_} @nguser_light) { post($req->{dump_message}, $mid) unless (int(rand(20))); next; } if (grep {$req->{user} eq $_} @nguser_strong) { post($req->{dump_message}, $mid) unless (int(rand(50000))); next; } post($req->{dump_message}, $mid) unless (int(rand(3))); } }
é²ç»ä»¥å¤ã®å®åæ
my @goodnights = qw/ã¨ã£ã¨ã¨å¯ãã å¯ã㪠ã¼ãããã¾ã 6æèµ·ããª/; my $goodmorning_notice = ( ( (localtime(time))[2] + 1 + 3 + int(rand(7)) ) % 12 ).'æèµ·ããª'; push @goodnights, $goodmorning_notice, $goodmorning_notice, $goodmorning_notice; my @yeses = qw/ã¯ã ã¯ãã¯ã äºè§£ãã¾ãã ããã§ãã/; my @noes = qw/ãã ããã©ããã... ãã¡ã ããã ã¯ãã ã¯ãï¼ ã ãã/; my @dies = qw/æ»ã¬ å©ã㦠ãã¸ç¡ç æ¶ æ§ããã⦠å·æ¸¡ã£ã¦ã/; my @cheerups = qw/ ããã£ããæ°æã¡ä¼ãã£ã¦ããªãï¼ãã1åï¼ ãããªãããèãããªããï¼å ¨ã£ç¶æ°æã¡ãä¼ãã£ã¦ããªãï¼ å¼ããããªãï¼åãæ¿ãã¦ãããï¼ ããã°ãããã°ãã§ããã§ãã絶対ã§ããããã°ããã£ã¨ãããã£ã¦ï¼ï¼ ãã£ããã ããããã¶ã ãï¼ãªãã¨ããªããï¼ ãã£ããã ããããã¶ã ãï¼ ãã£ãããªãã¨ããªããï¼ ã ããããã¶ã ãï¼ãã£ãããªãã¨ããªããï¼ /; my @yourwelcomes = qw/ ã©ããããã¾ã㦠ã¯ãã¯ã ãããã /;
ãã¯ãµã¼çæ
sub text_boxing { my %opt = @_; my $m = $opt{message}; my $ngwords = $opt{ngwords}; return if (grep {my $ngword = $_; $m =~ /$ngword/} @$ngwords); $m =~ s/^(\@[^\s]+\s+)+//; my @arms = qw/= â¡ - - - - -=â¡ â¡=- ã/; push @arms, ''; my $arm = $arms[int(rand(scalar(@arms)))]; my $lnp = $arm.'o'; my @lpunches = ($lnp, $lnp, $lnp, $lnp, $lnp, '9', 'ï¼', 'ã⧉'); my $lpunch = $lpunches[int(rand(scalar(@lpunches)))]; my $rnp = 'o'.$arm; my @rpunches = ($rnp, $rnp, $rnp, $rnp, $rnp, '6', 'ï¼', '⧉ã½'); my $rpunch = $rpunches[int(rand(scalar(@rpunches)))]; my @lfaces = map {"(o'-')"} (0..6); push @lfaces, "o'-')"; push @lfaces, "イェイ! o'-')"; my $lface = $lfaces[int(rand(scalar(@lfaces)))]; my @rfaces = map {"('-'o)"} (0..6); push @rfaces, "('-'o"; push @rfaces, "('-'o イェイ!"; my $rface = $rfaces[int(rand(scalar(@rfaces)))]; my $result = { is_boxer => 0, dump_message => '', }; if ($m =~ s/^[^(ï¼\{]*[(ï¼\{]\s*\*?\s*(?:(?:´[ã»ï½¥])|(?:`[ã»ï½¥])|(?:கு)|[☉\'´ுï½`◕´◕ï¾^ï¼¾ã»ã◠è])/${lface}${lpunch})ï¾/) { $result->{dump_message} = $m; $result->{is_boxer} = 1; return $result; } if ($m =~ s/(?:(?:[ã»ï½¥]ï½)|(?:[ã»ï½¥]´)|(?:கு)|[\'ï½ு`◕ï¾☣\ï¼¾◠=☉©権â¦])\s*\*?\s*[\})ï¼][^)ï¼\}]*$/ï¾(${rpunch}${rface}/) { $result->{dump_message} = $m; $result->{is_boxer} = 1; return $result; } return; }
è¿ä¿¡ã®post
Gearmanã使ãã
- é²ç»å¾ã®è¦ç´ç»åçæãããã³å ±å
- é常ã®è¿ä¿¡
ç¨ã«ã2ã¤ã®workerãåä½ã
sub post_twit { my %opt = @_; delete $opt{twit}; delete $opt{ua}; my @workers = ($opt{worker}) ? ($opt{worker}) : ('localhost'); my $client = Gearman::Client->new; $client->job_servers(@workers); my $args = freeze(\%opt); my $result_ref; $result_ref = $client->dispatch_background("post_twit", \$args, {}); return $result_ref; }
worker_post_twitter.pl
æ稿ã«ã¤ããGearmanç¨ã®worker
use Gearman::Worker; use Storable qw(thaw); (snip) my $worker = Gearman::Worker->new; $worker->job_servers(@hosts); $worker->register_function( post_twit => sub { my $job = shift; my %opt = %{thaw($job->arg)}; my $text = $opt{message}; my $reply_id = $opt{reply_id}; my $tcss = $opt{tcss}; if ($opt{video_path}) { return 0 unless (-e $opt{video_path}); my $thumb_url = upload_thumbnail( $opt{video_path}, ($opt{tag} || ''), ); $text .= ' '.$thumb_url; } if (1 == int(rand(3))) { $text = convert($text, $tcss, $ua); } warn $text; my $args = { status => $text, }; $args->{in_reply_to_status_id} = $reply_id if (defined $reply_id); return ($twit->update($args)) ? 1 : 0; } ); $worker->work while 1;
text converter
Wedataã®Text Conversion Servicesã«ç»é²ããã¦ããã®ãã¤ããã¾ãã
sub convert { my ($text, $tcss_ref, $ua) = @_; use HTTP::Status qw/:is/; my @tcss = @{$tcss_ref}; srand(time); if (@tcss) { my $id = ''; if ($text =~ s/^(\@\w+\s)//) { $id = $1 || ''; } my $url = ''; if ($text =~ s/(\shttp\:\/\/.*)$//) { $url = $1 || ''; } my $new_text; my $response; do { my $service = $tcss[floor(rand(scalar(@tcss)))]; my $surl = $service->{url}; warn $surl; my $text_esc = uri_escape( encode( ($service->{enc} || 'utf-8'), $text ) ); $surl =~ s/\%s/$text_esc/; if ($service->{xpath}) { $new_text = get_text_by_xpath($surl, $service->{xpath}, $ua, $service->{enc}); } else { $ua ||= LWP::UserAgent->new(); my $resp_local = $ua->get($surl); if (is_success($resp_local->code)) { $new_text = decode($service->{enc}, $ua->get($surl)->content); } } } while (!$new_text); $new_text =~ s/^\@/ï¼ /; $text = $id.$new_text.$url; warn $text; } return $text; }
Webãµã¼ãã¹ã®ã¤ãããã
çªçµè¡¨ã®æ¤ç´¢
- gooçªçµè¡¨ã§æ¤ç´¢
- ã¿ã¤ãããªãã£ãããyahooã§æ¤ç´¢ãã¦æåã®ã¿ã¤ãã«ãåå¾
- gooçªçµè¡¨ã§åæ¤ç´¢
- ãªãã£ããããããã
- çªçµæ¤ç´¢
sub retrieve_keyword { my ($keyword, $ua, $repeat) = @_; return unless $keyword; my $search_url = 'http://tv.goo.ne.jp/search/result.php?genres%5B%5D=&category=VU&key=' . uri_escape(encode('EUC-JP', $keyword)); my $tree = HTML::TreeBuilder::XPath::Remote->new_from_uri($search_url, $ua); my $number; my @number_nodes = $tree->findnodes('id("incontents")/p[@class="fs16"][1]'); if (@number_nodes) { my $text = $number_nodes[0]->as_text; $text =~ /\((\d+)件\)/; $number = $1 || 0; } return unless $number; my $xpath = '//table[@class="t01"]//a[contains(@href, "/contents/program")]'; $xpath .= '[count(./img) < 1]' if ($repeat); my @urls = $tree->findnodes($xpath); my @url_list; if (scalar(@urls)) { @url_list = map { $_->attr('href') } @urls; return { number => $number, list => \@url_list, }; } return; }
- ããããã¦
sub justify_keyword { my ($keyword, $ua) = @_; my $yahoo_search_url = 'http://search.yahoo.co.jp/search?ei=UTF-8&p=' . uri_escape(encode('utf-8', $keyword)); my $tree = HTML::TreeBuilder::XPath::Remote->new_from_uri($yahoo_search_url, $ua); my $text = ''; if (my @nodes = $tree->findnodes('id("web")/ol/li/a')) { $text = $nodes[0]->as_text; } $text =~ s/\[[^\]]+\]$//; return "$text"; }
cookpadã§æ¤ç´¢
- ãã¼ã¯ã¼ããã¡ãã£ã¨å解ãã¦ããµã¤ãã«æ¤ç´¢
- çµæããææã ãæ½åºãã¦ããææè²·ã£ã¦ããã
sub retrieve_keyword_cookpad { my ($keyword, $ua) = @_; return unless $keyword; if (my @keywords = split(/ã¨|ã®|ã§ä½ã/, $keyword)) { $keyword = join ' ', @keywords; } my $search_url = 'http://cookpad.com/%E3%83%AC%E3%82%B7%E3%83%94/' . uri_escape(encode('utf-8', $keyword)); my $tree = HTML::TreeBuilder::XPath::Remote->new_from_uri($search_url, $ua); my $xpath = '//div[@class="recipe-preview"]//span[contains(@class, "title")]/a'; my $xpath_ing = '//div[@class="recipe-preview"]//div[contains(@class, "material")]'; my @urls = $tree->findnodes($xpath); my @ings_nodes = $tree->findnodes($xpath_ing); if (scalar(@urls)) { my $index = floor(rand(scalar(@urls))); my $url = $urls[$index]; my $ing = $ings_nodes[$index]->as_text; $ing =~ s/(\s|ã)+/ /g; $ing =~ s/^\s*ææï¼//; my @ings = map {s/\s.*$//;$_} split /ã/, $ing; @ings = (@ings > 3) ? @ings[0..2] : @ings; return { title => $url->as_text, url => $url->attr('href'), ingredients => \@ings, }; } return; }
HDDã¬ã³ã¼ãã¼æ©è½
- é²ç»äºç´è¦æ±ããiEPGãã¡ã¤ã«ãåå¾ãé²ç»äºç´ãªã¹ãã«è¿½å
- æ¯åé²ç»æ©è½ï¼æ¥ã«1å1é±éåã®çªçµãæ¤ç´¢ããããããããã®ããã¹ã¦é²ç»äºç´ãªã¹ãã«è¿½å
- 30ç§ãã¨ã«é²ç»ãªã¹ããèµ°æ»ãé²ç»éå§ãã©ã°ã®ç«ã£ãiEPGãã¤ãã£ã¦é²ç»
使ç¨ããWebãµã¼ãã¹
ãããã使ç¨ãã¦ãã¾ãã
ã¾ãã
- gooçªçµè¡¨ãçªçµè¡¨ã®æ¤ç´¢ã«
- ã¯ãã¯ããããã¬ã·ãã®æ¤ç´¢ã«
- Yahoo! ã¦ã§ãæ¤ç´¢ãæ¤ç´¢æã®ããããã¦ãã¼ã¿ãã¼ã¹ã¨ãã¦
ããããåæã«ä½¿ç¨ãã¦ãã¾ãããã¿ã¾ããâ¦
è¬è¾
- ãã®ãããªçºè¡¨ã®å ´ãç¨æãã¦ãã ãã£ããã¼ã ã©ãæ§
- flickrã®proã¢ã«ã¦ã³ãããã ãã£ãææä¼å¡ã®isbshæ§
- ãã®ä»ããããã¢ã¤ãã£ã¢ãé ããããã£ã©ã¯ã¿ããã¯ããã¦ãã ãã£ãtwitterã§ã®following/followersåä½
ãããã¨ããããã¾ããããããããfuba_recorderããããããé¡ããããã¾ãã
Twitterã®favoritesæ°ã表示ããGreasemonkey User Script
GETã ã¨APIå¶éã«ãªããã¨ãå¤æããã®ã§userscripts.orgããå¼ãä¸ãããã©ãã¨ããããã½ã¼ã¹ã ãè²¼ã£ã¨ãããã¤ãã®ããã«POSTã§APIå¶éã¯ç¡è¦ã§ããã®ã§ã使ããã人ã¯ããããã£ã¦ä½¿ãã°ããã¨ãããã¾ããããPOSTã§APIå¶éã¯ç¡è¦ã§ããªããªã£ãã®ã§ä½¿ããªãæ¹ãããã§ããã
// ==UserScript== // @name Twitter favorites counter // @namespace http://fuba.moaningnerds.org/ // @include http://twitter.com/* // ==/UserScript== $X('//link[@rel="alternate"]')[0].href.match(/(\d+)/); var id = RegExp.$1; GM_xmlhttpRequest({ method: "GET", url: "http://twitter.com/users/show/" + id + ".xml", onload: function(x){ if (x.responseText.match(/<favourites_count>(\d+)<\/favourites_count>/)) { var span = document.createElement('span'); span.className = 'stat_count'; span.appendChild(document.createTextNode(RegExp.$1)); var link = $X('id("favorites_tab")')[0]; link.insertBefore(span, link.childNodes[0]); } } }); // simple version of $X // $X(exp); // $X(exp, context); // @source http://gist.github.com/3242.txt function $X (exp, context) { context || (context = document); var expr = (context.ownerDocument || context).createExpression(exp, function (prefix) { return document.createNSResolver(context)(prefix) || (document.contentType == "application/xhtml+xml") ? "http://www.w3.org/1999/xhtml" : ""; }); var result = expr.evaluate(context, XPathResult.ANY_TYPE, null); switch (result.resultType) { case XPathResult.STRING_TYPE : return result.stringValue; case XPathResult.NUMBER_TYPE : return result.numberValue; case XPathResult.BOOLEAN_TYPE: return result.booleanValue; case XPathResult.UNORDERED_NODE_ITERATOR_TYPE: // not ensure the order. var ret = [], i = null; while (i = result.iterateNext()) ret.push(i); return ret; } return null; }
ããã§ãããããããããMeCabããããããã³ãããã*1
ä»æ¶ç«ãä¼é²é²ã¢ãã³MeCabï¼ï¼äºæã¸ãã³ããã¯ã
ãã£ãããªãã£ãï¼ãªããã
ãã¼ãº
å®è£
ææ°çã®MeCabããããã§ãã§ãã
% wget http://nchc.dl.sourceforge.net/sourceforge/mecab/mecab-ipadic-2.7.0-20070801.tar.gz % tar vxzf mecab-ipadic-2.7.0-20070801.tar.gz % cd mecab-ipadic-2.7.0-20070801 % wget http://fuba.moaningnerds.org/src/papyopu/conv.pl % perl conv.pl % wget http://fuba.moaningnerds.org/src/papyopu/decode.pl % exthtml.pl -x '//*[contains(@class, "entry-content")]' -p '$v=~s/^\s+//;$v' \ -n '//a[@rel="prev"]/@href' -d 2 http://twitter.com/youpy | perl decode.pl new ãããã å½é ãããããã¼ã é²ãµã¢ã¢ã»ã¼ã« ãã³ãããããã¼ãã¼ãããããããããã åã¢çã¯ãã¹ã¼ãã¼ã¸åæã«å¯ã¦ããã ãã³ãã³ããããã ãã³ã¬ã³ã¾çããã ãããããããã³ããããããã¼ãã³ããããã¥ããããããDVD ããããããã ã¹ãããå®å ¼é²ç±³å½ãã¼ã²ã³ãç¡äºåå·æ£ã®DVDã¯ãããå¾ ã£ã ããããããããã ä»ã¯ãããã¸æã£ã ããããããããã³ããã³ã ç±³é²é²é¨ã®ãã§ã³ã¹é£²ãã ãããããã¼ããããããããã ã·ã·ã³ã¯ã«ã¼ãï¼çæ¬å¸ã®æ¥ ãããããã + ãã³ããã¼ãã¼ã㤠ã¢ã³ã¦ãã¤ã¸+ï¼ãã¼ãã¼ã㤠ããã ï¼äºèª² ãããã¼ã ãã«ãã¼ã Handling ããã Handlingã ã£ã Handing ããã http://tinyurl.com/69slhd Handingã¸äºèª²http://tinyurl.com/69slhd ããããã å ã»ã«ã㢠ããããããã ã»ãã¯ã¹äºèª²ã« Gnip + twitterãURL ããããããããããAPI ãããããã£ããããããã³ãã Gnip+twitterãURLã«æãããçµæ§APIãããã©ã¸ã£å¦ã¸å»ããç¥ç°ç ããã³ ä¸è« -196 ããã -196ã¼ãåº ããããããããããããã ã¬ã¹ãã¹ã¯ã«ããããäºãã° Jãã¼ããããã Jãã¼ã ãç²ã ãããã å½é ããããã ä»ãçµæ ããããããããã¼ã é²ãã©ã¦ãå¯ã¦ã¡ã¼ã ããããããããã é²ã°ã¢ããã©ã±ã㢠@jazzanova ãã³ãããï¼ @jazzanova群ã®äºèª²ï¼ ãã³ãã¼ããã³ ãµã³ã±ã¼ãã½ã ããããã³ãããããããã ããªãé¡ã決å®ãã®ä» ãã¼ãã¼ ãã¼ãªã¼ ãããããã è§ç°ä¸è¶ ããããã ã¯ã©ãã£ã ãããã¥ãããããã ã©ãã·ã¥çã¸åç© ãããã¼ã ãããã¼ã @fub ããã @fubå¼·ã ãã³ãããããããã åã¢é²ãã¤ããå¯ã ãããããããããã ï¼èª²ã¸ã°ãºã°ãºæ¢ã¾ã ããããã ä»ãçµæ emobile ãããã³ããããããã emobileã«ç¡ã¬ã³ã²ã¸è¡ãã®ã ã ããã¼ãã¼ ã±ã©ã¼ãªã¼ ãã¼ãã¼ããããã ã³ã¼ãã¼ã ã£ã¦æ㤠ãã¥ãã㣠åºå° ã ã ãããã å½é ãããã¼ãããããããããããããããã ä»ã¢ã¯ã¼ããå¼ã³æããç¡å·®å¥ãå¯ããã ããããã¼ ã¹ãã¹ãªã¼ ããã³ããã ããããªãã ãã¤ããããããããããããããããã³ããããã³ããããã ãã¤ãããããããå ãã«ãå é¨ã®ããã³ã©ãã©ï¿¥ãäºäºã±ã¿ ãã¼ã ãã¼ã ãããã³ãã³ åã½ã³ã»ãµã³ ããã http://tinyurl.com/575vb3 ã«ããhttp://tinyurl.com/575vb3 ãããã å½é @bulkneets ãããããããã³ããã @bulkneetsç¡ã¹ãã¹ãã¢ãã³æ°ã®æ¥ http://api.satoru.net/text2... http://api.satoru.net/text2... ãã¼ãã¼ããããããã³ããããããããã ã¦ã¼ãã¼ãã¹ãã«ããã³ã¯ãåã¿ããå¯ãã ããã ã«ãã ããã ã°ã¬ã¦ ãã³ããã¼ æ¬é¨Î¡ ããããããã ãã«æ±ºå®ã ããã æ©ãã ãããããããã ãµã¢ã¢ãã«ãå¦ï¼ ãããã¤ã㤠ãããã¤ãã¤
ä½ããã£ã¦ããã¨ããã¨
ã¾ããconv.plã§å¦ç¿æ¸ã¿ipadicã®è¦åºãèªãæè¿ã¯ãã£ã¦ããè¡ã«å¤æãã¦ãã¾ãããã®ãã¨decode.plã®ä¸ã§MeCabã使ã£ã¦å½¢æ ç´ è§£æãè¡ããç´ æ§åï¼å è¦åºãèªã®å¤æãè¡ããã¨ã§ã¾ã¨ããªæ¥æ¬èªã«å¤æãã¦ãã¾ããdecode.plã«çªã£è¾¼ãããã¹ãã¯exthtml.plã§Twitterのポプピーさんã®çºè¨ããã¶ã£ãæãã¦ãã¦ãã¾ãã
ã±ã£ã¨è¦ãæã
ããããã ãã§ãããã¾ã¨ãã ã£ãããã®ãããã¼ããã®çºè¨ã大éã«åéãã¦ããããå½¢æ
ç´ è§£æï¼パ行に変換ãããã®ãå¦ç¿ç¨ã³ã¼ãã¹ã¨ãã¦ä½¿ç¨ããã¨å¤å°ããã«ãªãããããããã³ã
ããããã³ã¨æããã®ãã¢ã¬ã ããç°¡åãªã®ãªãã§ããããªã¼ã¨åããç¯å²ã®ãã°å
¨é¨ã¨ã£ã¦ãã£ã¦ã¿ããã®ã®ãæèç¡è¦ãã¦æ¼¢åã®ç¾
åã«ãªãå§æ«ã§ããããã ãã§ãããå½¢æ
ç´ è§£æã®å¦ç¿ãã¼ã¿ã¨ãã¦ã¯ä½æ¡ãææ°ã足ããªãã£ãã®ããããã¨ããããããééããã®ãããããããªããã©ãããã¡ãã£ã¨èããå¿
è¦ããããããã
URLã¨XPathã渡ãã¨å¤ãè¿ããã¼ã«ããã£ã¨æ¥µæªã¶ã£ãæããã§ãããã¼ã«ã«æ¹é ãã¦ã
値がとれるだけã§ã¯éå±ããã¼ã¸è¾¿ããããããã®å ã辿ãããã®ã§æ©è½è¿½å ãããã¶ãããã¾ãããªãã¾ããããã¨ã¯ãã£ãã·ã¥ãã§ããã°ããã§ããã¼ã
追å ãããªãã·ã§ã³
- n
- 次ã®ãã¼ã¸ï¼å¥ã«æ¬¡ãããªãã¦ããããã©ï¼ã®URLãè¿ãã¦ãããXPathããã£ã±ããããããã¦ãæåã®1ã¤ãããã©ãã¾ãã
- d
- ãã¼ã¸ã辿ãåæ°ãããã©ã«ã1
- s
- HTML::Elementãããããã¦ãå ´åã«HTMLã½ã¼ã¹ãåã
- f
- å¦çãã¦ããURLãåºåããçµæã®å¤ã®åã«ã¯ã¿ããã¤ãã¦ãããã©ã¼ããã(ãã¾ã²ã¨ã¤ãªã®ã§ãªãã¨ãããã)
- URLã®ãããã«-
- æ¨æºå ¥åããæ¹è¡åºåãã§URLãããã¨ã
ããã
twitterã®followingãªã¹ãã0åãã¼ã¸ç¶ã足ããã¦ãããããæ½åºããã¦ã¼ã¶ãªã¹ãã®favoritesãããã«ç¢ºèªãå½¼ãã®favã£ã¦ãã¦ã¼ã¶åãéè¨ããã
% alias exthtml="perl /Users/ec/bin/exthtml.pl -a Mozilla -c ~/Library/Cookies/Cookies.plist" % exthtml -X '//strong/a[@rel="contact"]/@href' -n "//a[contains(@rel, 'next')]/@href" \ -d 0 http://twitter.com/friends | perl -ne 'chomp;print "${_}/favourites\n"' | \ exthtml -X '//*[@class="content"]/strong/a/text()' -s - | sort | uniq -c 5 33 1 4316 1 8am 1 941 1 AirReader 2 Hamachiya2 1 IronNine 1 Johnny_S (snip) 1 yoppy 6 youpy 1 yugui 2 yuiseki 3 yukichi 1 yusukebe 2 yuyarin 1 yuzupepper 1 zammersonic
ãã¡ããåã®ã»ãã®exthtmlã®-dããµããã°followingå ¨å¡ãã©ããããå¾ã®ã»ãã®exthtmlã«-nã-dãã¤ããã°ã©ãã©ãæ·±ã辿ãã¦ã¹ããã両æ¹-d 10000ãããã«ãããéå»ã®favoritesããã¶ã¨ãã¾ããã ãã©twitterã®ãµã¼ãã¯è²§å¼±ãªã®ã§ããã¾ãå©ãã¨æ»ã«ããã§ãããã§ããã