Created
February 25, 2016 11:07
-
-
Save Grassboy/860305f623cf75420077 to your computer and use it in GitHub Desktop.
取得臉書所有照片按讚數排名
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//取得自己牆上按讚數排行 | |
/* | |
使用方式, | |
0. 安裝 gClipboard: https://addons.mozilla.org/zh-TW/firefox/addon/grassboy-clipboard/ | |
1. 到 https://www.facebook.com/[你的臉書id]/photos_all 進入你的相片頁,並捲開所有相片 | |
2. Firefox 下按 Shift+F4 | |
3. 貼入這整段文字 | |
4. 頁面會將結果複製到剪貼簿裡 | |
5. 貼到記事本,就是你所有相片的按讚數排名了~ | |
*/ | |
var t = []; | |
$$('.uiGrid._51mz').filter(function (obj) { | |
return obj.getAttribute('aria-label') && obj.getAttribute('aria-label').match(/^[\d]+ likes$/); | |
}).map(function (obj) { | |
t.push(obj.getElementsByClassName('_50f3') [0]); | |
}); | |
t.sort(function (a, b) { | |
return parseInt(a.innerHTML) < parseInt(b.innerHTML) | |
}); | |
var m = []; | |
t.map(function (x) { | |
if (parseInt(x.innerHTML) > 10) { | |
m.push( | |
x.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode. | |
parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.firstChild.getAttribute('href')+'#likes:'+x.innerHTML | |
); | |
} | |
}); | |
gClipboard(m.join(' \r\n')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment