How to get the url of the image i just posted on twitter? - objective-c

I am working on app where i need to post some text with Image to the twitter so with the nes ios twitter API's it's pretty simple and straight forward but now i want to send the url of the image posted in an email. But i can't figure out how to get the url of the image which is showing on twitter.
Thanks,

It seems that the new framework doesn't return the response data after posting the tweet with media. Probably you have to use the TWRequest to fetch the newest user_timeline and get the link inside the response data.
But if you use other framework to post tweet with image, you can get the link from the response data when the upload is success
https://dev.twitter.com/docs/api/1/post/statuses/update_with_media

Related

youtube's api for app use

Can anyone guide me on how to get youtube's API's to play songs inside the app ?
I need to implement a view with UISearchBar where the user searches for any video on youtube (channel etc .. ) and the results are filtered in a UITableView with the thumbnail, title, and description.
The user gets to choose a video and this video gets opened in another view.
I just need the search because i've been searching for a week and i can't find any result.
PLEASE help.
Thanks.
Youtube api has a good tutorial page for their iOS helper library that you can find here.
In order to retrieve youtube videos using a search string, you'll need to use the youtube api.
You might have to make a get request to
GET https://www.googleapis.com/youtube/v3/search
The required parameters include
part -The part parameter specifies a comma-separated list of one or
more search resource properties that the API response will include.
Set the parameter value to snippet.
You may want to add the search string parameter as well (q), if you are searching for a particular string .
For example a query looks like:
GET https://www.googleapis.com/youtube/v3/search?part=id&q=hello&key={YOUR_API_KEY}
and you get the JSON response containing the youtube ids for the videos matching the search string provided.You can see the details here.
This youtube id can then be used to play the video in a Web View according to the iOS helper library.
[self.playerView loadWithVideoId:#"M7lc1UVf-VE"];

Google Custom Search API Search Image by Image URL

I am working on an application which will have an option for users to upload images. Once uploaded, the application will show other images from the web which look exactly similar, whether or not of the same size.
For this, I will create a temporary URL for the image so that I could provide Google custom search API the URL of the image. I would expect in response, URL's of images that are exactly the same or similar to it, perhaps in JSON format.
I did find a similar question posted in January. Till then Google did not support anything like this, apparently:
Google Javascript Custom Search API: Search images by image url
One can also simply do:
http://images.google.com/searchbyimage?site=search&image_url={Image URL}
Since that is not part of an official API, it may not be right to use this method.
Can someone help me?
Well, the answer quite simply is TinEye Commercial API https://api.tineye.com/welcome. I was looking in the wrong place I guess, I did not have any luck with Google Custom Search API.
Would you need a simple result?
If you are, you can use Vision API of Google.
This is very simple.
https://cloud.google.com/vision/
You can try on the top.
First, access the URL.
Second, upload your image file on the "Try API"
Third, click "JSON" tab menu on the result.
You can be seen JSON about similar images.

Does Google Contacts API Support High Resolution Pictures?

Google recently added high resolution support (720x720) for contacts' images via the gmail interface. Previously, it would to convert all images to 96x96. However, when I post an image using the Contacts API it still gets converted to 96x96. I currently use the picture url in the link ref http://schemas.google.com/contacts/2008/rel#photo. Is there a way to post higher resolution images or are we still stuck at 96x96 if we use the Contacts API? Is there another programmatic way to accomplish this?
Thanks!
I'm assuming that you are using the Google+ API to retrieve their profile and are looking at the profile image, as seen here using the API explorer:
https://developers.google.com/apis-explorer/#search/profile/m/plus/v1/plus.people.get?userId=107345380056943591322&_h=1&
In the response is an image URL:
"image": {
"url": "https://lh3.googleusercontent.com/-2N7UIsa-tLI/AAAAAAAAAAI/AAAAAAAAAK8/XJiZoMReZr0/photo.jpg?sz=50"
},
You can alter the sz parameter to indicate the width/height of the rendered image, for example:
https://lh3.googleusercontent.com/-2N7UIsa-tLI/AAAAAAAAAAI/AAAAAAAAAK8/XJiZoMReZr0/photo.jpg?sz=500
There are other url formats, it's not clear which url you are getting but if you paste an example, I'd be happy to help.

Get current url of a webView and put it in a tweet

I'm developing an app for iOS that use the new Twitter framework.
I have a webView, how can I know the current url? And how can I use for create a Tweet?
Sorry for my bad English and thanks!
First you should read the documentation .
Look for the Instance method stringByEvaluatingJavaScriptFromString: ( - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script )
example of use is :
NSString *webViewURLString =[yourWebView stringByEvaluatingJavaScriptFromString:#"window.location.href"];
The parameter/script 'window.location.href' is a javascript call.
This method will give the url as a string that you can then most likely pass on to your twitter code.
You can retrieve the current URL from the web view as follows: webView.request.URL
To allow the user to post to Twitter, you can display a TWTweetComposeViewController which has an addURL: method. To send without user interaction you need to create a TWRequest with the relevant data (refer to Twitter's API docs for the correct HTTP requests).

need help to get Facebook profile picture. Also is GRAPH Api online test site down?

I followed the instructions from github.com/facebook/facebook-ios-sdk
and can get Facebook login dialog and get connected. It's for ipad application to get FB info. user name, friend list can be fetched correctly.
I tried to get the profile picture
[_facebook requestWithGraphPath:#"me/picture" andDelegate:self];
and received response:There was a problem communicating with server...
but similar calls like
[_facebook requestWithGraphPath:#"me/posts" andDelegate:self];
[_facebook requestWithGraphPath:#"me/friends" andDelegate:self];
work just fine.
also tried the facebook graph API online test site:
https://developers.facebook.com/tools/explorer/
to use it, first get access token, then tried to get posts, friends, and they are fine.
but when to get picture will take forever, and never return anything.
I did log into my facebook account in a web browser and the profile picture appears just fine.
The Graph API for the user endpoint is described here:
http://developers.facebook.com/docs/reference/api/user/
About the picture connection, it says:
HTTP 302 redirect to URL of the user's profile picture (use ?type=square | small | normal | large to request a different photo).
So what you get is not the typical JSON response, but the picture itself (via the HTTP redirect). You can try that by entering the graph API call into your browser location bar. For example, to see the profile pic of Mark Zuckerberg, try:
http://graph.facebook.com/markzuckerberg/picture