Basic: How to get a photo's PID? - fbml

Newbie question:
On this page:
http://www.facebook.com/KCCFullThrottle?sk=app_139518349451248
I would like to post this photo:
http://www.facebook.com/media/set/?set=a.163774783731433.32229.162385797203665&type=3
According to the Facebook page for fb:photo
All I need to do is add this FBML:
<fb:photo pid="12345" />
But, can I / where do I find the PID for a photo without writing API calls? (Multiple searches, no luck.)
<b>

The photo pid is only available in the graph API, whether you use the graph objects or query the FQL objects. FBML is being deprecated, so please don't use that.

Related

How to search for locations using Tags inside OpenStreetMap

Using the Nominatim APIs, am able to do a search based on a query. However, all the results returned have a Tag associated with them, like leisure=fitness_centre.
How can I, thus, use the OpenStreetMap APIs to search a given location (say London) for all the fitness_centre tags? Idea is to be able to search the map, zero in a location (say London, Oxford etc.) and then search for all places/locations with Tag [leisure=fitness_centre]
Using Google Places API, one can search using tags using something like below (specifying type=gym) -
https://maps.googleapis.com/maps/api/place/search/json?location=51.509865,-0.118092&radius=50000&sensor=true&key=&types=gym
Only issue with the Google Places API is that they are extremely pricey!!, so looking for OpenStreetMap as an alternative.
For searching specific objects in OSM, Overpass API is usually a good choice.
There is a nice frontend available called overpass turbo. Open the wizard, enter "leisure=fitness_centre in London" and it will generate an appropriate query:
[out:json][timeout:25];
{{geocodeArea:London}}->.searchArea;
(
node["leisure"="fitness_centre"](area.searchArea);
way["leisure"="fitness_centre"](area.searchArea);
relation["leisure"="fitness_centre"](area.searchArea);
);
out body;
>;
out skel qt;
Then hit run to see the results on the map: https://overpass-turbo.eu/s/1fbg
Please note that the {{geocodeArea:London}}->.searchArea; part is a feature added by the overpass turbo frontend. Overpass API won't understand this geocoding request. Instead, you have to replace it with an area query and the corresponding relation ID (in this case area(id:3600065606)->.searchArea;).
Another thing to note is that Overpass API servers shouldn't be used for heavy queries or commercial purposes. If you need this kind of service then install your own Overpass API instance or use a commercial Overpass API provider.

Google API for the Search Result Events

I'm looking for the correct API for the events that show up in a regular Google Search, the ones that are structured (with name, datetime, location)
Any help or guidance is appreciated
I have tried the Custom Search with no luck, and also the Calendar API (which seems to require a calendar ID, more so for personal calendars or targeted public ones)
We've actually just made an API to scrape the Google event results. You can query it directly like this:
https://serpapi.com/search.json?engine=google_events&q=Events+in+Austin
Or if you are using Ruby, you can do something like this:
require 'google_search_results'
params = {
engine: "google_events",
q: "Events in Austin",
}
client = GoogleSearchResults.new(params)
events_results = client.get_hash[:events_results]
Some documentation: https://serpapi.com/google-events-api
I had a quick look - while I didn't find a fully programatic API yet, here are two things that can get you started on more:
How to search the events page directly: use the following URL schema: https://www.google.com/search?q=cool+conferences&oq=cool+conferences&ibp=htl;events&rciv=evn - replacing "cool+conferences" with any string you like - this can let you create dynamic URLs for event searches.
How to access event metadata for a given page - google is pushing a standard to structure data on webpages to support "smart" searches such as for events. They are using a data structure called JSON-ld. More details. If you want to read such metadata from a webpage, here is one scraper I have found that does that - extruct (though I didn't get a change to test it yet).
Hope this helps :)

Is there a way to find all the relations that exists between two entities?

I need to populate an ontology in the domain of Music Artists. To get an understanding of the domain which I should populate, I need to find out,
1) All the possible objects related to the particular artist. (Song, Album, Movie etc.)
2) All the possible relations between this celebrity and the object. (Singer Object).
Is there any way to do this manually or through Google API?(I tried this manually by giving this on the google search bar. But it is a hard task to do it manually. Though if there is a way to speed this up, it would be sufficient at the moment.)
What you need is a way to query the web which will combine results from various websites and web pages and present a combined and coherent result to you based on your query. Currently this cannot be done for the web in general. However, the semantic web is an area of research that is trying to achieve exactly that.
Using semantic web technology it is possible to do such queries for parts of the web. DBpedia is a prominent semantic web project that aims to enable arbitrary queries across Wikipedia. DBPedia provides a live end-point that you can query using SPARQL. Referring to DBpedia will give you a brief overview of how this all fits together.
Accessing the live end-point you can run the following SPARQL-query that will give a list of musicians. Clicking on the links in the result page will provide you with more information on each musician.
SELECT ?subject
WHERE {
?subject a dbo:MusicalArtist .
}
Good luck!
Found a method to retrieve entities related to a particular object through google knowledge graph API.
Google Knowledge Graph API

Load the creative information with the adgroup not just the creative id

I am trying to figure out if anyone has a better way to load facebook adgroups with the creative information. So far the only way I have been able to find is, load all the adgroups using the api point here: /act_{account_id}/adgroups
I pass the fields 'creative' to get the id, then I have to load all the creatives and pull the data i want.
I can not seem to find a way to filter the creatives to only return the ones I want. Returns all the creatives that ever existed in the account. Seeing that some accounts have 25k+ creatives this is an issue.
The creative endpoint is: '/act_{account_id}/adcreatives/'
https://developers.facebook.com/docs/marketing-api/adcreative/v2.3
Ideally, it would be amazing if there was a way to just load the creative information directly from the adgroup listing.
I am just looking for a few fields in the adcreative url_tags and object_story_spec
You can use nested request for that. In your case the URL would look like this
/v2.3/<adgroup_id>?fields=creative{url_tags,object_story_spec}

How to get yammer Likes count from embed

The documentation doesn't show how its possible to get the number of likes Yammer embed like you get with Facebook.
Is this possible in #yammer?
I'm using this embed script: https://developer.yammer.com/connect/#action-buttons
It's been a couple months so it could have changed, but the likes for the OG objects are not contained within the object but rather in the user's profile. So you can't see the number of likes on an OG object.
To get this functionality, I ended up using the like/unlike API and on success, I update a database with the like count for the specific OG object. Then on page load, I query the DB and get the like count.

Resources