Skip to content

Instantly share code, notes, and snippets.

@sue445
Last active August 29, 2015 14:20
Show Gist options
  • Save sue445/581ef004bc86817729ac to your computer and use it in GitHub Desktop.
Save sue445/581ef004bc86817729ac to your computer and use it in GitHub Desktop.
instagramからLike数の多いのを抽出するスクリプト
// Chromeのwebインスペクタに下記を入力して実行
var images = [];
$(".PhotoGridMediaItem").each(function(){
// ex. いいね!7件・コメント0件
var label = $(this).attr("aria-label");
var url = "https://instagram.com" + $(this).find(".pgmiImageLink").attr("href");
images.push({label: label, url: url});
});
// labelで降順ソート
images.sort(function(a, b){
if(a.label > b.label){
return -1;
} else if(a.label < b.label){
return 1;
}
return 0;
});
// 多い順に3件くらい表示
for(i = 0; i < 3; i++){
console.log(images[i]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment