4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AKB48総選挙のデータをブラウザの機能だけでCSVに変換

Posted at

AKB総選挙も終わりました。そして気になるのが得票数。
http://sousenkyo.akb48.co.jp/result.php

せっかくなので分析可能な状態にしましょう。

javascriptソース

console.log(Array.from(
document.querySelectorAll(".member-list > li"),  
e => {return e.querySelector(".result_name").innerText + "," + e.querySelector(".result_count").innerText.replace(/[^0-9]/g, ''); }
).join("\n"));

これを、
http://sousenkyo.akb48.co.jp/result.php
を開いている、Chromeのコンソールに貼り付けてエンターを押すと、CSVでダンプされます。

こんな感じ。

指原 莉乃,243011
渡辺 麻友,175613
松井 珠理奈,112341
山本 彩,110411
柏木 由紀,92110
宮脇 咲良,78279
須田 亜香里,69159
島崎 遥香,68126
兒玉 遥,60591
武藤 十夢,58624
横山 由依,58610
北原 里英,50190
向井地 美音,47094
岡田 奈々,43318
...

あとは、これをエクセルに貼り付けて、グラフにすれば、選挙の規模感が分かる。

グラフ

名称未設定.png

http://qiita.com/yugo-yamamoto/items/b87470f118ac62dc6a8d
で、書いてる、最期の方法をひな形に、querySelectoAllとArray.Fromを使って、繰り返し処理にしています。

4
4
0

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
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?