Get JSON version of a google image search page - ios

I was watching this tutorial on using AFNetworking in iOS, and the guy instructed us to use a link to a twitter page that was displayed in JSON format. Now, I'm wondering how easy it is to get JSON from a given web page. Say, for example, this google image search for "beautiful fish".
I want to get all the images from this page using the AFNetworking framework, which would be a lot easier if I could have a JSON version of the page, but how do I get that?
After following the answer below, it appears that any image search can have its results displayed in JSON format, using this format:
https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=YOUR%20SEARCH
Example:
https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=beautiful%20fish
More info here:
https://developers.google.com/image-search/v1/jsondevguide

Take a look here: https://developers.google.com/custom-search/json-api/v1/overview
You'll get results in JSON if you use that APi

Related

Get JSON data from a specific URL in swift

What Im trying to do is get the data from this specific url https://www.globalmoneyworld.com/global-media-blog
Once I get the JSON data, Im positive I know how to use it. Ive made several apps in class that touch on this, one was a weather app, the other pulled blog posts from the guardian. The guardian app was more of what I waned to learn than the weather app.
The problem Im running into is that I cannot figure out how to ask for the data. How to get this type of response
http://jsonplaceholder.typicode.com/users/1
this is the link I want to get the data from again
https://www.globalmoneyworld.com/global-media-blog
What kind of request do I need to type in using Alamofire to get JSON data from that specific url? And please guide me in the right direction if Im not asking the right question.
The website you linked returns HTML data, not JSON.
There is no type of request you can make using Alamofire that will give you JSON from an arbitrary URL. The only URLs that return JSON are from sites that allow queries that return JSON. The good news is that JSON is widely supported as a data exchange protocol.

Twitter API, get Tweet as Image

I understand you can get the specific url of a tweet using the Twitter API by creating a url like this
https://twitter.com/username/status/tweet-id
However, is it possible to get an image of a tweet?
I can get media images, but those are just images that people posted in the tweet. I want to know if it is possible to get an image of the tweet itself.
Twitter's API includes the ability to do this with oembed.
https://dev.twitter.com/rest/reference/get/statuses/oembed
See https://opensourcelibs.com/lib/tweets-as-an-image
This project provides an API for downloading tweets as images: https://tweets-as-an-image.herokuapp.com/tweet?twitterHandle={your_twitter_handle}&id={your_tweet_id}&theme={light_or_dark}&maxwidth={max_width_of_your_tweet_image}&height={height_of_the_image}&lang={language}
Fast forward to 2023 - none of the one above seems to be available anymore.
This library worked flawlessly for me. It is not an web API but works well and has good options:
https://github.com/Xacnio/tweetcapture
You can now get images or screenshots of tweets using the #aissistant handle on twitter.
Retweet any tweet with the comment "#aissistant #image" to get an image.
Retweet any tweet with the comment "#aissistant #screenshot" to get a screenshot.
For other options like converting to memes and jokes check out the handle.
Full disclosure: I am creator of the bot behind the handle.

Change tiny urls to expanded url inside tweet

I am getting Twitter tweets in my website using v1.1 user timeline API, but the problem is the URLs tweeted are displaying in short form like t.co... format.
Now I want to display expanded URL instead of tiny URLs, so how can I can do this? Please give me a solution.
Note: I referred Simplest PHP example for retrieving user_timeline with Twitter API version 1.1, this questions in stackoverflow for getting tweets.

How to add Twitter Expanded Tweets? (was: twitter media preview card for my site?)

I googled a lot about how to make twitter media preview for my website entities if they are linked in a tweet like images below:
Any idea where can I find some documentation about it? Or a tutorial? Is this possible or these media/site previews are hardcoded in twitter?
EDIT:
so, what I need:
If someone links my site on twitter, my widget appear under the tweet, like below:
UPDATE 2012-06-13
It appears this is an Expanded Tweet - -what the requirements are to integrate these expansions into Twitter are do not appear to be displayed - but this sure is interesting.
Nope your in luck. They're not hardcoded into Twitter, they're available in the JSON response. You actually have in your post the word you need to google for entities.
You can add include_entities=1 to the end of most REST api calls and it will give you expanded information about the URL's contained within the JSON. It will split out all the URL's where you can parse out the Youtube links for example. The JSON also includes a special media_url entity but it only works for pictures. In any case, you can still parse out the media easily like youtube with a regex match because you get the URL's split out nicely with this include_entities=1 parameter.
example call :
http://api.twitter.com/1/statuses/user_timeline.json?screen_name=twitterapi&include_entities=1
more documentation : https://dev.twitter.com/docs/tweet-entities
answer edited below based on clarification:
Editing Twitter itself with previews is impossible and it's also ineffective. 75% of traffic to Twitter happens outside of Twitter.com. However the most probable solution to achieving this request would be to download a browser extension.
This extension for example enbales previews of webpages directly in the users stream content preview pane on Twitter.com
https://chrome.google.com/webstore/detail/oijgblonhcagdhfbgjilnpjipmijimmn

Pulling Retweets using Twitter user_timeline in JSON format

I'm currently using the script..
http://twitter.com/statuses/user_timeline/username.json?callback=twitterCallback2&count=1
.. to pull the most recent Tweet for a number of users to display on my website. However, I've ran into the problem that the JSON format doesn't display Retweets. I've read from this link that you must use "retweeted_by_me" to also display Retweets by I'm not quite sure how I would merge that with my current script.
EDIT : As of Twitter API Version 1.1, use the following format. (Needs Authenticaton)
https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=nikhilkuruvilla&include_rts=true
The updated documentation can be found here
https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline
[UPDATE] The following methods apply to Twitter API Version 1 and is Deprecated now.
Use the new twitter API and add include_rts=true Eg: http://api.twitter.com/1/statuses/user_timeline.json?screen_name=nikhilkuruvilla&include_rts=true
Full documentation can be found here : http://dev.twitter.com/doc/get/statuses/user_timeline
If you read the GET statuses/user_timeline documentation you fill find that by adding a parameter of include_rts set to true it will include retweets.
Change response mode to rss. This will resolve the issue. It might require change in the display code depending on your scripting language though.

Resources