How do I filter facebook data avaialble in datasift using csdl with a unique id which identifies a user.
Reading docos,
facebook.author.hash_id seems to be unique per user.
My CSDL,
$CSDL = 'facebook.author.hash_id == "some_facebook.author.hash_id"';
The datasift client library returns the following error,
"Uncaught exception 'DataSift_Exception_CompileFailed' with message
'The target facebook.author.hash_id does not exist' "
However I'm able to filter facebook messages using,
'facebook.author.type == "user"'
Both filter tags above, are mentioned in the below post.
[Ref http://dev.datasift.com/docs/data/dictionary ]
How do we filter facebook messages using the author (hash_id or other) ?
It is not possible to filter for individual Facebook users with Datasift. Facebook asked for all its data to be anonymized.
The output you get from Datasift is not a one for one reflection of what can be filtered on, take a look at the data dictionary.
The hash_id is created by Datasift to obscure the user's real ID. However, the hash_id will always be the same for a given user.
As of April 2015 the Facebook search API was deprecated. If you are looking for Facebook topic data you can take a look at Datasift PYLON.
Related
I need to automatically generate url to the existing advertisement in google adwords. I've got a link like this:
https://adwords.google.com/cm/CampaignMgmt?authuser=1&__u=%param_one%&__c=%param_two%#c.%param_three%.create&app=cm
I do not know what are those params one, two, and three. I do not know where can I get them and what is their role in an address. But I'd like to! In fact I just need to generate a URL to click on it and appear on an ad page. How can that be done? May be their lib provides a method to generate url like this?
Unfortunately that's not possible, at least not in a reliable way (see also this rather old post from the Adwords API forum).
The structure itself is not hard to parse:
Inside the query string, __u is your user account's ID while __c refers to the ID of the specific Adwords account. These don't appear to be in standard Adwords XXX-XXX-XXXX format, though, so you would have to either create a mapping of all your accounts or come up with the proper translation function.
The fragment refers to a specific Adwords entity, for instance; c.123 is the campaign with ID 123 while a.ABC_XYZ refers to the adgroup with ID ABC inside the campaign with ID XYZ.
But even if you manage to get the __u and __c parameters right, more often than not you will be redirected to your Adwords account's top level view.
Interestingly enough, Google Analytics introduced little buttons in the "Adwords" reporting tab a few months ago which are supposed to take you right to the correct campaign if you have access to the linked account, but even those only work half of the time, especially if your Adwords account is an MCC.
Having trawled the web for days, I cannot find an up-to-date, working method to retrieve a list of the latest statuses on a Facebook page.
On the status section of the Graph API, I am greeted with "This document refers to a feature that was removed after Graph API v2.3"
I can't get file_get_contents to work on Facebook pages as I'm presented with a Captcha
It's for competitor research, I only actually want:
Post date
Number of Likes/Share/Replies
I couldn't care less for the status content itself, just the metrics around it.
A JSON object would be great, but I'll take anything at this stage.
Anyone else managed to get this sort of data or know a way to use file_get_contents on Facebook pages?
Thanks.
A status is just a certain kind of post – so all you need to do is request the page’s feed (resp. posts) instead, and then check if their type is status.
I've just tried to access the post object to get like/favourite counts .etc and get "[message] => (#12) singular statuses API is deprecated for versions v2.4 and higher"
You need to use the “full” post id as you get it from the /feed or /posts endpoint – the combination of page-id, underscore, post-id. (At least that’s the current format, but someone from Facebook told me we should not rely on that, it might change at some point. Best if you really just use the full id, as the endpoint returns it.)
And since you are interested in overall number of likes only, not the individual likes, you could make a request like this,
{full_post_id}?fields=likes.summary(1).limit(0)
That requests the summary (contains total counts), and limits the number of individual likes returned to zero (so as not to request any unnecessary data.) It works the same for comments. But I think for shared posts there is no such counts, you will only get a list of posts (which might not be all, but only those you are allowed to see.)
when I look at the API Docs of Twitter for mentions it says the following
Returns the 20 most recent mentions (tweets containing a users's #screen_name) for the authenticating user. The timeline returned is the equivalent of the one seen when you view your mentions on twitter.com. This method can only return up to 800 tweets. See Working with Timelines for...
However, another site I found gets the mentions without having the user authenticated.
How exactly do I get those mentions? From the picture I posted it looks like the site gets only the public data, so how does it get the mentions when the API states that the mentions are only for the authenticating user?
I would imagine they're using the Streaming API to access all tweets and process them, as this would allow them to see how many tweets mention that particular user.
I'm trying to list most popular (or newest) videos of a channel by its name using YouTube 3.0 API.
I already implemented this, just not sure if it is correct way to do this, so need an advice.
First of I find channel ID by name (e.g. TEDxTalks in place of {channel_name}):
https://www.googleapis.com/youtube/v3/search?part=snippet&type=channel&q={channel_name}&key={API_KEY}
Then I get videos of this channel ID, ordered by viewCount (or date), which perfectly lists videos:
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId={channel_id}&order=viewCount&type=video&key={API_KEY}
How reliable is the first request? If name is the exact match of channel url slug or username (e.g. tedxtalks), will it always return corresponding channel? Or is there any more reliable way to get channel ID by its name?
Thank you.
Search API is not for exact match query. And it searching for all channel title(username found in URL if exist), channel name(xxx added 1 video) and even channel ID!
To answer your question, unfortunately it's not reliable and no other more reliable way.
A quick example, try to query username "abc".
https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=50&q=abc&type=channel&key={YOUR_API_KEY}
The Search API response will return ABCNetwork, ABCNews, udruzenjeabc... and so on. No channelTitle(username) "abc" in the first 50 items.
Even though not all channels have username. If you got username of specific channel, then you should use Channel API for exact match query,
https://www.googleapis.com/youtube/v3/channels?part=snippet&forUsername=abc&maxResults=5&key={YOUR_API_KEY}
You might wonder why YouTube API doesn't provide exact search for "channel name"(xxx added 1 video)? It's because channel name is not unique, as a person name is not unique.
As indicated at https://developers.google.com/youtube/v3/guides/working_with_channel_ids:
If you are using v3 and want to retrieve the channel ID that
corresponds to the currently authorized user, you can call the
channels.list(part="id", mine=true) method. This is equivalent to
asking for the channel profile of the default user in v2.
If you ever do find yourself with an arbitrary legacy YouTube username
that you need to translate into a channel ID using v3 of the API, you
can make a channels.list(part="id", forUsername="username") call to
the API.
If you only know a display name and are looking to find the
corresponding channel, the search.list(part="snippet", type="channel",
q="display name") method will come in handy. You should be prepared to
deal with the possibility of the call returning more than one item in
the response, since display names are not unique.
Finally, i have no idea why YouTube didn't force to generate a unique readable username (like how Facebook add a random number at the end of duplicated username, e.g. zuck.5 and zuck.21 ) for all new user.
References:
https://developers.google.com/youtube/v3/docs/search/list
https://developers.google.com/youtube/v3/docs/channels/list#try-it
https://support.google.com/youtube/answer/2657968?hl=en
https://developers.google.com/youtube/v3/guides/working_with_channel_ids
I found this code:
$request_url ="https://graph.facebook.com/comments/?ids=" . $purl;
$requests = file_get_contents($request_url);
$fb_response = json_decode($requests);
But I am not finding any official FACEBOOK docs. Is there a better way, or this is the standard facebook way?
Also how do you suggest to implement the database schema?
For example i saw the commment id is something like this: 400711659874_19158387
Should I make an id field of CHAR(21) ?
Thanks
Edit1:
found some doc (a blog post) about crawling fb comments:
http://developers.facebook.com/blog/post/490/
The code sample you're using is functionally correct.
Initially, you'll have to run a script to fetch comments for all the unique URL's on your site which have the FB comments plugin. To refresh that listing periodically, you can later use the 'comment.create' and 'comment.remove' events to trigger an AJAX request which updates the comments for that particular URL in the background.
This is the easiest implementation to grab information from an external resources,
a more industry standard is using curl,
Here is the comparison from one of the old question :-
https://stackoverflow.com/questions/555523/file-get-contents-vs-curl-what-has-better-performance
FB has the login mechanism to prevent unauthorized content grabbing
There are some SDK you can make use.
Also how do you suggest to implement the database schema?
For example i saw the commment id is something like this: 400711659874_19158387
Should I make an id field of CHAR(21) ?
If the comments is tied to your website contents,
you should have a minimum of two columns,
one to store your website contents ID,
one for FB comment ID
varchar(21) is fine, as long can fit the maximum length of the FB comment ID