Quantcast
Channel: Programming – Gea-Suan Lin's BLOG
Viewing all articles
Browse latest Browse all 103

取得 Facebook 原始 Post ID 的 bookmarklet

$
0
0

現在的連結都是 pfbid 這種可被追蹤的 id,先前還可以用 mbasic 的頁面找出原始 Post ID,但 mbasic 關掉後就暫時找不到解法。

剛剛搜發現 https://gist.github.com/t-wy/66faed8679d127793891ecb775efdaa9 這邊的方法,主要是找 script 裡面的 share_fbid 來用。

改寫一下變成 bookmarklet

javascript:_fbid=[...document.querySelectorAll("script")].filter(x=>x.innerHTML.includes("share_fbid"))[0]?.innerText.match(/share_fbid":"(.+?)",/)[1];if(_fbid)document.location.href=document.location.href.replace(/pfbid[0-9A-Za-z]*/,_fbid);

但還是有很多沒辦法用的地方,目前觀察看起來只有個人類型的頁面才有辦法抓到,其他像是專業帳號的就沒辦法了。


Viewing all articles
Browse latest Browse all 103