Search code examples
javatwittergeolocationtwitter4j

Can't get location filters to work using Twitter4J


My twitter4j streaming works when I am using track and user queries but when I use location queries, It returns a 404, i.e.

$ java -cp .:twitter4j-core-4.0.4.jar:twitter4j-media-support-4.0.4.jar:twitter4j-async-4.0.4.jar:twitter4j-examples-4.0.4.jar:twitter4j-stream-4.0.4.jar PrintFilterLocationStream "{1,2}"
[Wed Jul 06 00:05:41 SGT 2016]serialVersionUID: 6175546394599249696
[Wed Jul 06 00:05:41 SGT 2016]debug: true
[Wed Jul 06 00:05:41 SGT 2016]user: null
[Wed Jul 06 00:05:41 SGT 2016]password: null
[Wed Jul 06 00:05:41 SGT 2016]httpConf: MyHttpClientConfiguration{httpProxyHost='null', httpProxyUser='null', httpProxyPassword='null', httpProxyPort=-1, httpConnectionTimeout=20000, httpReadTimeout=120000, prettyDebug=false, gzipEnabled=true}
[Wed Jul 06 00:05:41 SGT 2016]httpStreamingReadTimeout: 40000
[Wed Jul 06 00:05:41 SGT 2016]httpRetryCount: 0
[Wed Jul 06 00:05:41 SGT 2016]httpRetryIntervalSeconds: 5
[Wed Jul 06 00:05:41 SGT 2016]oAuthConsumerKey: XXX
[Wed Jul 06 00:05:41 SGT 2016]oAuthConsumerSecret: **************************************************
[Wed Jul 06 00:05:41 SGT 2016]oAuthAccessToken: XXX-XXX
[Wed Jul 06 00:05:41 SGT 2016]oAuthAccessTokenSecret: *********************************************
[Wed Jul 06 00:05:41 SGT 2016]oAuth2TokenType: null
[Wed Jul 06 00:05:41 SGT 2016]oAuth2AccessToken: null
[Wed Jul 06 00:05:41 SGT 2016]oAuth2Scope: null
[Wed Jul 06 00:05:41 SGT 2016]oAuthRequestTokenURL: https://api.twitter.com/oauth/request_token
[Wed Jul 06 00:05:41 SGT 2016]oAuthAuthorizationURL: https://api.twitter.com/oauth/authorize
[Wed Jul 06 00:05:41 SGT 2016]oAuthAccessTokenURL: https://api.twitter.com/oauth/access_token
[Wed Jul 06 00:05:41 SGT 2016]oAuthAuthenticationURL: https://api.twitter.com/oauth/authenticate
[Wed Jul 06 00:05:41 SGT 2016]oAuth2TokenURL: https://api.twitter.com/oauth2/token
[Wed Jul 06 00:05:41 SGT 2016]oAuth2InvalidateTokenURL: https://api.twitter.com/oauth2/invalidate_token
[Wed Jul 06 00:05:41 SGT 2016]restBaseURL: https://api.twitter.com/1.1/
[Wed Jul 06 00:05:41 SGT 2016]streamBaseURL: https://stream.twitter.com/1.1/
[Wed Jul 06 00:05:41 SGT 2016]userStreamBaseURL: https://userstream.twitter.com/1.1/
[Wed Jul 06 00:05:41 SGT 2016]siteStreamBaseURL: https://sitestream.twitter.com/1.1/
[Wed Jul 06 00:05:41 SGT 2016]uploadBaseURL: https://upload.twitter.com/1.1/
[Wed Jul 06 00:05:41 SGT 2016]dispatcherImpl: twitter4j.DispatcherImpl
[Wed Jul 06 00:05:41 SGT 2016]asyncNumThreads: 1
[Wed Jul 06 00:05:41 SGT 2016]loggerFactory: null
[Wed Jul 06 00:05:41 SGT 2016]contributingTo: -1
[Wed Jul 06 00:05:41 SGT 2016]includeMyRetweetEnabled: true
[Wed Jul 06 00:05:41 SGT 2016]includeEntitiesEnabled: true
[Wed Jul 06 00:05:41 SGT 2016]trimUserEnabled: false
[Wed Jul 06 00:05:41 SGT 2016]jsonStoreEnabled: false
[Wed Jul 06 00:05:41 SGT 2016]mbeanEnabled: false
[Wed Jul 06 00:05:41 SGT 2016]userStreamRepliesAllEnabled: false
[Wed Jul 06 00:05:41 SGT 2016]userStreamWithFollowingsEnabled: true
[Wed Jul 06 00:05:41 SGT 2016]stallWarningsEnabled: true
[Wed Jul 06 00:05:41 SGT 2016]applicationOnlyAuthEnabled: false
[Wed Jul 06 00:05:41 SGT 2016]mediaProvider: TWITTER
[Wed Jul 06 00:05:41 SGT 2016]mediaProviderAPIKey: null
[Wed Jul 06 00:05:41 SGT 2016]mediaProviderParameters: null
[Wed Jul 06 00:05:41 SGT 2016]daemonEnabled: true
[Wed Jul 06 00:05:41 SGT 2016]instances: [ConfigurationBase{debug=true, user='null', password='null', httpConf=MyHttpClientConfiguration{httpProxyHost='null', httpProxyUser='null', httpProxyPassword='null', httpProxyPort=-1, httpConnectionTimeout=20000, httpReadTimeout=120000, prettyDebug=false, gzipEnabled=true}, httpStreamingReadTimeout=40000, httpRetryCount=0, httpRetryIntervalSeconds=5, oAuthConsumerKey='zptB1VLNbNguInk3HqKHvc55H', oAuthConsumerSecret='8lyjsT2PsIkG5Ada5axh5k7H8B9lOQM67jizv90tSlasrOGun6', oAuthAccessToken='2550568801-AgwQ31S2DgJ6lyVrZSlMPqBEweTnFk4fn17BLH1', oAuthAccessTokenSecret='3yKlKp6fWvuzAQkgthZbXCB5aMOt3vg1nrVlgQDh9atJV', oAuth2TokenType='null', oAuth2AccessToken='null', oAuth2Scope='null', oAuthRequestTokenURL='https://api.twitter.com/oauth/request_token', oAuthAuthorizationURL='https://api.twitter.com/oauth/authorize', oAuthAccessTokenURL='https://api.twitter.com/oauth/access_token', oAuthAuthenticationURL='https://api.twitter.com/oauth/authenticate', oAuth2TokenURL='https://api.twitter.com/oauth2/token', oAuth2InvalidateTokenURL='https://api.twitter.com/oauth2/invalidate_token', restBaseURL='https://api.twitter.com/1.1/', uploadBaseURL='https://upload.twitter.com/1.1/', streamBaseURL='https://stream.twitter.com/1.1/', userStreamBaseURL='https://userstream.twitter.com/1.1/', siteStreamBaseURL='https://sitestream.twitter.com/1.1/', dispatcherImpl='twitter4j.DispatcherImpl', asyncNumThreads=1, loggerFactory='null', contributingTo=-1, includeMyRetweetEnabled=true, includeEntitiesEnabled=true, trimUserEnabled=false, jsonStoreEnabled=false, mbeanEnabled=false, userStreamRepliesAllEnabled=false, userStreamWithFollowingsEnabled=true, stallWarningsEnabled=true, applicationOnlyAuthEnabled=false, mediaProvider='TWITTER', mediaProviderAPIKey='null', mediaProviderParameters=null, daemonEnabled=true}]
[Wed Jul 06 00:05:41 SGT 2016]Establishing connection.
[Wed Jul 06 00:05:41 SGT 2016]Twitter Stream consumer-1[Establishing connection]
[Wed Jul 06 00:05:42 SGT 2016]Request: 
[Wed Jul 06 00:05:42 SGT 2016]POST https://stream.twitter.com/1.1/statuses/filter.json
[Wed Jul 06 00:05:42 SGT 2016]OAuth base string: POST&https%3A%2F%2Fstream.twitter.com%2F1.1%2Fstatuses%2Ffilter.json&count%3D0%26locations%3D1.0%252C2.0%26oauth_consumer_key%3DzptB1VLNbNguInk3HqKHvc55H%26oauth_nonce%3D3352799096%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1467734742%26oauth_token%3D2550568801-AgwQ31S2DgJ6lyVrZSlMPqBEweTnFk4fn17BLH1%26oauth_version%3D1.0%26stall_warnings%3Dtrue
[Wed Jul 06 00:05:42 SGT 2016]OAuth signature: qf36pAFObnNP+VwCR88h0fEjbbk=
[Wed Jul 06 00:05:42 SGT 2016]Authorization: *************************************************************************************************************************************************************************************************************************************************************************************
[Wed Jul 06 00:05:42 SGT 2016]X-Twitter-Client-Version: 4.0.4
[Wed Jul 06 00:05:42 SGT 2016]X-Twitter-Client-URL: http://twitter4j.org/en/twitter4j-4.0.4.xml
[Wed Jul 06 00:05:42 SGT 2016]X-Twitter-Client: Twitter4J
[Wed Jul 06 00:05:42 SGT 2016]User-Agent: twitter4j http://twitter4j.org/ /4.0.4
[Wed Jul 06 00:05:42 SGT 2016]Connection: close
[Wed Jul 06 00:05:42 SGT 2016]Accept-Encoding: gzip
[Wed Jul 06 00:05:42 SGT 2016]Post Params: count=0&locations=1.0%2C2.0&stall_warnings=true
[Wed Jul 06 00:05:43 SGT 2016]Response: 
[Wed Jul 06 00:05:43 SGT 2016]date: Tue, 05 Jul 2016 16:05:42 GMT
[Wed Jul 06 00:05:43 SGT 2016]HTTP/1.1 406 Not Acceptable
[Wed Jul 06 00:05:43 SGT 2016]server: tsa
[Wed Jul 06 00:05:43 SGT 2016]content-length: 103
[Wed Jul 06 00:05:43 SGT 2016]x-connection-hash: f255dee017473bf8d62e136ea40e9247
[Wed Jul 06 00:05:43 SGT 2016]content-type: text/html
[Wed Jul 06 00:05:43 SGT 2016]connection: close
[Wed Jul 06 00:05:43 SGT 2016]Location track items must be given as pairs of comma separated lat/longs: [Ljava.lang.String;@640a54b

[Wed Jul 06 00:05:43 SGT 2016]406:Returned by the Search API when an invalid format is specified in the request.
Returned by the Streaming API when one or more of the parameters are not suitable for the resource. The track parameter, for example, would throw this error if:
 The track keyword is too long or too short.
 The bounding box specified is invalid.
 No predicates defined for filtered resource, for example, neither track nor follow parameter defined.
 Follow userid cannot be read.
Location track items must be given as pairs of comma separated lat/longs: [Ljava.lang.String;@640a54b

[Wed Jul 06 00:05:43 SGT 2016]Parameter not accepted with the role. 406:Returned by the Search API when an invalid format is specified in the request.
Returned by the Streaming API when one or more of the parameters are not suitable for the resource. The track parameter, for example, would throw this error if:
 The track keyword is too long or too short.
 The bounding box specified is invalid.
 No predicates defined for filtered resource, for example, neither track nor follow parameter defined.
 Follow userid cannot be read.
Location track items must be given as pairs of comma separated lat/longs: [Ljava.lang.String;@640a54b

406:Returned by the Search API when an invalid format is specified in the request.
Returned by the Streaming API when one or more of the parameters are not suitable for the resource. The track parameter, for example, would throw this error if:
 The track keyword is too long or too short.
 The bounding box specified is invalid.
 No predicates defined for filtered resource, for example, neither track nor follow parameter defined.
 Follow userid cannot be read.
Location track items must be given as pairs of comma separated lat/longs: [Ljava.lang.String;@640a54b

Relevant discussions can be found on the Internet at:
    http://www.google.co.jp/search?q=1169356e or
    http://www.google.co.jp/search?q=c04b39e1
TwitterException{exceptionCode=[1169356e-c04b39e1], statusCode=406, message=null, code=-1, retryAfter=-1, rateLimitStatus=null, version=4.0.4}
    at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:164)
    at twitter4j.HttpClientBase.request(HttpClientBase.java:57)
    at twitter4j.HttpClientBase.post(HttpClientBase.java:86)
    at twitter4j.TwitterStreamImpl.getFilterStream(TwitterStreamImpl.java:346)
    at twitter4j.TwitterStreamImpl$8.getStream(TwitterStreamImpl.java:322)
    at twitter4j.TwitterStreamImpl$TwitterStreamConsumer.run(TwitterStreamImpl.java:552)

I have compiled modified the base example code from twitter4j and I compiled it as such:

$ javac -classpath twitter4j-core-4.0.4.jar:twitter4j-media-support-4.0.4.jar:twitter4j-async-4.0.4.jar:twitter4j-examples-4.0.4.jar:twitter4j-stream-4.0.4.jar PrintFilterLocationStream.java

My code can be found on https://www.dropbox.com/s/gj75fghtqy5jajf/tweity.zip?dl=0

Is it because the v1.1 endpoint doesn't support location?

Without the location filter, it works fine:

$ java -cp .:twitter4j-core-4.0.4.jar:twitter4j-media-support-4.0.4.jar:twitter4j-async-4.0.4.jar:twitter4j-examples-4.0.4.jar:twitter4j-stream-4.0.4.jar PrintFilterLocationStream "Singapore"
[Wed Jul 06 00:15:36 SGT 2016]serialVersionUID: 6175546394599249696
[Wed Jul 06 00:15:36 SGT 2016]debug: true
[Wed Jul 06 00:15:36 SGT 2016]user: null
[Wed Jul 06 00:15:36 SGT 2016]password: null
[Wed Jul 06 00:15:36 SGT 2016]httpConf: MyHttpClientConfiguration{httpProxyHost='null', httpProxyUser='null', httpProxyPassword='null', httpProxyPort=-1, httpConnectionTimeout=20000, httpReadTimeout=120000, prettyDebug=false, gzipEnabled=true}
[Wed Jul 06 00:15:36 SGT 2016]httpStreamingReadTimeout: 40000
[Wed Jul 06 00:15:36 SGT 2016]httpRetryCount: 0
[Wed Jul 06 00:15:36 SGT 2016]httpRetryIntervalSeconds: 5
[Wed Jul 06 00:15:36 SGT 2016]oAuthConsumerKey: XXX
[Wed Jul 06 00:15:36 SGT 2016]oAuthConsumerSecret: **************************************************
[Wed Jul 06 00:15:36 SGT 2016]oAuthAccessToken: XXX
[Wed Jul 06 00:15:36 SGT 2016]oAuthAccessTokenSecret: *********************************************
[Wed Jul 06 00:15:36 SGT 2016]oAuth2TokenType: null
[Wed Jul 06 00:15:36 SGT 2016]oAuth2AccessToken: null
[Wed Jul 06 00:15:36 SGT 2016]oAuth2Scope: null
[Wed Jul 06 00:15:36 SGT 2016]oAuthRequestTokenURL: https://api.twitter.com/oauth/request_token
[Wed Jul 06 00:15:36 SGT 2016]oAuthAuthorizationURL: https://api.twitter.com/oauth/authorize
[Wed Jul 06 00:15:36 SGT 2016]oAuthAccessTokenURL: https://api.twitter.com/oauth/access_token
[Wed Jul 06 00:15:36 SGT 2016]oAuthAuthenticationURL: https://api.twitter.com/oauth/authenticate
[Wed Jul 06 00:15:36 SGT 2016]oAuth2TokenURL: https://api.twitter.com/oauth2/token
[Wed Jul 06 00:15:36 SGT 2016]oAuth2InvalidateTokenURL: https://api.twitter.com/oauth2/invalidate_token
[Wed Jul 06 00:15:36 SGT 2016]restBaseURL: https://api.twitter.com/1.1/
[Wed Jul 06 00:15:36 SGT 2016]streamBaseURL: https://stream.twitter.com/1.1/
[Wed Jul 06 00:15:36 SGT 2016]userStreamBaseURL: https://userstream.twitter.com/1.1/
[Wed Jul 06 00:15:36 SGT 2016]siteStreamBaseURL: https://sitestream.twitter.com/1.1/
[Wed Jul 06 00:15:36 SGT 2016]uploadBaseURL: https://upload.twitter.com/1.1/
[Wed Jul 06 00:15:36 SGT 2016]dispatcherImpl: twitter4j.DispatcherImpl
[Wed Jul 06 00:15:36 SGT 2016]asyncNumThreads: 1
[Wed Jul 06 00:15:36 SGT 2016]loggerFactory: null
[Wed Jul 06 00:15:36 SGT 2016]contributingTo: -1
[Wed Jul 06 00:15:36 SGT 2016]includeMyRetweetEnabled: true
[Wed Jul 06 00:15:36 SGT 2016]includeEntitiesEnabled: true
[Wed Jul 06 00:15:36 SGT 2016]trimUserEnabled: false
[Wed Jul 06 00:15:36 SGT 2016]jsonStoreEnabled: false
[Wed Jul 06 00:15:36 SGT 2016]mbeanEnabled: false
[Wed Jul 06 00:15:36 SGT 2016]userStreamRepliesAllEnabled: false
[Wed Jul 06 00:15:36 SGT 2016]userStreamWithFollowingsEnabled: true
[Wed Jul 06 00:15:36 SGT 2016]stallWarningsEnabled: true
[Wed Jul 06 00:15:36 SGT 2016]applicationOnlyAuthEnabled: false
[Wed Jul 06 00:15:36 SGT 2016]mediaProvider: TWITTER
[Wed Jul 06 00:15:36 SGT 2016]mediaProviderAPIKey: null
[Wed Jul 06 00:15:36 SGT 2016]mediaProviderParameters: null
[Wed Jul 06 00:15:36 SGT 2016]daemonEnabled: true
[Wed Jul 06 00:15:36 SGT 2016]instances: [ConfigurationBase{debug=true, user='null', password='null', httpConf=MyHttpClientConfiguration{httpProxyHost='null', httpProxyUser='null', httpProxyPassword='null', httpProxyPort=-1, httpConnectionTimeout=20000, httpReadTimeout=120000, prettyDebug=false, gzipEnabled=true}, httpStreamingReadTimeout=40000, httpRetryCount=0, httpRetryIntervalSeconds=5, oAuthConsumerKey='zptB1VLNbNguInk3HqKHvc55H', oAuthConsumerSecret='8lyjsT2PsIkG5Ada5axh5k7H8B9lOQM67jizv90tSlasrOGun6', oAuthAccessToken='2550568801-AgwQ31S2DgJ6lyVrZSlMPqBEweTnFk4fn17BLH1', oAuthAccessTokenSecret='3yKlKp6fWvuzAQkgthZbXCB5aMOt3vg1nrVlgQDh9atJV', oAuth2TokenType='null', oAuth2AccessToken='null', oAuth2Scope='null', oAuthRequestTokenURL='https://api.twitter.com/oauth/request_token', oAuthAuthorizationURL='https://api.twitter.com/oauth/authorize', oAuthAccessTokenURL='https://api.twitter.com/oauth/access_token', oAuthAuthenticationURL='https://api.twitter.com/oauth/authenticate', oAuth2TokenURL='https://api.twitter.com/oauth2/token', oAuth2InvalidateTokenURL='https://api.twitter.com/oauth2/invalidate_token', restBaseURL='https://api.twitter.com/1.1/', uploadBaseURL='https://upload.twitter.com/1.1/', streamBaseURL='https://stream.twitter.com/1.1/', userStreamBaseURL='https://userstream.twitter.com/1.1/', siteStreamBaseURL='https://sitestream.twitter.com/1.1/', dispatcherImpl='twitter4j.DispatcherImpl', asyncNumThreads=1, loggerFactory='null', contributingTo=-1, includeMyRetweetEnabled=true, includeEntitiesEnabled=true, trimUserEnabled=false, jsonStoreEnabled=false, mbeanEnabled=false, userStreamRepliesAllEnabled=false, userStreamWithFollowingsEnabled=true, stallWarningsEnabled=true, applicationOnlyAuthEnabled=false, mediaProvider='TWITTER', mediaProviderAPIKey='null', mediaProviderParameters=null, daemonEnabled=true}]
[Wed Jul 06 00:15:36 SGT 2016]Establishing connection.
[Wed Jul 06 00:15:36 SGT 2016]Twitter Stream consumer-1[Establishing connection]
[Wed Jul 06 00:15:37 SGT 2016]Request: 
[Wed Jul 06 00:15:37 SGT 2016]POST https://stream.twitter.com/1.1/statuses/filter.json
[Wed Jul 06 00:15:37 SGT 2016]OAuth base string: POST&https%3A%2F%2Fstream.twitter.com%2F1.1%2Fstatuses%2Ffilter.json&count%3D0%26oauth_consumer_key%3DzptB1VLNbNguInk3HqKHvc55H%26oauth_nonce%3D749948799%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1467735337%26oauth_token%3D2550568801-AgwQ31S2DgJ6lyVrZSlMPqBEweTnFk4fn17BLH1%26oauth_version%3D1.0%26stall_warnings%3Dtrue%26track%3DSingapore
[Wed Jul 06 00:15:37 SGT 2016]OAuth signature: g9tQwPICKe2EsuZ2EPJ2Mv4AblE=
[Wed Jul 06 00:15:37 SGT 2016]Authorization: **********************************************************************************************************************************************************************************************************************************************************************************
[Wed Jul 06 00:15:37 SGT 2016]X-Twitter-Client-Version: 4.0.4
[Wed Jul 06 00:15:37 SGT 2016]X-Twitter-Client-URL: http://twitter4j.org/en/twitter4j-4.0.4.xml
[Wed Jul 06 00:15:37 SGT 2016]X-Twitter-Client: Twitter4J
[Wed Jul 06 00:15:37 SGT 2016]User-Agent: twitter4j http://twitter4j.org/ /4.0.4
[Wed Jul 06 00:15:37 SGT 2016]Connection: close
[Wed Jul 06 00:15:37 SGT 2016]Accept-Encoding: gzip
[Wed Jul 06 00:15:37 SGT 2016]Post Params: count=0&track=Singapore&stall_warnings=true
[Wed Jul 06 00:15:41 SGT 2016]Response: 
[Wed Jul 06 00:15:41 SGT 2016]date: Tue, 05 Jul 2016 16:15:38 GMT
[Wed Jul 06 00:15:41 SGT 2016]HTTP/1.1 200 OK
[Wed Jul 06 00:15:41 SGT 2016]server: tsa
[Wed Jul 06 00:15:41 SGT 2016]transfer-encoding: chunked
[Wed Jul 06 00:15:41 SGT 2016]x-connection-hash: e3e1c8a44e63290ee879f576ba038d89
[Wed Jul 06 00:15:41 SGT 2016]content-type: application/json
[Wed Jul 06 00:15:41 SGT 2016]connection: close
[Wed Jul 06 00:15:41 SGT 2016]content-Encoding: gzip
[Wed Jul 06 00:15:41 SGT 2016]Connection established.
[Wed Jul 06 00:15:41 SGT 2016]Receiving status stream.
[Wed Jul 06 00:15:41 SGT 2016]Twitter Stream consumer-1[Receiving stream]
[Wed Jul 06 00:15:42 SGT 2016]Received:{"extended_entities":{"media":[{"display_url":"pic.twitter.com/JIj8bGhdQG","source_user_id":1011604327,"type":"video","media_url":"http://pbs.twimg.com/ext_tw_video_thumb/747254503640948736/pu/img/Rgn5TCJHfPTmvias.jpg","source_status_id":747254708255940609,"url":"","indices":[109,132],"sizes":{"small":{"w":340,"h":604,"resize":"fit"},"large":{"w":360,"h":640,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"medium":{"w":360,"h":640,"resize":"fit"}},"id_str":"747254503640948736","expanded_url":"http://twitter.com/missgerrard/status/747254708255940609/video/1","source_status_id_str":"747254708255940609","media_url_https":"https://pbs.twimg.com/ext_tw_video_thumb/747254503640948736/pu/img/Rgn5TCJHfPTmvias.jpg","id":747254503640948736,"source_user_id_str":"1011604327","video_info":{"aspect_ratio":[9,16],"duration_millis":18467,"variants":[{"content_type":"video/mp4","bitrate":320000,"url":"https://video.twimg.com/ext_tw_video/747254503640948736/pu/vid/180x320/QZlqdGzyH822t3ap.mp4"},{"content_type":"application/dash+xml","url":"https://video.twimg.com/ext_tw_video/747254503640948736/pu/pl/M--8lK60Ire7nnAU.mpd"},{"content_type":"application/x-mpegURL","url":"https://video.twimg.com/ext_tw_video/747254503640948736/pu/pl/M--8lK60Ire7nnAU.m3u8"},{"content_type":"video/mp4","bitrate":832000,"url":"https://video.twimg.com/ext_tw_video/747254503640948736/pu/vid/360x640/-v1mnPdAGvM0EYbH.mp4"}]}}]},"in_reply_to_status_id_str":null,"in_reply_to_status_id":null,"created_at":"Tue Jul 05 16:15:41 +0000 2016","in_reply_to_user_id_str":null,"source":"<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone<\/a>","retweeted_status":{"extended_entities":{"media":[{"display_url":"pic.twitter.com/JIj8bGhdQG","indices":[92,115],"sizes":{"small":{"w":340,"h":604,"resize":"fit"},"large":{"w":360,"h":640,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"medium":{"w":360,"h":640,"resize":"fit"}},"id_str":"747254503640948736","expanded_url":"http://twitter.com/missgerrard/status/747254708255940609/video/1","media_url_https":"https://pbs.twimg.com/ext_tw_video_thumb/747254503640948736/pu/img/Rgn5TCJHfPTmvias.jpg","id":747254503640948736,"type":"video","media_url":"http://pbs.twimg.com/ext_tw_video_thumb/747254503640948736/pu/img/Rgn5TCJHfPTmvias.jpg","url":"/JIj8bGhdQG","video_info":{"aspect_ratio":[9,16],"duration_millis":18467,"variants":[{"content_type":"video/mp4","bitrate":320000,"url":"https://video.twimg.com/ext_tw_video/747254503640948736/pu/vid/180x320/QZlqdGzyH822t3ap.mp4"},{"content_type":"application/dash+xml","url":"https://video.twimg.com/ext_tw_video/747254503640948736/pu/pl/M--8lK60Ire7nnAU.mpd"},{"content_type":"application/x-mpegURL","url":"https://video.twimg.com/ext_tw_video/747254503640948736/pu/pl/M--8lK60Ire7nnAU.m3u8"},{"content_type":"video/mp4","bitrate":832000,"url":"https://video.twimg.com/ext_tw_video/747254503640948736/pu/vid/360x640/-v1mnPdAGvM0EYbH.mp4"}]}}]},"in_reply_to_status_id_str":null,"in_reply_to_status_id":null,"created_at":"Mon Jun 27 02:26:20 +0000 2016","in_reply_to_user_id_str":null,"source":"<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android<\/a>","retweet_count":19,"retweeted":false,"geo":null,"filter_level":"low","in_reply_to_screen_name":null,"is_quote_status":false,"id_str":"747254708255940609","in_reply_to_user_id":null,"favorite_count":25,"id":747254708255940609,"text":"Yeay cant wait to see u in singapore Alif Satar 23rd July #diasemanishoney @DiaSemanisHoney https://////JIj8bGhdQG","place":null,"lang":"en","favorited":false,"possibly_sensitive":false,"coordinates":null,"truncated":false,"entities":{"urls":[],"hashtags":[{"indices":[58,74],"text":"diasemanishoney"}],"media":
@ita891210 - RT @Hyukkiss: 130706 SS5 Singapore #WaitingforEunHae https://////9hViCuSA9U

Solution

  • From twitter4j geo streaming latitude/longitude for Hongkong, it seems like it's because I'm using the locations wrongly, if I use the locations from this link https://dev.twitter.com/docs/streaming-apis/parameters#locations, the streaming works fine, e.g.

    java -cp .:twitter4j-core-4.0.4.jar:twitter4j-media-support-4.0.4.jar:twitter4j-async-4.0.4.jar:twitter4j-examples-4.0.4.jar:twitter4j-stream-4.0.4.jar PrintFilterLocationStream "{{-126.562500,30.448674},{-61.171875,44.087585}}"

    [out]:

    [Wed Jul 06 05:27:05 SGT 2016]serialVersionUID: 6175546394599249696
    [Wed Jul 06 05:27:05 SGT 2016]debug: true
    [Wed Jul 06 05:27:05 SGT 2016]user: null
    [Wed Jul 06 05:27:05 SGT 2016]password: null
    [Wed Jul 06 05:27:05 SGT 2016]httpConf: MyHttpClientConfiguration{httpProxyHost='null', httpProxyUser='null', httpProxyPassword='null', httpProxyPort=-1, httpConnectionT
    imeout=20000, httpReadTimeout=120000, prettyDebug=false, gzipEnabled=true}
    [Wed Jul 06 05:27:05 SGT 2016]httpStreamingReadTimeout: 40000
    [Wed Jul 06 05:27:05 SGT 2016]httpRetryCount: 0
    [Wed Jul 06 05:27:05 SGT 2016]httpRetryIntervalSeconds: 5
    [Wed Jul 06 05:27:05 SGT 2016]oAuthConsumerKey: zptB1VLNbNguInk3HqKHvc55H
    [Wed Jul 06 05:27:05 SGT 2016]oAuthConsumerSecret: **************************************************
    [Wed Jul 06 05:27:05 SGT 2016]oAuthAccessToken: 2550568801-AgwQ31S2DgJ6lyVrZSlMPqBEweTnFk4fn17BLH1
    [Wed Jul 06 05:27:05 SGT 2016]oAuthAccessTokenSecret: *********************************************
    [Wed Jul 06 05:27:05 SGT 2016]oAuth2TokenType: null
    [Wed Jul 06 05:27:05 SGT 2016]oAuth2AccessToken: null
    [Wed Jul 06 05:27:05 SGT 2016]oAuth2Scope: null
    [Wed Jul 06 05:27:05 SGT 2016]oAuthRequestTokenURL: https://api.twitter.com/oauth/request_token
    [Wed Jul 06 05:27:05 SGT 2016]oAuthAuthorizationURL: https://api.twitter.com/oauth/authorize
    [Wed Jul 06 05:27:05 SGT 2016]oAuthAccessTokenURL: https://api.twitter.com/oauth/access_token
    [Wed Jul 06 05:27:05 SGT 2016]oAuthAuthenticationURL: https://api.twitter.com/oauth/authenticate
    [Wed Jul 06 05:27:05 SGT 2016]oAuth2TokenURL: https://api.twitter.com/oauth2/token
    [Wed Jul 06 05:27:05 SGT 2016]oAuth2InvalidateTokenURL: https://api.twitter.com/oauth2/invalidate_token
    [Wed Jul 06 05:27:05 SGT 2016]restBaseURL: https://api.twitter.com/1.1/
    [Wed Jul 06 05:27:05 SGT 2016]streamBaseURL: https://stream.twitter.com/1.1/
    [Wed Jul 06 05:27:05 SGT 2016]userStreamBaseURL: https://userstream.twitter.com/1.1/
    [Wed Jul 06 05:27:05 SGT 2016]siteStreamBaseURL: https://sitestream.twitter.com/1.1/
    [Wed Jul 06 05:27:05 SGT 2016]uploadBaseURL: https://upload.twitter.com/1.1/
    [Wed Jul 06 05:27:05 SGT 2016]dispatcherImpl: twitter4j.DispatcherImpl
    [Wed Jul 06 05:27:05 SGT 2016]asyncNumThreads: 1
    [Wed Jul 06 05:27:05 SGT 2016]loggerFactory: null
    [Wed Jul 06 05:27:05 SGT 2016]contributingTo: -1
    [Wed Jul 06 05:27:05 SGT 2016]includeMyRetweetEnabled: true
    [Wed Jul 06 05:27:05 SGT 2016]includeEntitiesEnabled: true
    [Wed Jul 06 05:27:05 SGT 2016]trimUserEnabled: false
    [Wed Jul 06 05:27:05 SGT 2016]jsonStoreEnabled: false
    [Wed Jul 06 05:27:05 SGT 2016]mbeanEnabled: false
    [Wed Jul 06 05:27:05 SGT 2016]userStreamRepliesAllEnabled: false
    [Wed Jul 06 05:27:05 SGT 2016]userStreamWithFollowingsEnabled: true
    [Wed Jul 06 05:27:05 SGT 2016]stallWarningsEnabled: true
    [Wed Jul 06 05:27:05 SGT 2016]applicationOnlyAuthEnabled: false
    [Wed Jul 06 05:27:05 SGT 2016]mediaProvider: TWITTER
    [Wed Jul 06 05:27:05 SGT 2016]mediaProviderAPIKey: null
    [Wed Jul 06 05:27:05 SGT 2016]mediaProviderParameters: null
    [Wed Jul 06 05:27:05 SGT 2016]daemonEnabled: true
    [Wed Jul 06 05:27:05 SGT 2016]instances: [ConfigurationBase{debug=true, user='null', password='null', httpConf=MyHttpClientConfiguration{httpProxyHost='null', httpProxyU
    ser='null', httpProxyPassword='null', httpProxyPort=-1, httpConnectionTimeout=20000, httpReadTimeout=120000, prettyDebug=false, gzipEnabled=true}, httpStreamingReadTimeo
    ut=40000, httpRetryCount=0, httpRetryIntervalSeconds=5, oAuthConsumerKey='zptB1VLNbNguInk3HqKHvc55H', oAuthConsumerSecret='8lyjsT2PsIkG5Ada5axh5k7H8B9lOQM67jizv90tSlasrO
    Gun6', oAuthAccessToken='2550568801-AgwQ31S2DgJ6lyVrZSlMPqBEweTnFk4fn17BLH1', oAuthAccessTokenSecret='3yKlKp6fWvuzAQkgthZbXCB5aMOt3vg1nrVlgQDh9atJV', oAuth2TokenType='null', oAuth2AccessToken='null', oAuth2Scope='null', oAuthRequestTokenURL='https://api.twitter.com/oauth/request_token', oAuthAuthorizationURL='https://api.twitter.com/oauth/authorize', oAuthAccessTokenURL='https://api.twitter.com/oauth/access_token', oAuthAuthenticationURL='https://api.twitter.com/oauth/authenticate', oAuth2TokenURL='https://api.twitter.com/oauth2/token', oAuth2InvalidateTokenURL='https://api.twitter.com/oauth2/invalidate_token', restBaseURL='https://api.twitter.com/1.1/', uploadBaseURL='https://upload.twitter.com/1.1/', streamBaseURL='https://stream.twitter.com/1.1/', userStreamBaseURL='https://userstream.twitter.com/1.1/', siteStreamBaseURL='https://sitestream.twitter.com/1.1/', dispatcherImpl='twitter4j.DispatcherImpl', asyncNumThreads=1, loggerFactory='null', contributingTo=-1, includeMyRetweetEnabled=true, includeEntitiesEnabled=true, trimUserEnabled=false, jsonStoreEnabled=false, mbeanEnabled=false, userStreamRepliesAllEnabled=false, userStreamWithFollowingsEnabled=true, stallWarningsEnabled=true, applicationOnlyAuthEnabled=false, mediaProvider='TWITTER', mediaProviderAPIKey='null', mediaProviderParameters=null, daemonEnabled=true}]
    [Wed Jul 06 05:27:06 SGT 2016]Establishing connection.
    [Wed Jul 06 05:27:06 SGT 2016]Twitter Stream consumer-1[Establishing connection]
    [Wed Jul 06 05:27:06 SGT 2016]Request: 
    [Wed Jul 06 05:27:06 SGT 2016]POST https://stream.twitter.com/1.1/statuses/filter.json
    [Wed Jul 06 05:27:06 SGT 2016]OAuth base string: POST&https%3A%2F%2Fstream.twitter.com%2F1.1%2Fstatuses%2Ffilter.json&count%3D0%26locations%3D-126.5625%252C30.448674%252C-61.171875%252C44.087585%26oauth_consumer_key%3DzptB1VLNbNguInk3HqKHvc55H%26oauth_nonce%3D2467567040%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1467754026%26oauth_token%3D2550568801-AgwQ31S2DgJ6lyVrZSlMPqBEweTnFk4fn17BLH1%26oauth_version%3D1.0%26stall_warnings%3Dtrue
    [Wed Jul 06 05:27:06 SGT 2016]OAuth signature: ccZ0rsHRmt8VMvUzlzZ43QVdSvw=
    [Wed Jul 06 05:27:06 SGT 2016]Authorization: ***********************************************************************************************************************************************************************************************************************************************************************************
    [Wed Jul 06 05:27:06 SGT 2016]X-Twitter-Client-Version: 4.0.4
    [Wed Jul 06 05:27:06 SGT 2016]X-Twitter-Client-URL: http://twitter4j.org/en/twitter4j-4.0.4.xml
    [Wed Jul 06 05:27:06 SGT 2016]X-Twitter-Client: Twitter4J
    [Wed Jul 06 05:27:06 SGT 2016]User-Agent: twitter4j http://twitter4j.org/ /4.0.4
    [Wed Jul 06 05:27:06 SGT 2016]Connection: close
    [Wed Jul 06 05:27:06 SGT 2016]Accept-Encoding: gzip
    [Wed Jul 06 05:27:06 SGT 2016]Post Params: count=0&locations=-126.5625%2C30.448674%2C-61.171875%2C44.087585&stall_warnings=true
    [Wed Jul 06 05:27:07 SGT 2016]Response: 
    [Wed Jul 06 05:27:07 SGT 2016]date: Tue, 05 Jul 2016 21:27:07 GMT
    [Wed Jul 06 05:27:07 SGT 2016]HTTP/1.1 200 OK
    [Wed Jul 06 05:27:07 SGT 2016]server: tsa
    [Wed Jul 06 05:27:07 SGT 2016]transfer-encoding: chunked
    [Wed Jul 06 05:27:07 SGT 2016]x-connection-hash: 129d77a68486c304b7ff69e8c08b1102
    [Wed Jul 06 05:27:07 SGT 2016]content-type: application/json
    [Wed Jul 06 05:27:07 SGT 2016]connection: close
    [Wed Jul 06 05:27:07 SGT 2016]content-Encoding: gzip
    [Wed Jul 06 05:27:07 SGT 2016]Connection established.
    [Wed Jul 06 05:27:07 SGT 2016]Receiving status stream.
    [Wed Jul 06 05:27:07 SGT 2016]Twitter Stream consumer-1[Receiving stream]
    [Wed Jul 06 05:27:07 SGT 2016]Received:{"in_reply_to_status_id_str":null,"in_reply_to_status_id":null,"created_at":"Tue Jul 05 21:27:07 +0000 2016","in_reply_to_user_id_str":null,"source":"<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone<\/a>","retweet_count":0,"retweeted":false,"geo":null,"filter_level":"low","in_reply_to_screen_name":null,"is_quote_status":false,"id_str":"750440897813155841","in_reply_to_user_id":null,"favorite_count":0,"id":750440897813155841,"text":"so annoyed","place":{"country_code":"US","country":"United States","full_name":"San Diego, CA","bounding_box":{"coordinates":[[[-117.282538,32.53962],[-117.282538,33.080404],[-116.92744,33.080404],[-116.92744,32.53962]]],"type":"Polygon"},"place_type":"city","name":"San Diego","attributes":{},"id":"a592bd6ceb1319f7","url":"https://api.twitter.com/1.1/geo/id/a592bd6ceb1319f7.json"},"lang":"en","favorited":false,"coordinates":null,"truncated":false,"timestamp_ms":"1467754027213","entities":{"urls":[],"hashtags":[],"user_mentions":[],"symbols":[]},"contributors":null,"user":{"utc_offset":-25200,"friends_count":406,"profile_image_url_https":"https://pbs.twimg.com/profile_images/750239874121293824/ncD2YISf_normal.jpg","listed_count":5,"profile_background_image_url":"http://abs.twimg.com/images/themes/theme1/bg.png","default_profile_image":false,"favourites_count":19080,"description":"im an angel","created_at":"Sat Sep 22 01:37:35 +0000 2012","is_translator":false,"profile_background_image_url_https":"https://abs.twimg.com/images/themes/theme1/bg.png","protected":false,"screen_name":"kayexcamille","id_str":"838869294","profile_link_color":"ABB8C2","id":838869294,"geo_enabled":true,"profile_background_color":"000000","lang":"en","profile_sidebar_border_color":"000000","profile_text_color":"000000","verified":false,"profile_image_url":"http://pbs.twimg.com/profile_images/750239874121293824/ncD2YISf_normal.jpg","time_zone":"Arizona","url":null,"contributors_enabled":false,"profile_background_tile":false,"profile_banner_url":"https://pbs.twimg.com/profile_banners/838869294/1467133604","statuses_count":22577,"follow_request_sent":null,"followers_count":787,"profile_use_background_image":false,"default_profile":false,"following":null,"name":"k","location":"San Diego, CA","profile_sidebar_fill_color":"000000","notifications":null}}
    @kayexcamille - so annoyed