How filter public posts by specific language or get the language field? - facebook

I'm trying to get the public posts for a specific subject with Facebook API en French for example (you need to change the access_token below) with this way :
https://graph.facebook.com/search?q=cinema&type=post&access_token=abc|abc&locale=fr_FR
This is not working. I have mixed languages (Spanish, French, English...) in the result. I checked the Facebook developers website and I cannot find a issue here. Somebody have the same problem?
In fact, if in the results, i have a lang key associated to each post, this would be good to me. I tried to add in the url fields=languages (and anothers words like lang,language,locale...) but this is not working too.
Thank you for your help! (sorry for my English)

graph.facebook.com/search?q=cinema&type=post&locale=fr_FR
In fact, when running this query, the locale parameter is considered. It gives categories translated in French.
{
"id": "376665779074901_525847047490106",
"from": {
"category": "Site internet de détente/sports",
"name": "Hasil+jadwal+klasemen Sepakbola",
"id": "376665779074901"
},
"message": "Hasil Pertandingan\n\nLike (y) & Bagikan ...\n\n• England- Premier League\nFT Chelsea 2 - 0 Fulham\nGoals :\n52'[1 - 0] Oscar\n84'[2 - 0] John Obi Mikel\n-\nFT Liverpool 0 - 1 Southampton\nGoals :\n54'[0 - 1] Dejan Lovren\n-\nFT Newcastle United 2 - 3 Hull City\nGoals :\n10'[1...
}
But I must agree, it's not really helpful. The least you could do would be, in the case of a user post, to check what is the language the user is using:
graph.facebook.com/USER_ID?field=locale
Apart from that, I have to say that you can't rely on Facebook's locale information. Facebook doesn't know if a post has been written in French or English. ALso, someone using Facebook in English doesn't mean he will only write english posts. If you want to find all messages in a specific language, better check all messages by yourself with another web service dedicated to language recognition.

Related

Is there a way to find the service associated with a serviceId on google admin?

By running Privileges.list on google admin sdk we get a JSON looking like this:
{
"kind": "admin#directory#privilege",
"etag": "\"JCPRxFaiNR1s5TJ6ecIH8OpGdY4efiOYXbIB65itOzY/l3mP5LVwu5mUzpHpCwuZ6dUl8sQ\"",
"serviceId": "00tyjcwt49hs5nq",
"serviceName": "play_for_work",
"privilegeName": "MANAGE_EXTERNALLY_HOSTED_APK_UPLOAD_IN_PLAY",
"isOuScopable": false
},
{
"kind": "admin#directory#privilege",
"etag": "\"JCPRxFaiNR1s5TJ6ecIH8OpGdY4efiOYXbIB65itOzY/0pXB8E7QTg03vLTGIizjP3RJ_KM\"",
"serviceId": "02w5ecyt3pkeyqi",
"privilegeName": "MANAGE_PLAY_FOR_WORK_STORE",
"isOuScopable": false
}
Where the second privilege doesn't contain a serviceName, just a serviceId.
What can we do with that serviceId? Is there a way to find the associated service using it?
I've inquired with some Google sources and it appears that they are aware that some serviceNames are not available, and there's no public list available. It may be confidential for some reason or they just prefer to keep it internal for now and they may or may not have plans for it in the future. Even the privileges.list API documentation mentions that the serviceId is an "obfuscated ID of the service", so we can at least tell that services and their IDs are important to them. This is a common practice.
The good thing is that, as far as I could tell, these service IDs and their names are only used in the privileges list API and they seem there mostly for descriptive purposes. The list also rarely changes so if you need to list them in your application you could assign them your own names if they are missing. You can use the privilegeName field as a guide, for example.
If you still have questions about it you can try to file a post in their issue tracker at the product feedback link at the bottom of the page.

How to limit Bing Search API V5 to search specific sections of the website

