Skip to content

Instantly share code, notes, and snippets.

@lfcipriani
Last active August 29, 2015 14:10
Show Gist options
  • Save lfcipriani/68cc5d42d139ec8127f3 to your computer and use it in GitHub Desktop.
Save lfcipriani/68cc5d42d139ec8127f3 to your computer and use it in GitHub Desktop.
Curated tweet to Permalink
ID: 536844296578940928
Created at: Mon Nov 24 11:30:29 +0000 2014
Text: @Wonderm00n epá, é o q está por default na tua api do twitter :P
User: espaco99
Permalink: https://twitter.com/espaco99/status/536844296578940928
{
"response": {
"position": {
"was_truncated": false,
"min_position": "371419846268038912",
"max_position": "371419846268038912"
},
"timeline_id": "custom-536951791716278272",
"timeline": [
{
"feature_context": "HBgGY3VzdG9tFoCAkezos9HzDgAA",
"tweet": {
"sort_index": "371419846268038912",
"id": "536844296578940928"
}
}
]
},
"objects": {
"timelines": {
"custom-536951791716278272": {
"following": false,
"timeline_order": "curation_reverse_chron",
"visibility": "unlisted",
"description": "",
"custom_timeline_url": "https://twitter.com/lfcipriani/timelines/536951791716278272",
"user_id": "17347849",
"name": "teste"
}
},
"users": {
"19662027": {
"notifications": false,
"follow_request_sent": false,
"following": false,
"default_profile_image": false,
"default_profile": false,
"profile_use_background_image": true,
"profile_text_color": "666666",
"profile_sidebar_fill_color": "FFFFFF",
"profile_sidebar_border_color": "FFAB29",
"utc_offset": 0,
"favourites_count": 609,
"created_at": "Wed Jan 28 17:02:46 +0000 2009",
"listed_count": 6,
"friends_count": 590,
"followers_count": 270,
"protected": false,
"entities": {
"description": {
"urls": []
},
"url": {
"urls": [
{
"indices": [
0,
22
],
"display_url": "espaco99.com",
"expanded_url": "http://espaco99.com",
"url": "http://t.co/Iulft7PnGX"
}
]
}
},
"id": 19662027,
"id_str": "19662027",
"name": "Fernando Sousa",
"screen_name": "espaco99",
"location": "38.624925,-9.08674",
"profile_location": null,
"description": "designer",
"url": "http://t.co/Iulft7PnGX",
"time_zone": "Lisbon",
"geo_enabled": true,
"verified": false,
"statuses_count": 10493,
"lang": "pt",
"contributors_enabled": false,
"is_translator": false,
"is_translation_enabled": false,
"profile_background_color": "FFFFFF",
"profile_background_image_url": "http://pbs.twimg.com/profile_background_images/57635914/banner.jpg",
"profile_background_image_url_https": "https://pbs.twimg.com/profile_background_images/57635914/banner.jpg",
"profile_background_tile": false,
"profile_image_url": "http://pbs.twimg.com/profile_images/472382723558871041/7rGozn-s_normal.jpeg",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/472382723558871041/7rGozn-s_normal.jpeg",
"profile_banner_url": "https://pbs.twimg.com/profile_banners/19662027/1348311534",
"profile_link_color": "BA6D0F"
},
"17347849": {
"notifications": false,
"follow_request_sent": false,
"following": false,
"default_profile_image": false,
"default_profile": false,
"profile_use_background_image": true,
"profile_text_color": "333333",
"profile_sidebar_fill_color": "DDEEF6",
"profile_sidebar_border_color": "000000",
"utc_offset": -7200,
"favourites_count": 549,
"created_at": "Wed Nov 12 20:29:29 +0000 2008",
"listed_count": 78,
"friends_count": 777,
"followers_count": 2001,
"protected": false,
"entities": {
"description": {
"urls": []
},
"url": {
"urls": [
{
"indices": [
0,
22
],
"display_url": "talleye.com",
"expanded_url": "http://talleye.com",
"url": "http://t.co/CFEKrPstKN"
}
]
}
},
"id": 17347849,
"id_str": "17347849",
"name": "Luis Cipriani",
"screen_name": "lfcipriani",
"location": "Sao Paulo",
"profile_location": null,
"description": "Computer Scientist, Developer Advocate @ Twitter, Silly Walker",
"url": "http://t.co/CFEKrPstKN",
"time_zone": "Brasilia",
"geo_enabled": false,
"verified": false,
"statuses_count": 5249,
"lang": "en",
"contributors_enabled": false,
"is_translator": false,
"is_translation_enabled": false,
"profile_background_color": "131516",
"profile_background_image_url": "http://abs.twimg.com/images/themes/theme14/bg.gif",
"profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme14/bg.gif",
"profile_background_tile": true,
"profile_image_url": "http://pbs.twimg.com/profile_images/460752206598135808/cpXLNPMc_normal.jpeg",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/460752206598135808/cpXLNPMc_normal.jpeg",
"profile_banner_url": "https://pbs.twimg.com/profile_banners/17347849/1398687046",
"profile_link_color": "127340"
}
},
"tweets": {
"536844296578940928": {
"lang": "pt",
"retweeted": false,
"favorited": false,
"entities": {
"urls": [],
"user_mentions": [
{
"indices": [
0,
11
],
"id_str": "19405396",
"id": 19405396,
"name": "Marco Almeida",
"screen_name": "Wonderm00n"
}
],
"symbols": [],
"hashtags": []
},
"favorite_count": 0,
"retweet_count": 0,
"in_reply_to_status_id_str": "536844157638426624",
"in_reply_to_status_id": 536844157638426600,
"truncated": false,
"source": "<a href=\"https://about.twitter.com/products/tweetdeck\" rel=\"nofollow\">TweetDeck</a>",
"text": "@Wonderm00n epá, é o q está por default na tua api do twitter :P",
"id_str": "536844296578940928",
"id": 536844296578940900,
"created_at": "Mon Nov 24 11:30:29 +0000 2014",
"in_reply_to_user_id": 19405396,
"in_reply_to_user_id_str": "19405396",
"in_reply_to_screen_name": "Wonderm00n",
"user": {
"id_str": "19662027",
"id": 19662027
},
"geo": null,
"coordinates": null,
"place": null,
"contributors": null
}
}
}
}
require "rubygems"
require "net/https"
require "simple_oauth"
require "json"
keys = {
:consumer_key => "EDIT",
:consumer_secret => "EDIT",
:token => "EDIT",
:token_secret => "EDIT"
}
uri = URI.parse("https://api.twitter.com/1.1/beta/timelines/timeline.json?id=custom-536951791716278272")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Get.new(uri.request_uri)
req["Host"] = "api.twitter.com"
req["Authorization"] = SimpleOAuth::Header.new(:get, uri.to_s, {}, keys)
response = http.request(req)
response = JSON.parse(response.body)
response["objects"]["tweets"].each do |id,tweet|
puts "ID: " + id
puts "Created at: #{tweet["created_at"]}"
puts "Text: #{tweet["text"]}"
user = response["objects"]["users"][tweet["user"]["id_str"]]["screen_name"]
puts "User: #{user}"
puts "Permalink: https://twitter.com/#{user}/status/#{id}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment