I has filename from meta info and I wanna download this one. I checked documentation and I didn't find how it does. Does it possible?
Related
I am trying to work with the Vimeo API and I cannot figure out how to access the ondemand data.
The endpoint and parameters in the docs require an ondemand_id to work correctly. I assumed this ID would come from any official ondemand page within Vimeo. But whenever I search the ondemand pages of Vimeo and click on a resource, the URL does not contain any numerical ID.
It only contains the root path for the Vimeo website with /ondemand_page_name at the end. This value cannot be the ID since it is a string and not a number. I have looked through the entire page plenty of different times to try to find the ID but cannot seem to find it.
For example, when you visit a normal video page on Vimeo, the URL looks something like this:
https://vimeo.com/272976101
where the number 272976101 is the video_id that can be used within the API to get all the data about this particular video. Instead of this format, the ondemand pages have the format:
https://vimeo.com/ondemand/nebula
where there is no numerical ID within the URL. This is the issue I am having. How would I retrieve the public data about this ondemand page throught the API.
I feel like there may be a very simple solution/explanation to this issue and any help would be much appreciated.
Also, right now I am not using any SDK to access this data. I am strictly trying to figure out how the API works through the built-in client provided within the documentation.
It's undocumented, but you can use the On Demand custom url path as the ondemand_id.
So for your On Demand video at https://vimeo.com/ondemand/nebula, you can make an API request to this path: https://api.vimeo.com/ondemand/pages/nebula.
In the response, you'll see the "uri" value "/ondemand/pages/203314", which you can log on your end and use as the ondemand_id instead of /nebula.
Also note, this should be the same URL as your On Demand settings page: https://vimeo.com/ondemand/203314/settings
I hope this information helps!
I'm using Java for searching public page info in Facebook.
I chose for now to use the Facebook4J but this is not a must.
I succeeded to search for pages named "Some Name" and I would like to read the is_verified property of the page to make sure this is the official page I'm looking for and not a faked one.
There is no isVerified() method on Page object and I do not how to run a FQL query using the search API.
This FQL runs well in Facebook simulator:
select page_id, name, is_verified, is_community_page
from page
where name='Tom Cruise' and is_verified=1
The Java code I'm having right now is this:
ResponseList<Page> pages = facebook.searchPages(personName);
I tried copy-paste the FQL into the search as parameter, as the method signature is
ResponseList<Page> searchPages(String query) throws FacebookException;
but I get no results...
I also cannot loop on all 'Tom Cruise' pages and ask whether they are verified or not because, as I mentioned before, there is no 'isVerified()' method on Page.
I'll appreciate any Java solution, even if it means that I should drop Facebook4J for another platform.
The is_verfied page field is added with RestFB version 1.10.0.
USING: Windows7, Python 2.7, Google App Engine
Google's documentation for inserting(creating) a file to Google Drive using Python and the Drive API. Here is the link showing the code near the bottom of the page:
Write a file to a Google Drive using Python
A function named: insert_file is defined in the Python module.
def insert_file(service, title, description, parent_id, mime_type, filename):
The insert_file function takes 6 arguments passed into it. The first arg is service.
In the comment section of the example code, it is indicated that the service arg takes the Drive API service instance as the input.
Args:
service: Drive API service instance.
title: Title of the file to insert, including the extension.
description: Description of the file to insert.
parent_id: Parent folders ID.
mime_type: MIME type of the file to insert.
filename: Filename of the file to insert.
What is the Drive API service instance? I have no idea what that is or what the valid settings are. Is it the authorization scope that is expressed as a URL? I do know what the title and description are. The title is the new name of the file being written, and the description is a detail, presumably put into the files metadata. I'm not sure how to get the parent_id or the Parent folder either. How is that info obtained? Do I get that manually from Google Drive? I know what the MIME type setting is.
If someone could give an explanation of what the Drive API service instance is, and give an example, that would be great. I did a search for Drive API service instance, and couldn't find an explanation. I searched the internet. I searched Google Developers. I found nothing.
Quickstart provides more boilerplate and a full working walk-through.
http = httplib2.Http()
http = credentials.authorize(http)
service = build('drive', 'v2', http=http)
The service is the API service that you want to instantiate. There are lots of services. An app can communicate with Google Maps, or Google tasks, or email, or Drive.
Google API's for Python
So, the service is the API service. Build instantiates the API service. This is from the video, minute 12:46.
YouTube example for Google Drive API Service
I found something about Parent Folders in the documentation.
Google Drive API
The Google Drive API has a files:insert API. The files:insert API makes a request with various parameters. There is, what is called, the Request body which has it's own parameters. One of the parameters for the Request Body is parents[]. It is an optional parameter. For insert, if the parents[] parameter is blank, the file gets created in the users root directory. So, I guess if you want the file to be written to a particular folder, you need to give the parents[] parameter a name. I'm assuming that is what the parent_id arg in the insert_file function is for, but I'm not sure. I need to look at the actual function, but that's not given.
After doing searches on Parent ID it looks like that is the folder ID. When you go to your Google Drive, and click on a folder, the URL in the browsers address field changes. Just click on the folder and the URL will look something like this:
https://drive.google.com/?tab=wo&authuser=0#folders/0B52YKjuEE44yUVZfdDNzNnR3SFE
The parentID is the long part on the end after the forward slash.
I guess I need to look at the Google Quickstart files again.
There are at least three examples that I've found:
Quickstart example. Google Drive SDK
Dr Edit. Google Drive SDK examples
Another Quickstart example Google Drive API
The first one is the simpliest. Dr Edit has the most files maybe? The last one looks like its more current? I don't know. It's kind of confusing about which example to use. The Drive SDK and the Drive API examples only deal with authorization of an account for some outside app to access a users account.
Can we search public photos & videos from facebook by tags as input perameter as we do in flickr using the tags we search photos and flickr API returns list of photos.
Any help or suggestion would be greatly appriciated.
Thanks
Gaurav
last time I checked, photos uploaded to Facebook do not have tags. Therefore, it isn't possible to return photos that match a tag. What you could do, is search for groups or apps on Facebook and then retrieve the public photos there.
The search URL format is https://graph.facebook.com/search?q=watermelon&type=post&access_token=AAAAAAITEghMBAHwKSuFoX7OpcyCezYGO1JkVzBaQq6fBdXoHPayxZCxta4EZC0fYSLPjO16Yf9FKOAkhOHrU2ROZCZB9fcbLsDtPFgy67dK5TXOeYJqG, where q is your query. More info can be found here. https://developers.facebook.com/docs/reference/api/
Here is an app that allows you to search facebook photos!
The below api query will return everything that has that object_id tagged.
https://graph.facebook.com/[object_id]/tagged
An example of this would be looking for everything tagging Heat Ultra Lounge (a project I'm working on). To get the objects tagged with this tag, I would use the below get address and include &access_token=[my or my app's access token]. Like so:
https://graph.facebook.com/118613151504271/tagged?access_token=[youraccesstoken]
I am looking for a list of countries/states/cities that can be used with Facebook Graph API when publishing targeted posts.
I found one JSON file available on this page but the file doesn't parse correctly and I also doubt whether it can be used for post targeting since the file is for advertisements.
Also, I am not sure whether the third party data like the one provided by MaxMind can be used directly with Facebook API.
Does anyone have such a list or can atleast point me to a right direction?
The answer is here: https://developers.facebook.com/docs/reference/ads-api/get-autocomplete-data/
To check what countries are available you could just get a response from this endpoint:
URL:
https://graph.facebook.com/API_VERSION/search?type=adgeolocation&location_types=['country']
HTTP_METHOD: GET
You also have to set your access token in the URL.
To just see the fields key and name and a larger quantity of countries without being paginated this would be the complete URL:
https://graph.facebook.com/API_VERSION/search?type=adgeolocation&location_types=['country']&fields=key,name&limit=1000
For countries: search?type=adgeolocation&location_types=['countries']&limit=1000
For regions: search?type=adgeolocation&location_types=['region']&limit=1000&country_code=PT
Hope that helps :)
Well, for countries you could always check the Facebook Internationalization Document.
The file Facebook publishes seems valid for city/state/country lookups. It provides the graph id you will need. And it seems to parse as valid json for me.
Ok. I was able to use the same JSON file I mentioned in my question. As I said in my response to #offbysome, previously I had saved the file by opening it in Google Chrome. But then I used Firefox and used the Right Click => Save File As option to save the file on disk. This file is actually a tar gz (which facebook wrongly names as .php file). After unzipping the file, I was able to use the same code posted in my comment to get the PHP array which I then imported to MySQL.