Using bing.com, I can do a search like this (click here for link):
history site:berkeley.edu/about/
When I try the same using the API, I get very different results. As far as I can tell, the search results returns webpages that are not hosted in berkeley.edu (see bottom).
this is the HTTP GET request being made to Azure
https://api.cognitive.microsoft.com/bing/v5.0/search?q=history+site:berkeley.edu/about/&count=10&offset=0
This is my HTTP GET code
$.ajax({
url: "https://api.cognitive.microsoft.com/bing/v5.0/search"
, data: { "q":encodeURI("history+site:berkeley.edu/about/"), "count":"10", "offset":"0" }
, beforeSend: function(xhrObj){
xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","supply-your-key-here");
}
, type: "GET",
})
Any ideas what I could be doing wrong? Thanks
edit1: Seems my "problem" is related to the way AJAX is making the HTTP request. If I supply my key by using a Firefox header plugin and type this (https://api.cognitive.microsoft.com/bing/v5.0/search?q=history+site:berkeley.edu/about/&count=10&offset=0) on my browser URL box, I get the correct response.
search results using API
Environmental Design Library | UC Berkeley Library: A branch of the UC Berkeley Library system, the Environmental Design Library supports the research and teaching of the College of Environmental Design.
Proceedings Template - WORD - ideals.illinois.edu: "(c) ACM, 2007. This is the authors’ version of the work. It is posted here by permission of ACM for your personal use. Not for redistribution.
Trends in metadata practices: A longitudinal study of ...: Trends in metadata practices: A longitudinal study of collection federation. ... A Longitudinal Study of Collection Federation Carole Palmer Oksana ...
http://aerospaceutility.tripod.com/ · GitHub: Clone via HTTPS Clone with Git or checkout with SVN using the repository's web address.
HS RWC Colorado Sample Instructional Units - LiveBinder: Loading Livebinder HS RWC Colorado Sample Instructional Units HS Read Write Communicate Sample Instructional Units provided by the Colorado Department of Education.
Arroyo High School: News Archive: News Archive SIA Awards "As the school year comes to a close, the Students in Action club would like to honor three students for their lasting impact on our ...
English 12 (exp) | Utah Electronic High School: Please be mindful of the fact that this course is not a credit "quick fix." It is a rigorous, college-preparatory class that is both time and labor intensive.
Working SMARTer, not Harder: SOCIAL STUDIES ONLINE ...: SOCIAL STUDIES ONLINE RESOURCES AND LINKS COMPILATION beta List of Social Studies online resources and links to professional development opportunities ...
The Big List -- 20121008 - Grolier: The Big List -- 20121008: 1: EA: http://www.stanford.edu/group/bipolar.clinic/ Stanford Bipolar Disorders Clinic: 2: EA: http://www.mhsource.com/bipolar/
Spreadsheet of Conference Attendees - studylib.net: ÐÏ à¡± á > þÿ ] þÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ...
You can use Bing custom search alternately to make sure you get results only from the domain/webpages you want. Here is the call: https://api.cognitive.microsoft.com/bingcustomsearch/v7.0/search. You will need a different accesskey though, which you can get from customsearch.ai.
I'm getting correct results on both v5.0 and v7.0.
There seems nothing wrong with your query.
https://api.cognitive.microsoft.com/bing/v5.0/search?q=history+site:berkeley.edu/about/&count=10&offset=0
Perhaps you are caching results somewhere in your browser?
Update: Since IE does it, but Firefox doesn't. Have you disabled cache on IE?

What is the proper schema for JSON-LD telephone number with extension?

I'm trying to find the proper schema for telephones with extensions, but I can't find anything related to this problem through Google searches or schema.org.
In HTML, I'm using , to trigger the extension on cellphones and Skype, but I've also seen p used to "pause" between numbers when dialing. Which is the best route in regards to proper JSON-LD schema?
No extension used:
{
"#type": "Organization",
"telephone": "+18665554985"
}
Style 1 using p:
{
"#type": "Organization",
"telephone": "+18665554985p100"
}
Style 2 using ,:
{
"#type": "Organization",
"telephone": "+18665554985,100"
}
The telephone property has Text as expected value. If a specific format should be used, it would be noted in the property’s description, but that’s not the case for telephone.¹
So you can use whichever format you want.
Which format would make sense? I would go with the same format you display for your users (which would ideally be the recommended format according to a convention/standard relevant for the targeted users). This is the natural choice when using Microdata or RDFa to mark it up, and there is no reason to go a different route for JSON-LD. This would also help in cases where a consumer simply displays your value of the telephone property: it will be in the appropriate format for your users.
¹ There was some discussion about this in the issue Make the telephone property more structured (not just Text). I would expect that the expected range will, at some point, include URL values, so that tel URIs can be used (which of course have a specified format).

Yahoo finance webservice API

