可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I was wondering if it was possible to query the following:
- List of (all) users who like my facebook page, and
- Additional information those users have made publicly available (beyond first and last name)
Basically looking to generate detailed marketing stats of users who like my facebook page, if possible. Any suggestions or alternatives welcome.
Thank you.
回答1:
I am afraid this is NOT possible, follow this bug for more information.
Another proof is the page_fan
table you will notice that only the uid
field is indexable so you need to know the user id to search it and not the page_id
, as you know if a user \"likes\" a page this would mean he is a \"fan\" of that page.
After being actively working with the Facebook API for a while now, and following the announcements and API releases (and deprecations) along with the introduction and changes of policies, I can understand that Facebook will only share info about their users by letting them explicitly do so (a.k.a interact/authorize your Apps).
And hence the best thing to do in the absence of such feature is:
- Understand your audience through Page Insights
- Collect fans interests & info by creating custom apps through Page Tabs and using other Facebook features like Questions
回答2:
Alright, nobody wants to break Facebook\'s TOS but they have tied our hands on our own basic data. So, scraping is illegal, but not saving a page. What I have done (and note that I needed this for offline purpose anyway):
Go to https://www.facebook.com/browse/?type=page_fans&page_id={FAN PAGE ID}
Scroll down until you have all of your fans. Save this page on your local machine, let\'s say, Facebook.html.
Now, using ruby and nokogiri:
require \'nokogiri\'
>true
f = File.open(\'/your_path/Facebook.html\')
doc = Nokogiri::HTML.parse(f.read)
doc.xpath(\'//div[@class=\"fsl fwb fcb\"]/a\').each {|link| puts link.content}
回答3:
Do a graph search likes this: \"People who like [your fanpage\'s name]\". You will all the result.
Then create shortcut on your browser with this javascripts code, it will click on the View more link and scrolling until all result are shown in the page:
javascript: i = 0;minutes = 30;counter = minutes * 60;function repeatScroll() {
if (i < counter) {window.scrollTo(0, document.body.scrollHeight);i++;}
setTimeout(repeatScroll, 1000);}repeatScroll();
After that, create other shortcut and run this js code to retrieve all UID from the search result:
javascript:var txt=\"\";e=document.getElementsByClassName(\"FriendRequestOutgoing\");
for(var i=0; i<e.length; i++) {v=e[i].getAttribute(\"data-profileid\");
if(v) txt+=v+\"\\n\"}document.body.innerHTML=\"<textarea>\"+txt+\"</textarea>\";
A textarea box will appear in the screen with all uid inside. Just copy it to your notepad and import into your Custom Audience in Facebook Ad Manager.
I created and use this code everyday to get all UID with criterial I need.
You can launch any graph search you want.
This is homemade code, so using it without your own responsibility :)
Enjoy them.
回答4:
It\'s possible, just not with FQL anymore.
Do a GET of https://www.facebook.com/browse/?type=page_fans&page_id={FAN PAGE ID} and scrape out the users.
Viola.
回答5:
Now you can get people on your page with this link, or click on Settings button, than on People on the left sidebar. https://www.facebook.com/[PAGENAME]/settings/?tab=people_and_other_pages
If you want to get all the user\'s photo, press F12 and add these codes to the Console:
javascript:i=0;minutes=30;counter=minutes*60;function repeatScroll(){if(i<counter){window.scrollTo(0, document.body.scrollHeight);i++;}setTimeout(repeatScroll,1000);}repeatScroll();
than, when you reached the bottom of the page:
javascript:var txt=\"\";e=document.getElementsByClassName(\"img\"); for(var i=0; i<e.length; i++) {v=e[i].getAttribute(\"src\"); if(v) txt+=\"<img src=\'\"+v+\"\'>\\n\"}document.body.innerHTML=\"<textarea>\"+txt+\"</textarea>\";
To display photos: create a HTML page and first insert these lines into that file:
<meta charset=\"utf-8\">
<style>img { width:21px; margin:-1px; }</style>
<div style=\"width:851px; height:315px;background-color:white;\">
<!-- PASTE HERE PHOTOS\' CODE YOU GET -->
<span style=\"color:#3B5998;font-weight:bold;font-size:20px;margin-bottom:4px;\">600 like, thank you!</span>
<!-- PASTE HERE PHOTOS\' CODE YOU GET -->
</div>
回答6:
Then create shortcut on your browser with this javascript code, it will click on the View more link and scrolling until all result are shown in the page:
i = 0;
minutes = 30;
counter = minutes * 60;
function repeatScroll() {
if (i < counter) {
window.scrollTo(0, document.body.scrollHeight);
i++;
}
setTimeout(repeatScroll, 1000);
}
repeatScroll();
After that, create other shortcut and run this js code to retrieve all UID from the search result:
var e=document.getElementsByClassName(\"fsl fwb fcb\");
var ids = [];
for(var i = 0 ; i < e.length; i++){
ids.push(JSON.parse(e[i].childNodes[0].getAttribute(\"data-gt\")).engagement.eng_tid);
}
console.log(ids);
回答7:
load all list
i = 0;
minutes = 30;
counter = minutes * 60;
function repeatScroll() {
if (i < counter) {
window.scrollTo(0, document.body.scrollHeight);
i++;
}
setTimeout(repeatScroll, 1000);
}
repeatScroll();
get id
var e=document.getElementsByClassName(\"_3cb8\");
var ids = [];
for(var i = 0 ; i < e.length; i++){
ids.push(e[i].getAttribute(\"href\"));
}
console.log(ids);
回答8:
You can get it using facebook open graph.
https://graph.facebook.com/<your-page-name-or-page-id>/likes
For example :
https://graph.facebook.com/chickfila/likes
You need to send graph api call using \"id\" for more detail about user who like you page.
However, this call will retrieve the other Facebook objects that the page (Chickfila) has liked, NOT the users who have liked the Chickfila page.