【问题标题】:Twitter4j search get only few fieldsTwitter4j 搜索只得到几个字段
【发布时间】:2015-01-09 23:29:54
【问题描述】:

Twitter4j 搜索返回包含许多字段的结果。

例如:

StatusJSONImpl{createdAt=Fri Jan 09 19:56:31 IST 2015, id=553558441482924033, text='Avast Free Antivirus 2015 [Download]: Avast Free Antivirus 2015 [Download] by AVAST Software s.r.o. Platform:… http://t.co/0zLPutC1PU', source='<a href="http://dlvr.it" rel="nofollow">dlvr.it</a>', isTruncated=false, inReplyToStatusId=-1, inReplyToUserId=-1, isFavorited=false, isRetweeted=false, favoriteCount=0, inReplyToScreenName='null', geoLocation=null, place=null, retweetCount=0, isPossiblySensitive=false, isoLanguageCode='en', lang='en', contributorsIDs=[], retweetedStatus=null, userMentionEntities=[], urlEntities=[URLEntityJSONImpl{url='http://t.co/0zLPutC1PU', expandedURL='http://amzn.to/1q69X9Z', displayURL='amzn.to/1q69X9Z'}], hashtagEntities=[], mediaEntities=[], symbolEntities=[], currentUserRetweetId=-1, user=UserJSONImpl{id=2792966010, name='Jessica', screenName='JessicaN372', location='US', description='Jessica', isContributorsEnabled=false, profileImageUrl='http://pbs.twimg.com/profile_images/508946722307846144/E5Bi70E8_normal.jpeg', profileImageUrlHttps='https://pbs.twimg.com/profile_images/508946722307846144/E5Bi70E8_normal.jpeg', url='null', isProtected=false, followersCount=128, status=null, profileBackgroundColor='C0DEED', profileTextColor='333333', profileLinkColor='0084B4', profileSidebarFillColor='DDEEF6', profileSidebarBorderColor='C0DEED', profileUseBackgroundImage=true, showAllInlineMedia=false, friendsCount=0, createdAt=Sat Sep 06 08:13:33 IST 2014, favouritesCount=0, utcOffset=-1, timeZone='null', profileBackgroundImageUrl='http://abs.twimg.com/images/themes/theme1/bg.png', profileBackgroundImageUrlHttps='https://abs.twimg.com/images/themes/theme1/bg.png', profileBackgroundTiled=false, lang='en', statusesCount=148653, isGeoEnabled=false, isVerified=false, translator=false, listedCount=2, isFollowRequestSent=false}}

我只需要文本和链接。

如何只请求某些字段

【问题讨论】:

    标签: java twitter twitter4j


    【解决方案1】:

    由于 Twitter 搜索 API 不提供此功能,因此无法请求某些字段。

    相反,您需要自己从Status 中提取您感兴趣的内容。

    在您的情况下,您可以使用status.getText()status.getUrlEntities() 来获得您想要的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多