I am trying to get realtime stock data from BSE and NSE using yahoo finance web-services. I was able to get some data using following URL
http://finance.yahoo.com/webservice/v1/symbols/COALINDIA.NS/quote?format=json
But it gives me very limited information.
{
"list": {
"meta": {
"type": "resource-list",
"start": 0,
"count": 1
},
"resources": [
{
"resource": {
"classname": "Quote",
"fields": {
"name": "COAL INDIA LTD",
"price": "367.649994",
"symbol": "COALINDIA.NS",
"ts": "1418895539",
"type": "equity",
"utctime": "2014-12-18T09:38:59+0000",
"volume": "2826975"
}
}
}
]
}
}
I need more information like yearly high, low, last traded price etc. and I couldn't find any documentation related to this from yahoo where it details how to get more information.
Is there documentation available related to these services? Or please suggest if there are any alternatives available.
I don't know where the definitive documentation might be but for your particular example try appending &view=detail to your URL.
http://finance.yahoo.com/webservice/v1/symbols/COALINDIA.NS/quote?format=json&view=detail
This will at least give you the year_high and year_low that you asked after.
Now, even though the following won't work for your COALINDIA.NS symbol (I suspect the exchange is not supported), it might be worth exploring the following two examples:
Example 1: As before, but for Apple and Yahoo symbols, with &view=detail appended:
http://finance.yahoo.com/webservice/v1/symbols/YHOO,AAPL/quote?format=json&view=detail
Example 2: And now using a completely different url, resulting in much more response data. One key caveat is this data is delayed by 15 minutes:
http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20IN%20(%22YHOO%22,%22AAPL%22)&format=json&env=http://datatables.org/alltables.env
If you discover the major differences between those two options and what impact they might have then please do let us all know; I'd be interested in finding out more.
If you are fine with getting NSE qoutes, you can use this package for the purpose, it is extremely easy to setup.
http://nsetools.readthedocs.org/en/latest/index.html
Since it uses NSE website/services as data source, the quotes will not be delayed (max few seconds).
Beware that these data are both delayed and inconsistent. You are not getting anything even remotely close to tick or real-time data.
From example 2, refresh a few times, and inspect the "LastTradeWithTime" key-value pair. I sometimes get different quotes from different times of day, for no apparent reason. They are sometimes delayed up to three hours.
You get what you pay for; in other words, this is not a free lunch.
For those who are curious about the different options available in the Yahoo Finance URLs, I think these links might help. If it's not what you're looking for, sorry.
http://internetbandaid.com/2009/03/31/yahoo-stocks-api/
https://ilmusaham.wordpress.com/tag/stock-yahoo-data/
Note: the wordpress site contains information that was taken from a site called gummy-stuff.org which is listed in full at the bottom of the above site (I can only list 2 urls in this post so I had to do the round-about way). Oddly, I found this site on my own yesterday. Funny how stuff comes back around. If you visit this site you'll just see a statement from Yahoo that the info he had originally listed (you're looking at some of this site on the above wordpress site) was never intended to be for public consumption and is a violation of Yahoo's terms and conditions agreement as it can apparently be used for hacking purposes. I was curious to see what was on the original post so I searched for it on the WayBack Machine. BTW, the links to the spread sheets are still active in the archive.
Cheers. Thom

Father's day coming up! - Can I get the profile of a Facebook user's father?

I'd like to get the Facebook profile ID of a Facebook user's father.
Basically I want to display a picture of the user's father and say 'how about buying an X for Dad'.
Is this possible with the graph (or REST) API ?
Edit: It looks like this needs to be an FQL query and can't be done directly with the other APIs. I'm still trying to figure out how to do this, and looking for the correct JOIN format to get the information. I'll post it if I figure it out.
Thanks for the interest in the question everyone. Been fun reading everyones comments coming in. Would appreciate a little more constructive criticism though - as opposed to rampant downvoting. If you think people will be disenfranchised by this I'd be interested to hear reasons why. As a friendly reminder of an upcoming event I see nothin wrong with this approach. I'm respectfully considering different wording if a father cannot be found - in case they are deceased. If i was asking 'how do i write to someones stream that that X is buying Y a Z for father's day' it would be one thing - but I thought this was a pretty trivial 'privacy' issue. But then again maybe some of you disagree... Thanks for reading...
Clearly this is a very touchy subject for developers considering all the downvotes. I personally hate Facebook, but this is a completely valid question. It's definitely possible with standard FQL queries. Just write queries for the "family" table:
http://developers.facebook.com/docs/reference/fql/family
This table should have a field called "relationship" which defines what the user's relationship is to that person (parent, mother, father, sibling, sister, brother, child, son, daughter). Graph API is still quite new and doesn't seem to have anything specifically for that yet.
Edit
Meet my family:
SELECT uid, relationship from family where profile_id=xxxxxx
[
{
"relationship": "brother",
"uid": "xxxxxx"
},
{
"relationship": "father",
"uid": "xxxxxx"
},
{
"relationship": "mother",
"uid": "xxxxxx"
}
]
You can test it on the new API docs here.