-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Description
As of now, we are not updating the retweet_count and favorite_count, so they are always == 0.
The reason for that is that we read the tweet at the time of creation, which means that there will be no retweet or favorite at that time.
One way to update the counts is to see if a tweet has a retweeted_status property. If it does, it will have the id of the parent/original tweet. We can then query the DB to get the original tweet and update its counts based on the child information.
Below is an example of a complete retweet with the relevant parts in bold:
"created_at": "Thu Dec 08 16:45:03 +0000 2016",
"id": 806902422761259000,
"id_str": "806902422761259008",
"text": "RT @AndrewYNg: Welcome Apple to the world that publishes! Lets do research not just for ourselves, but for everyone. #nips2016 https://t.co…",
"truncated": false,
"entities": {
"hashtags": [
{
"text": "nips2016",
"indices": [
117,
126
]
}
],
"symbols": [],
"user_mentions": [
{
"screen_name": "AndrewYNg",
"name": "Andrew Ng",
"id": 216939636,
"id_str": "216939636",
"indices": [
3,
13
]
}
],
"urls": []
},
"source": "Twitter for Android",
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"in_reply_to_screen_name": null,
"user": {
"id": 752695412809662500,
"id_str": "752695412809662464",
"name": "Evan Cofer",
"screen_name": "evan_cofer",
"location": "",
"description": "Researching deep learning, computational biology, and computer science @Trinity_U",
"url": "https://t.co/rLGP49BfSP",
"entities": {
"url": {
"urls": [
{
"url": "https://t.co/rLGP49BfSP",
"expanded_url": "http://www.evancofer.com",
"display_url": "evancofer.com",
"indices": [
0,
23
]
}
]
},
"description": {
"urls": []
}
},
"protected": false,
"followers_count": 59,
"friends_count": 113,
"listed_count": 20,
"created_at": "Tue Jul 12 02:45:45 +0000 2016",
"favourites_count": 1935,
"utc_offset": null,
"time_zone": null,
"geo_enabled": false,
"verified": false,
"statuses_count": 253,
"lang": "en",
"contributors_enabled": false,
"is_translator": false,
"is_translation_enabled": false,
"profile_background_color": "F5F8FA",
"profile_background_image_url": null,
"profile_background_image_url_https": null,
"profile_background_tile": false,
"profile_image_url": "http://pbs.twimg.com/profile_images/752722734082363392/rQWnVwQU_normal.jpg",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/752722734082363392/rQWnVwQU_normal.jpg",
"profile_link_color": "1DA1F2",
"profile_sidebar_border_color": "C0DEED",
"profile_sidebar_fill_color": "DDEEF6",
"profile_text_color": "333333",
"profile_use_background_image": true,
"has_extended_profile": false,
"default_profile": true,
"default_profile_image": false,
"following": false,
"follow_request_sent": false,
"notifications": false,
"translator_type": "none"
},
"geo": null,
"coordinates": null,
"place": null,
"contributors": null,
"retweeted_status": {
"created_at": "Thu Dec 08 11:17:45 +0000 2016",
"id": 806820052355924000,
"id_str": "806820052355923968",
"text": "Welcome Apple to the world that publishes! Lets do research not just for ourselves, but for everyone. #nips2016 https://t.co/BRRFpFpCjZ",
"truncated": false,
"entities": {
"hashtags": [
{
"text": "nips2016",
"indices": [
102,
111
]
}
],
"symbols": [],
"user_mentions": [],
"urls": [
{
"url": "https://t.co/BRRFpFpCjZ",
"expanded_url": "https://www.bloomberg.com/news/articles/2016-12-06/apple-to-start-publishing-ai-research-to-hasten-deep-learning",
"display_url": "bloomberg.com/news/articles/…",
"indices": [
112,
135
]
}
]
},
"source": "Twitter Web Client",
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"in_reply_to_screen_name": null,
"user": {
"id": 216939636,
"id_str": "216939636",
"name": "Andrew Ng",
"screen_name": "AndrewYNg",
"location": "Mountain View, CA",
"description": "Chief Scientist of Baidu; Chairman and Co-Founder of Coursera; Stanford CS faculty. #machinelearning, #deeplearning #MOOCs, #edtech",
"url": "https://t.co/XidcMETENd",
"entities": {
"url": {
"urls": [
{
"url": "https://t.co/XidcMETENd",
"expanded_url": "http://www.andrewng.org",
"display_url": "andrewng.org",
"indices": [
0,
23
]
}
]
},
"description": {
"urls": []
}
},
"protected": false,
"followers_count": 86801,
"friends_count": 158,
"listed_count": 2501,
"created_at": "Thu Nov 18 03:39:11 +0000 2010",
"favourites_count": 224,
"utc_offset": null,
"time_zone": null,
"geo_enabled": true,
"verified": false,
"statuses_count": 759,
"lang": "en",
"contributors_enabled": false,
"is_translator": false,
"is_translation_enabled": false,
"profile_background_color": "C0DEED",
"profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png",
"profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png",
"profile_background_tile": false,
"profile_image_url": "http://pbs.twimg.com/profile_images/733174243714682880/oyG30NEH_normal.jpg",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/733174243714682880/oyG30NEH_normal.jpg",
"profile_link_color": "0084B4",
"profile_sidebar_border_color": "FFFFFF",
"profile_sidebar_fill_color": "DDEEF6",
"profile_text_color": "333333",
"profile_use_background_image": true,
"has_extended_profile": false,
"default_profile": false,
"default_profile_image": false,
"following": false,
"follow_request_sent": false,
"notifications": false,
"translator_type": "none"
},
"geo": null,
"coordinates": null,
"place": {
"id": "5e18fc5ee4604d3f",
"url": "https://api.twitter.com/1.1/geo/id/5e18fc5ee4604d3f.json",
"place_type": "city",
"name": "Granadilla de Abona",
"full_name": "Granadilla de Abona, Spain",
"country_code": "ES",
"country": "Spain",
"contained_within": [],
"bounding_box": {
"type": "Polygon",
"coordinates": [
[
[
-16.6201528,
28.0247648
],
[
-16.480623,
28.0247648
],
[
-16.480623,
28.2176012
],
[
-16.6201528,
28.2176012
]
]
]
},
"attributes": {}
},
"contributors": null,
"is_quote_status": false,
"retweet_count": 151,
"favorite_count": 274,
"favorited": false,
"retweeted": false,
"possibly_sensitive": false,
"lang": "en"
},
"is_quote_status": false,
"retweet_count": 151,
"favorite_count": 0,
"favorited": false,
"retweeted": false,
"lang": "en"