我一直在以JSon格式存儲大量Tweets。現在,我試圖將它們讀回狀態,但對象創建只填充了一些字段,即使原始Json包含所有信息。twitter4j twitterobjectfactory.createstatus將retweetedStatus返回爲空
這裏是原始JSON
{"createdAt":"Aug 5, 2014 4:03:39 PM",
"id":496733290263760896,
"text":"RT @lucasfresno: Bora se encacha?ar! RT @zerohora: Leia agora em http://t.co/ho1jjRsIpH http://t.co/VPRDdg35oO",
"source":"\u003ca href\u003d\"http://twitter.com/download/iphone\" rel\u003d\"nofollow\"\u003eTwitter for iPhone\u003c/a\u003e",
"isTruncated":false,
"inReplyToStatusId":-1,
"inReplyToUserId":-1,
"isFavorited":false,
"retweetCount":0,
"isPossiblySensitive":false,
"contributorsIDs":[],
"retweetedStatus":{"createdAt":"Aug 5, 2014 1:39:46 PM",
"id":496697079394492417,
"text":"Bora se encacha?ar! RT @zerohora: Leia agora em http://t.co/ho1jjRsIpH http://t.co/VPRDdg35oO",
"source":"\u003ca href\u003d\"http://twitter.com/download/iphone\" rel\u003d\"nofollow\"\u003eTwitter for iPhone\u003c/a\u003e",
"isTruncated":false,
"inReplyToStatusId":496694316656381952,
"inReplyToUserId":13531162,
"isFavorited":false,
"inReplyToScreenName":"zerohora",
"retweetCount":76,
"isPossiblySensitive":false,
"contributorsIDs":[],
"userMentionEntities":[{"name":"Zero Hora",
"screenName":"zerohora",
"id":13531162,
"start":23,
"end":32}],
"urlEntities":[{"url":"http://t.co/ho1jjRsIpH",
"expandedURL":"http://zh.com.br",
"displayURL":"zh.com.br",
"start":48,
"end":70}],
"hashtagEntities":[],
"mediaEntities":[{"id":496694316467646464,
"url":"http://t.co/VPRDdg35oO",
"mediaURL":"http://pbs.twimg.com/media/BuSc2WcCcAA49F5.jpg",
"mediaURLHttps":"https://pbs.twimg.com/media/BuSc2WcCcAA49F5.jpg",
"expandedURL":"http://twitter.com/zerohora/status/496694316656381952/photo/1",
"displayURL":"pic.twitter.com/VPRDdg35oO",
"sizes":{"0":{"width":150,"height":150,"resize":101},"1":{"width":340,"height":375,"resize":100},"2":{"width":477,"height":527,"resize":100},"3":{"width":477,"height":527,"resize":100}},
"type":"photo",
"start":71,
"end":93}],
"currentUserRetweetId":-1,
"user":{"id":49315012,
"name":"Lucas Silveira",
"screenName":"lucasfresno",
"location":"Em tudo que ? lugar.",
"description":"Fresno, Beeshop, SIRsir, Visconde, Vaconaut \u0026 The Apple Monster, Dark Matter, Poop Straps...",
"descriptionURLEntities":[],
"isContributorsEnabled":false,
"profileImageUrl":"http://pbs.twimg.com/profile_images/378800000615174403/68c2ac7b73415c6e06d71f8330b50d55_normal.jpeg",
"profileImageUrlHttps":"https://pbs.twimg.com/profile_images/378800000615174403/68c2ac7b73415c6e06d71f8330b50d55_normal.jpeg",
"url":"http://www.fresnorock.com.br",
"isProtected":false,
"followersCount":883117,
"profileBackgroundColor":"FFFFFF",
"profileTextColor":"666666",
"profileLinkColor":"2FC2EF",
"profileSidebarFillColor":"252429",
"profileSidebarBorderColor":"181A1E",
"profileUseBackgroundImage":true,
"showAllInlineMedia":false,
"friendsCount":628,
"createdAt":"Jun 21, 2009 10:34:03 AM",
"favouritesCount":80,
"utcOffset":-10800,
"timeZone":"Brasilia",
"profileBackgroundImageUrl":"http://pbs.twimg.com/profile_background_images/414221729/space.jpg",
"profileBackgroundImageUrlHttps":"https://pbs.twimg.com/profile_background_images/414221729/space.jpg",
"profileBackgroundTiled":false,
"lang":"en",
"statusesCount":55070,
"isGeoEnabled":true,
"isVerified":true,
"translator":false,
"listedCount":8724,
"isFollowRequestSent":false}},
"userMentionEntities":[{"name":"Lucas Silveira",
"screenName":"lucasfresno",
"id":49315012,
"start":3,
"end":15},
{"name":"Zero Hora",
"screenName":"zerohora",
"id":13531162,
"start":40,
"end":49}],
"urlEntities":[{"url":"http://t.co/ho1jjRsIpH",
"expandedURL":"http://zh.com.br",
"displayURL":"zh.com.br",
"start":65,
"end":87}],
"hashtagEntities":[],
"mediaEntities":[{"id":496694316467646464,
"url":"http://t.co/VPRDdg35oO",
"mediaURL":"http://pbs.twimg.com/media/BuSc2WcCcAA49F5.jpg",
"mediaURLHttps":"https://pbs.twimg.com/media/BuSc2WcCcAA49F5.jpg",
"expandedURL":"http://twitter.com/zerohora/status/496694316656381952/photo/1",
"displayURL":"pic.twitter.com/VPRDdg35oO",
"sizes":{"0":{"width":150,"height":150,"resize":101},"1":{"width":340,"height":375,"resize":100},"2":{"width":477,"height":527,"resize":100},"3":{"width":477,"height":527,"resize":100}},
"type":"photo",
"start":88,
"end":110}],
"currentUserRetweetId":-1,
"user":{"id":25413124,
"name":"Mariana Mussi",
"screenName":"MarianaMussi",
"location":"Brazil",
"description":"Minky Momo is here...E sigam-me os bons! Ps: Sou um docinho sim, mas ?s vezes posso ser de maracuj? ou lim?o ;) ? http://about.me/mariana.mussi",
"descriptionURLEntities":[],
"isContributorsEnabled":false,
"profileImageUrl":"http://pbs.twimg.com/profile_images/3487510187/6545498cd8cd7605637d9458c4c9e272_normal.jpeg",
"profileImageUrlHttps":"https://pbs.twimg.com/profile_images/3487510187/6545498cd8cd7605637d9458c4c9e272_normal.jpeg",
"url":"http://www.facebook.com/profile.php?id\u003d1106187557",
"isProtected":false,
"followersCount":391,
"profileBackgroundColor":"FFBDCF",
"profileTextColor":"41474D",
"profileLinkColor":"4DABC7",
"profileSidebarFillColor":"F7FBFC",
"profileSidebarBorderColor":"FFFFFF",
"profileUseBackgroundImage":true,
"showAllInlineMedia":false,
"friendsCount":386,
"createdAt":"Mar 19, 2009 8:46:35 PM",
"favouritesCount":4991,
"utcOffset":-10800,
"timeZone":"Brasilia",
"profileBackgroundImageUrl":"http://pbs.twimg.com/profile_background_images/195172436/minkymomomarianamussibg5.png",
"profileBackgroundImageUrlHttps":"https://pbs.twimg.com/profile_background_images/195172436/minkymomomarianamussibg5.png",
"profileBannerImageUrl":"https://pbs.twimg.com/profile_banners/25413124/1355939835",
"profileBackgroundTiled":true,
"lang":"pt",
"statusesCount":38951,
"isGeoEnabled":true,
"isVerified":false,
"translator":false,
"listedCount":9,
"isFollowRequestSent":false}
}
這裏是從狀態S = TwitterObjectFactory.createStatus(線)的對象結果;呼叫。
StatusJSONImpl{
createdAt=null,
id=496733290263760896,
text='RT @lucasfresno: Bora se encacha?ar! RT @zerohora: Leia agora em http://t.co/ho1jjRsIpH http://t.co/VPRDdg35oO',
source='<a href="http://twitter.com/download/iphone" rel="nofollow">Twitter for iPhone</a>',
isTruncated=false,
inReplyToStatusId=-1,
inReplyToUserId=-1,
isFavorited=false,
isRetweeted=false,
favoriteCount=-1,
inReplyToScreenName='null',
geoLocation=null,
place=null,
retweetCount=-1,
isPossiblySensitive=false,
lang='null',
contributorsIDs=[],
retweetedStatus=null,
userMentionEntities=[],
urlEntities=[],
hashtagEntities=[],
mediaEntities=[],
symbolEntities=[],
currentUserRetweetId=-1,
user=UserJSONImpl{
id=25413124,
name='Mariana Mussi',
screenName='null',
location='Brazil',
description='Minky Momo is here...E sigam-me os bons! Ps: Sou um docinho sim, mas ?s vezes posso ser de maracuj? ou lim?o ;) ? http://about.me/mariana.mussi',
isContributorsEnabled=false,
profileImageUrl='null',
profileImageUrlHttps='null',
isDefaultProfileImage=false,
url='http://www.facebook.com/profile.php?id=1106187557',
isProtected=false,
followersCount=-1,
status=null,
profileBackgroundColor='null',
profileTextColor='null',
profileLinkColor='null',
profileSidebarFillColor='null',
profileSidebarBorderColor='null',
profileUseBackgroundImage=false,
isDefaultProfile=false,
showAllInlineMedia=false,
friendsCount=-1,
createdAt=null,
favouritesCount=-1,
utcOffset=-1,
timeZone='null',
profileBackgroundImageUrl='null',
profileBackgroundImageUrlHttps='null',
profileBackgroundTiled=false,
lang='pt',
statusesCount=-1,
isGeoEnabled=false,
isVerified=false,
translator=false,
listedCount=-1,
isFollowRequestSent=false
}
}
有沒有人解決過這個問題?我還沒有找到任何地方的實際解決方案。 在此先感謝您的幫助。
編輯:我從GIT下載了源代碼並在本地修復了createStatus方法。儘管如此,似乎這個問題現在應該已經修復,除非有我丟失的東西...
問題是我有超過50個功能,我以前爲使用實時數據的項目構建並期望有一個Status對象。我把它們變成了一個圖書館,我希望在這個新項目中使用它們。 我同意JSON會提供這些信息,但是維護該代碼需要比修復Twitter4J庫更多的時間。 – maiona 2015-02-26 15:47:36
你原來的JSON是錯誤的,你已經retweetedStatus而不是retweeted_status作爲RT域): – FeanDoe 2015-02-26 16:11:05
感謝您的幫助,FeanDoe!這回答了我的問題。 – maiona 2015-02-27 17:01:01