Picasa web albums - impossible to list all photos - gdata

I've uploaded about 40k photos using the Google Photos uploader tool, and now I'm trying to get a list of those photos using the Picasa Web Albums Data API (as there is no separate Google Photos API that I'm aware of).
So far, it appears impossible to get a complete list of all of the photos because you can list only 1000 photos at a time and then use the start-index parameter to do paging, but the server returns an error once you use a start-index above 11000. With a start-index of 11000 this occurs:
gdata.photos.service.GooglePhotosException: (500, 'Internal Server Error', 'Deprecated offset is too large for a stream ID query. Please switch to using resume tokens.')
(I'm using Python, but have confirmed that the error is independent of the language library)
I'd be happy to switch to using "resume tokens" like the error indicates... except that they are not mentioned in any documentation that I could find.
This is an authenticated request and the URL I'm using looks like this:
https://picasaweb.google.com/data/feed/api/user/[myUserID]/albumid/[myAlbumID]?kind=photo&max-results=1000&start-index=11000
Can anyone show me an example request using resume tokens or point me to documentation on them? Or, if anyone knows of some other way to get a complete list of all of the photos in a large album, that'd be great too. Thanks!
EDIT: the problem happens in any language, but in Python you can reproduce it consistently with:
startIndex = 1
while 1:
print '(fetching more photos)'
photos = client.GetFeed(ALBUM_URL, limit=1000, start_index=startIndex)
for photo in photos.entry:
print 'startIndex:', startIndex
startIndex += 1
where ALBUM_URL is like the URL I listed above and client is an authenticated instance of gdata.photos.service.PhotosService.

Related

Facebook Insights API Conversions are NOT matching Facebook Ads manager Results

When trying to fetch Facebook insights API for the following action offsite_conversion.fb_pixel_purchase I always get less number than Facebook show on their ad manager, I tried to inspect their network calls and URL structure and I see they're using the same field offsite_conversion.fb_pixel_purchase to show Results I am not sure why the numbers are mis-matching. I tried to query from the Graph API and from my shell with the same results.
You may check use_account_attribution_setting and use_unified_attribution_setting in here: https://developers.facebook.com/docs/marketing-api/reference/ad-campaign-group/insights
Setting use_unified_attribution_setting to true worked for me.
I did some testing and found out that if you use an additional breakdown, FB will return less conversions. There might be a bug in their API when you use breakdowns.
I tried getting offsite_conversion.fb_pixel_purchase with
'breakdowns' => 'hourly_stats_aggregated_by_advertiser_time_zone',
and facebook retuned 5 conversions.
if I remove the breakdown and get the data grouped daily I get 11 conversions which is what Facebook Ads Manager shows

How to get live video id from YouTube channel

YouTube API eventType=live not working, does anyone have an idea why?
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCmyKnNRH0wH-r8I-ceP-dsg&eventType=live&type=video&key=
Without eventType was working fine (but not now):
https://www.youtube.com/embed/live_stream?channel=UCmyKnNRH0wH-r8I-ceP-dsg&autoplay=1
Looks like YouTube changed something in API, search.list really not returning live broadcast since end of last week.
If you have user's access token you can use https://www.googleapis.com/youtube/v3/liveBroadcasts?part=snippet&broadcastStatus=active&broadcastType=all
endpoint to retrieve if any broadcast is live.
If you do not have user's access token, you can try this answer
but i didn't check it if it is working
Anyway this question looks like to be a duplicate of this question
Right now the YouTube API is not working, specifically for retrieving live streams of a specific channelId. In other words if you are setting channelId in the API call, you will get 0 results.
If you're using an API key rather than OAuth (not sure if OAuth works) the only work around at the moment is to use the API to search for a specific title. Here is my query URL below.
https://www.googleapis.com/youtube/v3/search?part=id%2Csnippet&type=video&maxResults=20&order=date&q=My+Uniquely+Titled+Livestream&key=[apiKey]
The results returned by the API will be from all of YouTube. (Note: the rest is done serverside) Put the results into an array and discard any that don't match your channelId. Then check the titles in an array and only get the video ID of the one that matches your desired title. That is the basic logic and it is sort of a rigid work around that won't work for most. But at least it will get you what you need until Google fixes the API.

Using Google Places Web API to search for business and using results to make a phone call

I'm working on a project, and I'm completely stuck.
I get the user's location using CLLocation and am able to get the place name using CLGeocoder, and using this I've constructed a URL to search the Google Places Web API.
My question is, how can I actually complete the search and return the top place result's phone number? Any help would be much appreciated!
let url: URL = URL(fileURLWithPath: "https://maps.googleapis.com/maps/api/place/textsearch/json?query=taxi+" + placeMark.locality!+"&key=" + self.GAPIKEY)
This is the URL I've come up in case that helps
The first thing you need to do is an HTTP GET on the URL to get the API results. Consult the following SO question for various ways to do that:
How to make an HTTP request in Swift?
The data returned will be a JSON document in the format described in the Google Places API Docs. Look for the formatted_phone_number and/or international_phone_number fields. See Working with JSON in Swift for how to parse the JSON string.

How to get facebook share, like, comment count for a url with graph api only (in a non-deprecated way)

The problem is that after v2.1 of graph api fql will be deprecated.
Can someone tell me how to get separate likes, share count for given url using only graph api? I was looking for some documentation, but there isn't any, i can get only total "shares" which is likes + shares + comments.
Yes i know there is immortal http://api.facebook.com/restserver.php?method=links.getStats&urls, but what if facebook shuts it down at last?
The REST API (with calls like http://api.facebook.com/restserver.php?method=links.getStats&urls) was announced as deprecated with the introduction of the Graph API v2.1: https://developers.facebook.com/docs/apps/changelog#v2_1_deprecations but also already in 2011: https://developers.facebook.com/blog/post/616/
So, from my understanding, this will yield in the inoperability of this feature at two years after the introduction of v2.1 on 7th August 2016:
https://developers.facebook.com/docs/apps/versions#howlong
The closest you can get to the "old" REST of FQL API call results with the Graph API is this afaik:
https://developers.facebook.com/docs/graph-api/reference/v2.3/url/
but it omits the like_count metric (don't ask me why...).
My personal opinion is that you should continue to use the FQL calls to the link_stat (https://developers.facebook.com/docs/reference/fql/link_stat/) table, because this will be available for nearly the next 2 years. This is only possible if you have a v2.0 app. Maybe there'll be some additional endpoints for the Graph API until then.
I suggest using a tool like SharedCount, it offers a lot more platforms too. Here is how they get the data: http://www.sharedcount.com/documentation.php (Scroll down to "Sources")
So for Facebook it would be like this:
https://api.facebook.com/method/links.getStats?urls=%%URL%%&format=json
You get a JSON object like this one:
..."share_count":66,"like_count":15,"comment_count":1,"total_count":82...
Edit: This is deprecated now, but there is another possibility, explained in this thread: Get FB likes, shares and comments for a URL using PHP - with no limit
You can use facebook graph api like https://graph.facebook.com/?ids=http://mycodingtricks.com and it will return a json code like
{
"http://mycodingtricks.com":{
"id":"http://mycodingtricks.com",
"shares":1
}
}
I have developed my own php script on which you can all social count using that api.
http://mycodingtricks.com/share/social.php?url=YOUR-URL-HERE and it will return data like:
{
"facebook":[
{
"share_count":1,
"like_count":0,
"comment_count":0,
"total_count":1,
"click_count":0,
"comments_fbid":567687199998199,
"commentsbox_count":0
}
],
"googleplus":10,
"twitter":3,
"buffer":0,
"pinterest":0,
"stumblupon":1,
"reddit":"<html><body><h1>403 Forbidden<\/h1>\nRequest forbidden by administrative rules.\n<\/body><\/html>\n",
"linkedin":0
}
But if you wants to use on your own Here is a complete article about how to count facebook share,like and all.
http://mycodingtricks.com/php/2-ways-to-count-facebook-likes-shares-and-comments-using-php/
actually the correct way for getting the like number is this:
http://graph.facebook.com/v2.5/?id=YOUR_URL&fields=og_object{engagement}
the brackets after the og_object is the second level of og_object.
see documentation here:
https://developers.facebook.com/docs/graph-api/reference/url
you might need to encode the url and brackets so it will look something like:
https://graph.facebook.com/v2.5/?id=ENCODED_URL&fields=og_object%7Bengagement%7D&id=http%3A%2F%2Fwww.cnn.com
see a working example in
graph explorer (hit the submit button)
All answers are wrong or incomplete since latest shut down of API 2.1!
I am the author of the social media plugin MashShare and i recently had to do exact observations for this issue as it seriously affected the share count of our plugin.
Verified data by observations:
https://graph.facebook.com/v2.7/?id=https://www.mashshare.net contains shares and likes.
As far as i found out the only way to get a number near the real share count of a post is to get first the likes of a url. Than take this number and subtract it from the total number of shares and likes.
To get the like count you need to take the object id of the url and create another API request:
https://graph.facebook.com/v2.7/14206851986099/likes?summary=true
If you know how to merge both requests into one please let me know.
As of August 19th 2016 facebook completely shutdown their rest API.
The only alternative is to use the graph API as suggested above.

What are the "base URLs" for status, photos, etc?

I developed an app that looks for specific terms using the facebook api (search).
Every result comes with an ID for the item that can be of many types like "status","photos",etc.
I remember that some time ago I could surf facebook and get this URLs from the browser address bar, but now with some updates that facebook has made it seems to be all AJAX based calls and it seems like you do not have a "specific page" for each item.
I looked over the web and could not find anything regarding this.
Is there any way I can get a "photo id" from the API and open it like "http://facebook.com/photos/0293820293842"?
Thanks for any clue.
https://graph.facebook.com/{id}/picture
https://graph.facebook.com/40796308305/picture (by page id)
https://graph.facebook.com/cocacola/picture (by page's name)
https://graph.facebook.com/4/picture (by user id)
https://graph.facebook.com/4/zuck (by user name)
after some time I just gave up trying to get the picture from the data provided by the search API.
From the api I get entries of type "photo" but they do not match with the API documentation found at http://developers.facebook.com/docs/reference/api/photo/ since I do not receive the fields "picture", "source" or "images" (they just does not exist in the results from a search)
Looking to find a way to use the approach of "setting up the URL from the fields received from the API" I could not get any sucess either.
That's one case... I set up a search for "pepsi"... and within the results I got a "photo" object.
In this object I have the following fields:
id: 100002307882828_188072634633218
author\id: 100002307882828
link : "http://www.facebook.com/photo.php?fbid=320417371337648&set=a.133681116677942.17717.131381520241235&type=1" (this link really points to the photo's page, but is not the photo itself)
object_id: 320417371337648
I used the URL you provided as a "base" and tried to setup some combination that returns me a photo but I always get "Content not found" as result.
The only way I could find the final photo URL is to make another call to the API using the Photo Id as parameter (but I would need to do a lot of calls to the API and this just do not fit my scenario)
If I call https://graph.facebook.com/320417371337648 I get everything I need from the photo, but this is the "another call" I would need to perform for each result I get.
Thanks a lot for your help,
Regards,
Victor Reboucas