<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>ja-Phantomjs on Junpei Kawamoto</title>
    <link>https://www.jkawamoto.info/tags/ja-phantomjs/</link>
    <description>Recent content in ja-Phantomjs on Junpei Kawamoto</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <managingEditor>junpei.kawamoto@acm.org (Junpei Kawamoto)</managingEditor>
    <webMaster>junpei.kawamoto@acm.org (Junpei Kawamoto)</webMaster>
    <copyright>&amp;copy; 2016-2017 Junpei Kawamoto</copyright>
    <lastBuildDate>Sun, 05 Jun 2016 00:00:00 +0000</lastBuildDate>
    
	<atom:link href="https://www.jkawamoto.info/tags/ja-phantomjs/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Travis で PhantomJS 2.1.1 を使う</title>
      <link>https://www.jkawamoto.info/blog-ja/install-phantomjs-in-travis/</link>
      <pubDate>Sun, 05 Jun 2016 00:00:00 +0000</pubDate>
      <author>junpei.kawamoto@acm.org (Junpei Kawamoto)</author>
      <guid>https://www.jkawamoto.info/blog-ja/install-phantomjs-in-travis/</guid>
      <description>本稿は Qiita 投稿記事 のバックアップです．
 概要 Travis CI で PhantomJS と Selenium を使ったテストを行っているのだが， PhantomJS のバージョンが古くて上手くいかなかった．PhantomJS 2.1.1 をインストールする方法を調べたのでまとめておく．
方法 Travis CI には PhantomJS 1.9.8 が予め用意されているので，このバージョンで問題ない場合は何もする必要は無い．バージョン 2.1.1 が必要な場合， .travis.yml に下記の項目を追加する．
before_script: - mkdir travis-phantomjs - wget https://assets.membergetmember.co/software/phantomjs-2.1.1-linux-x86_64.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 - tar -xvf $PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C $PWD/travis-phantomjs - export PATH=$PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH  この https://assets.membergetmember.co/software/phantomjs-2.1.1-linux-x86_64.tar.bz2 が使えない場合は， 代わりに https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 も使えるらしい． Bitbucket の方はブロックされたらしいと聞いたので，assets.membergetmember.co の方を使った．こちらは今のところ問題無い模様．
参考 https://github.com/travis-ci/travis-ci/issues/3225 （というか，このスレから解決方法を抜き出しただけ．）</description>
    </item>
    
    <item>
      <title>Youtubeのコメントをスクレイピングする</title>
      <link>https://www.jkawamoto.info/blog-ja/youtube-comment-scraper/</link>
      <pubDate>Fri, 22 Apr 2016 00:00:00 +0000</pubDate>
      <author>junpei.kawamoto@acm.org (Junpei Kawamoto)</author>
      <guid>https://www.jkawamoto.info/blog-ja/youtube-comment-scraper/</guid>
      <description>本稿は Qiita 投稿記事 のバックアップです．
 概要 コメントの親子関係を利用したビデオ共有サイトにおけるネットいじめコメントの検出では，Youtubeに投稿されたコメントを対象に，いじめコメントの検出を行っている．この研究のために，YoutubeコメントのスクレイピングツールYoutube comment scraperを作成した．
Youtube comment scraper そのなの通り，Youtubeの動画再生ページをスクレイピングして，投稿されたコメントを取得する．パッケージはnpmに登録してあるので，npmコマンドにてインストールできる．
スタンドアロンで利用する場合，
$ npm install -g youtube-comment-scraper  とすれば，scraperコマンドが利用できるようになる．このコマンドの利用方法は，
Usage: scraper url [options] url URL for a Youtube video page or video ID. --help, -h Displays help information about this script --version Displays version info  となっていて，要するにYoutubeの動画再生ページのURLか，動画IDを渡せば良い． 例えば，
# URLを渡す場合． $ scraper &amp;quot;https://www.youtube.com/watch?v=vN4U5FqrOdQ&amp;quot; # IDを渡す場合 $ scraper vN4U5FqrOdQ  などとなる．出力はJSON形式で下記のようなフォーマットである．
{ &amp;quot;id&amp;quot;: &amp;quot;動画 ID&amp;quot;, &amp;quot;channel&amp;quot;:{ &amp;quot;id&amp;quot;: &amp;quot;チャンネルの ID&amp;quot;, &amp;quot;name&amp;quot; : &amp;quot;チャンネル名&amp;quot; }, &amp;quot;comments&amp;quot;: [ { &amp;quot;root&amp;quot;: &amp;quot;親コメント&amp;quot;, &amp;quot;author&amp;quot;: &amp;quot;このコメントの投稿者&amp;quot;, &amp;quot;author_id&amp;quot;: &amp;quot;投稿者のID&amp;quot;, &amp;quot;like&amp;quot;: &amp;quot;いいねスコア（下記参照）&amp;quot;, &amp;quot;children&amp;quot;: [ { &amp;quot;comment&amp;quot;: &amp;quot;親コメントへのリプライ&amp;quot;, &amp;quot;author&amp;quot;: &amp;quot;リプライの投稿者&amp;quot;, &amp;quot;author_id&amp;quot;: &amp;quot;投稿者のID&amp;quot;, &amp;quot;like&amp;quot;: &amp;quot;いいねスコア&amp;quot;, }, .</description>
    </item>
    
    <item>
      <title>福岡市の公共施設予約状況をスクレイピングする</title>
      <link>https://www.jkawamoto.info/blog-ja/fukuoka-city-community-space-finder/</link>
      <pubDate>Fri, 22 Apr 2016 00:00:00 +0000</pubDate>
      <author>junpei.kawamoto@acm.org (Junpei Kawamoto)</author>
      <guid>https://www.jkawamoto.info/blog-ja/fukuoka-city-community-space-finder/</guid>
      <description>本稿は Qiita 投稿記事 のバックアップです．
 概要 福岡市では，公共施設の予約状況を調べるウェブサービスが提供されている． しかしながら，かなり昔に設計されたサービスで，RESTでもなければ， 他のサービスと連携させることもできない仕様になっている．そこで，このサービスをスクレイピングし， 各公共施設の予約状況を取得するライブラリ Fukuoka City Community Space Finderを作成した．
インストールとサンプル npm に登録しているので， npm コマンドを使ってインストールできる．
$ npm install fukuoka-city-community-space-finder  Fukuoka City Community Space Finder は４つの関数 area, building, institution そして status を提供する．初めの３つの関数は公共施設名を検索するためのものである． area 関数は福岡市の地域名，要するに区名を返す． building は地域名を引数に取り，その地域にある公共施設の一覧を返す． そして，institution は地域名，公共施設名を引数に取り，その施設に含まれるレンタル可能な単位の名前，例えば「会議室１」や「テニスコート１」などの一覧を返す．
ちなみに， area, building, institution という名称は元々のサービスで使われていた名称に合わせた．
下記にそれぞれの実行例を示す． なお，スクレイピングは非同期処理のため，各関数とも戻り値は Promise である． (参考：今更だけどPromise入門)
var finder = require(&amp;quot;fukuoka-city-community-space-finder&amp;quot;); // 地域名の列挙． finder.area().then(function(res){ console.log(res); }); // -&amp;gt; [ &#39;中央区&#39;, &#39;博多区&#39;, &#39;東区&#39;, &#39;西区&#39;, &#39;南区&#39;, &#39;城南区&#39;, &#39;早良区&#39; ] // 中央区にある公共施設の列挙． finder.</description>
    </item>
    
  </channel>
</rss>