Coder Social home page Coder Social logo

spring-attic / spring-social-twitter Goto Github PK

View Code? Open in Web Editor NEW
122.0 122.0 114.0 6.41 MB

Twitter API binding and connect support.

Home Page: http://projects.spring.io/spring-social-twitter

License: Apache License 2.0

Java 93.46% CSS 1.51% XSLT 4.79% HTML 0.24%

spring-social-twitter's Introduction

spring-social-twitter is no longer actively maintained by VMware, Inc.

spring-social-twitter's People

Contributors

habuma avatar jdappel avatar kmohanarangam avatar ptamarit avatar rostykerei avatar royclarkson avatar spring-builds avatar spring-operator avatar straxus avatar tquellenberg avatar trajar avatar trevormarshall avatar wilkinsona avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-social-twitter's Issues

Twitter class is not serializable

Facebook class is serializable , but Twitter is not

javax.ejb.EJBTransactionRolledbackException: WELD-000053: Producers cannot declare passivating scope and return a non-serializable class: Producer for Producer Method [Twitter] with qualifiers [@Any @default] declared as [[BackedAnnotatedMethod] @produces @SessionScoped public com.coheris.social.twitter.TwitterConnectionProducer.connect()] declared on Managed Bean [class com.coheris.social.twitter.TwitterConnectionProducer] with qualifiers [@Any @default]

Getting invalid source release: 1.7 Error

Hi,

I am getting

Caused by: java.lang.IllegalArgumentException: invalid source release: 1.7
at com.sun.tools.javac.main.RecognizedOptions$GrumpyHelper.error(RecognizedOptions.java:75)
at com.sun.tools.javac.main.RecognizedOptions$13.process(RecognizedOptions.java:370)
at com.sun.tools.javac.api.JavacTool.processOptions(JavacTool.java:247)
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:207)

While building using ./gradlew build

Twitter has new set of REST URLs

Guys,
Twitter has a new set of URLs. Also, the REST API (headers, body, etc) might have changed.
For example, for posting direct message, this is the REST call to be made. https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-event

And unfortunately, even the latest code of spring-social-twitter continues to use the old URLs atleast for posting a direct message. https://github.com/spring-projects/spring-social-twitter/blob/master/spring-social-twitter/src/main/java/org/springframework/social/twitter/api/impl/DirectMessageTemplate.java#L85. The URL eventually used by this SDK is "https://api.twitter.com/1.1/direct_messages/new.json" when it had to be "https://api.twitter.com/1.1/direct_messages/events/new.json".

Are you guys planning to update your SDK to be in sync with latest twitter REST API?

Unable to see error response from Twitter

timelineOperations().updateStatus(..) throws:

org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://api.twitter.com/1.1/statuses/update.json": cannot retry due to server authentication, in streaming mode; nested exception is java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode

How to see twitter response?

TweetData.toRequestParameters behaves differently in 1.1.1+ vs 1.1.0

This commit removed the media request parameter from the map generated by TweetData.toRequestParameters in favour of using the new toUploadMediaParameters method. This change will break any users of Spring Social Twitter that were reliant on the media request parameter being present. One such client is Spring Integration which had to make some changes to allow them to adopt the new version.

To persevere backwards compatibility, can you please consider reinstating the old behaviour for toRequestParameters and introducing a new method that omits the media request parameter for use when calling Twitter's new API endpoint?

Failed resolution of HttpClientContext

I opened an issue on the sample projects but now I realize that here may be a better place to fill it.

Here is a reference to it : spring-attic/spring-android-samples#13

Hi guys,

I'm working on integrating an API in an Android application and I want to use the framework provided by Spring for Android/Spring Social to do so.

I used the spring-android-twitter-client as an example to get my things up and running. The problem is that the my application must be able to get an access token based on the consumer key and consumer secret with a grant_type=client_credentials (http://tools.ietf.org/html/rfc6749#section-4.4).

This feature is available in the newest version of the spring-social-core (1.0.0.RELEASE) but it's not in the version used in the Twitter guide. So I did what I add to do and updated my application dependencies but I ran in a problem.

The newest version of the spring-social-core uses new features from the org.apache.httpclient librairies. I reproduced the error in your Twitter sample simply by updating the dependencies, When I run the application and try to connect to my account, I get the following runtime error:

01-13 14:33:27.941  24112-24178/org.springframework.android.twitterclient E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #1
    Process: org.springframework.android.twitterclient, PID: 24112
    java.lang.RuntimeException: An error occured while executing doInBackground()
            at android.os.AsyncTask$3.done(AsyncTask.java:300)
            at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
            at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
            at java.util.concurrent.FutureTask.run(FutureTask.java:242)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:818)
     Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/client/protocol/HttpClientContext;
            at org.springframework.social.support.ClientHttpRequestFactorySelector$HttpComponentsClientRequestFactoryCreator$1.createHttpContext(ClientHttpRequestFactorySelector.java:80)
            at org.springframework.http.client.HttpComponentsClientHttpRequestFactory.createRequest(HttpComponentsClientHttpRequestFactory.java:133)
            at org.springframework.http.client.support.HttpAccessor.createRequest(HttpAccessor.java:84)
            at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:472)
            at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:453)
            at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:429)
            at org.springframework.social.oauth1.OAuth1Template.exchangeForToken(OAuth1Template.java:187)
            at org.springframework.social.oauth1.OAuth1Template.fetchRequestToken(OAuth1Template.java:115)
            at org.springframework.android.twitterclient.TwitterWebOAuthActivity$TwitterPreConnectTask.doInBackground(TwitterWebOAuthActivity.java:136)
            at org.springframework.android.twitterclient.TwitterWebOAuthActivity$TwitterPreConnectTask.doInBackground(TwitterWebOAuthActivity.java:126)
            at android.os.AsyncTask$2.call(AsyncTask.java:288)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:818)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.client.protocol.HttpClientContext" on path: DexPathList[[zip file "/data/app/org.springframework.android.twitterclient-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
            at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
            at org.springframework.social.support.ClientHttpRequestFactorySelector$HttpComponentsClientRequestFactoryCreator$1.createHttpContext(ClientHttpRequestFactorySelector.java:80)
            at org.springframework.http.client.HttpComponentsClientHttpRequestFactory.createRequest(HttpComponentsClientHttpRequestFactory.java:133)
            at org.springframework.http.client.support.HttpAccessor.createRequest(HttpAccessor.java:84)
            at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:472)
            at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:453)
            at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:429)
            at org.springframework.social.oauth1.OAuth1Template.exchangeForToken(OAuth1Template.java:187)
            at org.springframework.social.oauth1.OAuth1Template.fetchRequestToken(OAuth1Template.java:115)
            at org.springframework.android.twitterclient.TwitterWebOAuthActivity$TwitterPreConnectTask.doInBackground(TwitterWebOAuthActivity.java:136)
            at org.springframework.android.twitterclient.TwitterWebOAuthActivity$TwitterPreConnectTask.doInBackground(TwitterWebOAuthActivity.java:126)
            at android.os.AsyncTask$2.call(AsyncTask.java:288)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:818)
    Suppressed: java.lang.ClassNotFoundException: org.apache.http.client.protocol.HttpClientContext
            at java.lang.Class.classForName(Native Method)
            at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
            at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
            ... 17 more
     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

The problem seems to be caused by the httpclient version that is shipped with Android which is older than the one required. If I try to add the dependencies of the HttpClient port for Android in my build, Gradle seems to exclude it to avoid conflict.

I'm on Linux, I use Android Studio 1.0.1 and I open Android projects with Gradle. What can be done?

Adding support for extended mode

On September 26, 2017, Twitter announced an experiment enabling Tweets with more characters. These Tweets are encoded in JSON as an extended Tweet.

There are two modes for rendering Tweet JSON objects to API clients: compatibility mode and extended mode. Compatibility mode is the default mode for the standard REST and Streaming APIs and Gnip products, and is designed to not break existing clients.

Now the compatibility mode is the default where text field is truncated to 140, truncated field is true and entities only include those which are in the available 140 text range.

Example:

Hey #jvmcon! Save 40% on #JVM, #java9, #modules, #springboot, #scala, and other books and videos with code ctwjvmco… https://twitter.com/i/web/status/958339020542525441

Tweet is truncated at the 140th character and a link is included at the end in order to be able to see the Tweet in its full length.

In extended mode Tweet payload contains all information to render Tweets that contain more than 140 characters when tweet_mode=extended parameter is added to any REST endpoint. In this case full_text replaces text, truncated field is false and display_text_range delineates different sections of body for mentions/tweets/entities.

Example:

Hey #jvmcon! Save 40% on #JVM, #java9, #modules, #springboot, #scala, and other books and videos with code ctwjvmcon18 at http://manning.com #manningbooks

In the future, an additional announcement will be made when the time is right to make a change for the rendering mode to default to extended mode.

I'm working on a Social Media automation app and with the current release of spring-social-twitter, extended Tweets cannot be processed properly.

I'd gladly contribute support for extended tweets and get rid of my nasty workarounds.


Reference: Tweet Updates

Stream from Streaming API cannot be closed

Each time when I try to close Stream I have the following exception

Exception in thread "Thread-11" java.lang.NullPointerException: Inflater has been closed
at java.util.zip.Inflater.ensureOpen(Inflater.java:389)
at java.util.zip.Inflater.inflate(Inflater.java:257)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:152)
at java.util.zip.GZIPInputStream.read(GZIPInputStream.java:117)
at org.apache.http.client.entity.LazyDecompressingInputStream.read(LazyDecompressingInputStream.java:73)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.BufferedReader.fill(BufferedReader.java:161)
at java.io.BufferedReader.readLine(BufferedReader.java:324)
at java.io.BufferedReader.readLine(BufferedReader.java:389)
at org.springframework.social.twitter.api.impl.StreamReaderImpl.next(StreamReaderImpl.java:59)
at org.springframework.social.twitter.api.impl.ThreadedStreamConsumer.run(ThreadedStreamConsumer.java:44)

Callback url problem after Twitter API update

There were some changes to Twitter API recently, and as a result an attempt to login with Twitter fails.

code=415 Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings

Even though there are valid urls set in twitter app settings page, 403 is returned.
Is this issue addressed already in any way?

https://twittercommunity.com/t/action-required-sign-in-with-twitter-users-must-whitelist-callback-urls/105342

Unable to run

When I click "Connect to twitter" the address just get refreshed with "jssesionid" appended in the url. It is not going to next page. What should I do?

Video Upload - Media type unrecognized

When trying uploading video to twitter, it always failes with
ERROR: 400 :: media type unrecognized.
org.springframework.web.client.HttpClientErrorException: 400 Bad Request

Code:

TweetData tweetData = new TweetData("Video").withMedia(loadAsResource("small.mp4"));
twitter.timelineOperations().updateStatus(tweetData);

I tried multiple files and all of them were working when I uploaded them directly on twitter. I also tested it on 2.0.0M2 but it's not working on it either.

Twitter user ID is too large for JS serialization to be a long number

Hey guys,

First, thanks for the awesome twitter integration package, it's been of great value!
I don't why you decided to use the Twitter user ID as a long number rather than store it in a String. I know it takes less space but if you are not going to make math operations with it and the ID comes from a third party service - then it does make sense to me to wrap the ID in a String, not a Long (and even if you want to compare it to other ID values, string might do it as well).

The problem is - the user ID for my handle @veliko_test1 is 701711162086449152 which is a valid long number in Java, but when returned as JSON to the frontend, the value is approximated by the JS JSON parser to a different value.

To reproduce, just open up a JS parser, preferably the browser console and type:

var number = 701711162086449152;
number

If it makes sense, can you please use String objects for the Twitter user ID instead of longs?

Thanks!

P.S. If you think it's more appropriate for me to make a pull request with the fix, I would happily do so.

Revert breaking API change made in 1.1.1.RELEASE

This commit has made a breaking change to the constructor of Tweet; it's added a new String parameter. As things stand, the tests for Spring Integration's Twitter support fail when run as part of the Spring IO Platform build which runs the tests against Spring Social Twitter 1.1.1.RELEASE.

Can you please reinstate the old constructor so that backwards compatibility isn't broken?

/cc @garyrussell @artembilan

Could not authenticate you. with spring 5.1.5.RELEASE

The exception stack is following.

Could not authenticate you.
org.springframework.social.MissingAuthorizationException: Authorization is required for the operation, but the API binding was created without authorization.
at org.springframework.social.twitter.api.impl.TwitterErrorHandler.handleClientErrors(TwitterErrorHandler.java:100)
at org.springframework.social.twitter.api.impl.TwitterErrorHandler.handleError(TwitterErrorHandler.java:60)
at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:778)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:736)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:710)
at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:436)
at org.springframework.social.twitter.api.impl.TimelineTemplate.updateStatus(TimelineTemplate.java:198)
at org.springframework.social.twitter.api.impl.TimelineTemplate.updateStatus(TimelineTemplate.java:160)
at cn.nextop.erebor.batch.job.social.twitter.AbstractTwitterTasklet.post(AbstractTwitterTasklet.java:21)
at cn.nextop.erebor.batch.job.social.twitter.TwitterIndicatorTasklet.issue(TwitterIndicatorTasklet.java:167)
at cn.nextop.erebor.batch.job.social.twitter.TwitterIndicatorTasklet.doExecute(TwitterIndicatorTasklet.java:114)
at cn.nextop.erebor.core.batch.domain.spring.BatchTasklet.execute(BatchTasklet.java:206)
at org.springframework.batch.core.step.tasklet.TaskletStepChunkTransactionCallback.doInTransaction(TaskletStep.java:407)
at org.springframework.batch.core.step.tasklet.TaskletStepChunkTransactionCallback.doInTransaction(TaskletStep.java:331)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
at org.springframework.batch.core.step.tasklet.TaskletStep2.doInChunkContext(TaskletStep.java:273)
at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:82)
at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:375)
at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)
at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:145)
at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:258)
at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:203)
at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148)
at org.springframework.batch.core.job.AbstractJob.handleStep(AbstractJob.java:399)
at org.springframework.batch.core.job.SimpleJob.doExecute(SimpleJob.java:135)
at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:313)
at org.springframework.batch.core.launch.support.SimpleJobLauncher1.run(SimpleJobLauncher.java:144)
at java.util.concurrent.ExecutorsRunnableAdapter.call(Executors.java:511)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at cn.nextop.erebor.common.util.concurrent.future.impl.XRunnableFuture.run(XRunnableFuture.java:62)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

the related issue please refer to spring-social-core issue 317

Adding support for Twitter collection operations

I'm developing an application with spring-social-twitter and noticed that there were no API binding for Twitter's collection API.

A collection is an editable group of Tweets hand-selected by a Twitter user or programmatically managed via collection APIs. Each collection is public and has its own page on twitter.com, making it easy to share and embed in your website and apps.

I looked into every descendant of AbstractTwitterOperations, but haven't found anything which would make HTTP requests to the /collections endpoints.

That said, my proposal is that I would add CollectionOperations to org.springframework.social.twitter.api.Twitter and the necessary model classes, (de)serializers and unit tests for this new functionality.

What do you think about this proposition?


Jira: SOCIALTW-87
Reference: Curate a collection of Tweets

Configuration processor is not configured

Because spring-boot-configuration-processor is not configured, no metadata for spring.social.twitter are generated and therefore all those properties show up as unknown in IDEs.

help me... (On September 17th, 2018 we retired the legacy Direct Message endpoints.)

I am sending twitter using this library. But the direct message is a retired endpoint.

Thank you for updating the library.
https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/guides/direct-message-migration

=====================
Direct Message migration guide
On September 17th, 2018 we retired the legacy Direct Message endpoints. If you had been using those endpoints, please make sure to migrate over to the new Direct Message endpoints or the Account Activity API.
Please review this announcment to learn more.

This guide is designed to help you migrate from legacy Direct Message REST APIs to their enhanced replacements which have graduated from beta. Below you will find a summary of the changes, a new features list, and key differences and considerations to help with the transition. The new Direct Message endpoints are available now to all developers. For guidance in migrating from User Streams or Site Streams, see the migration guide to Account Activity API.

favorites ResourceFamily

Method userOperations().getRateLimitStatus cant return rate limit statuses for favorites resource family.

Improve error handling (in TwitterErrorHandler)

The exception (e.g. on bad request 400) that is thrown by the error handler (delegated call to DefaultResponseErrorHandler.handleError()) doesn't contain the response body anymore since the stream has already been consumed by handleClientErrors() before.
I guess that is the reason why there is a strange System.out.println() with the response body, so it's not completely lost.

It would be nice if the System.out could be removed and the thrown exception could contain the response entity.

For testing I used a search request without a query -> "400 :: Query parameters are missing."

Tweet Geo and Place object

The Geo and Place objects are not implemented for a Tweet. For example, when going to /statuses/show/.json for a tweet with a place object. I get that back within the json object, but when using this spring api I don't.

Unable to monitor user by filter()

I need to monitor all the new tweets of a user, however I'm not able to retrieve any tweets :(
Are there any mistakes in my code?

@RequestMapping("twitter/notify")
public String twitterNotify(){
    Twitter twitter = new TwitterTemplate(consumerKey, consumerSecret, accessToken, accessTokenSecret);

    StreamListener listener = new StreamListener() {        
        @Override
        public void onWarning(StreamWarningEvent warningEvent) {
            // TODO Auto-generated method stub
            System.out.println("onWarning");                
        }

        @Override
        public void onTweet(Tweet tweet) {
            // TODO Auto-generated method stub
            System.out.println("Tweet: " + tweet.getFromUser() + " -> " + tweet.getText());
        }

        @Override
        public void onLimit(int numberOfLimitedTweets) {
            // TODO Auto-generated method stub
            System.out.println("onLimit");
        }

        @Override
        public void onDelete(StreamDeleteEvent deleteEvent) {
            // TODO Auto-generated method stub
            System.out.println("onDelete");
        }
    };  
    FilterStreamParameters filterparams = new FilterStreamParameters();
    long myId = twitter.userOperations().getUserProfile("DavideXX92").getId();
    filterparams.follow(myId);
    twitter.streamingOperations().filter(filterparams, Arrays.asList(listener));

    return "request done";
}

Some list operations not correspond to the twitter REST API

  • Method getListMembersInCursor retrieves a list with default number of profiles equal 20, but API can retrieve more according to parameter count.

  • Metod getMembershipsInCursor retrieves a list with default number of profiles equal 20, but API can retrieve more according to parameter count.

  • Method getSubscriptionsInCursor retrieves a list with default number of profiles equal 20, but API can retrieve more according to parameter count.

  • Method getListSubscribers must breaks the results into pages by cursor.

  • No method corresponds to the GET lists/ownerships request

Deprecated update_with_media.json

Guys
Look at : org.springframework.social.twitter.api.impl.TimelineTemplate#updateStatus(org.springframework.social.twitter.api.TweetData)

String uriPath = tweetData.hasMedia()?"statuses/update_with_media.json":"statuses/update.json"; statuses/update_with_media.json is depricated. Also when I try to upload a bigger than Twitter limit (5mb) image the image is uploaded partially, no OpperationPermittedException arises.

Is there anyway to get the extended entities?

I have posted three images in my twitter handle, when I am trying to get the images, but I only get one image using "getMedia()". So I check the twitter rest api 1.1, and in response it shows one image in "media" and other images are in "extended_entities".
Is there any implementation in spring-social-twitter to get the extended entities?

Upgrade Jackson to 2.x

Jackson has moved from 1.x to 2.x a while back - it would make sense to upgrade the latest spring-social-twitter to use the latest Jackson as well.
Thanks.

You can't send Direct Message to a user who allows for messages from anyone

Since 2015 Twitter allows sending messages to any user who checked "Receive Direct Messages from anyone" in profile settings. You can't do that with Spring Social Twitter. If a recipient has this option unchecked, there's the expected exception:
org.springframework.social.twitter.api.InvalidMessageRecipientException: You cannot send messages to users who are not following you.
But with this option checked, there is also an exception:
org.springframework.social.OperationNotPermittedException: You are sending a Direct Message to users that do not follow you.

twitterTemplate.friendOperations().getFriends() method only returns the first 20 friends

twitterTemplate.friendOperations().getFriends() method only returns the first 20 friends yet the documentation states that it returns up to 5000. The error is caused by the underlying Twitter API, the endpoint that the method calls only returns the first 20 friends. I'm unsure if the Twitter API changed and this method was not updated or if this was an oversight. I understand how to change the getFriends() method to correctly grab up to 5000 friends, and would be happy to correct this if it has not been addressed already.

Support native video upload

The Twitter API recently added support for native video upload. They've added a new endpoint and workflow that requires their commands INIT, APPEND, and FINALIZE. It appears only chunked video uploads are allowed.

Tweet class misses id_str

Tweet class contains the id (as long) but not the more important id_str (as string). id_str is needed to create a link to a single tweet.

connection reset

I'm occasionally receiving connection reset errors when posting to Twitter. Anyone seeing similar?

java.net.SocketException: Connection reset
java.net.SocketInputStream.read(SocketInputStream.java:209)
java.net.SocketInputStream.read(SocketInputStream.java:141)
sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
sun.security.ssl.InputRecord.read(InputRecord.java:503)
sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:961)
sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:918)
sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:136)
org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:152)
org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:270)
org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)
org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:260)
org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:161)
org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:153)
org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:271)
org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123)
org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:254)
org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
org.springframework.http.client.HttpComponentsClientHttpRequest.executeInternal(HttpComponentsClientHttpRequest.java:91)
org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)
org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:569)
org.springframework.web.client.RestTemplate.execute(RestTemplate.java:545)
org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:466)
org.springframework.social.oauth1.OAuth1Template.exchangeForToken(OAuth1Template.java:192)
org.springframework.social.oauth1.OAuth1Template.fetchRequestToken(OAuth1Template.java:117)

Error when posting Emoji's

If I try to post and Emoji to a status update I receive an error. Does anyone know if this is tested and working? If so how?

401 from Twitter after sending a status with a valid configuration

Hello,

I cannot send a status on twitter since April 22nd. It was working fine before for many months. I did not change the config related to Twitter on my app or on Twitter side. I've tried changing the settings on my app, regenerated the keys, created a new app, but it did not work.

Twitter always respond with:

ERROR: 401 :: Could not authenticate you.

Note I was able to post a status manually with Postman using the same credentials and OAuth1.
I think something has changed on the Twitter API that is not compatible with Spring Social Twitter.

Am I the only one with this issue?

Thanks,

Fabian

Technical details

I use the release: 1.1.2.RELEASE

I instantiate the bean via XML (Spring):

<bean id="twitter" class="org.springframework.social.twitter.api.impl.TwitterTemplate">
	<constructor-arg name="consumerKey" value="xxx" />
	<constructor-arg name="consumerSecret" value="xxx" />
	<constructor-arg name="accessToken" value="xxx" />
	<constructor-arg name="accessTokenSecret" value="xxx" />
</bean>

then I use:

twitter.timelineOperations().updateStatus("Hello")

SourceCompatibility 1.5 & 1.7. Why?

Hey everybody.

When trying to use the diamond operator, I bumped into this complaint in the gradle build routine:

 diamond operator is not supported in -source 1.5

In the gradle.build file, I found explicit:

    compileJava {
        sourceCompatibility=1.5
        targetCompatibility=1.5
    }
    compileTestJava {
        sourceCompatibility=1.7
        targetCompatibility=1.7
    }

Is there any particular reason for we not be using 1.8 in all that?

All the best,
Hudson

Streaming API: simulate Twitter stream

Is it possible to "simulate" incoming stream by sending messages from another application to instantiated StreamListener instance? I'm looking for such functionality for testing purposes: I don't want to use actual incoming data from Twitter, because it would be much more suitable for me to generate sample incoming data by myself and pass it to my application from another application.

SimpleDateFormat performance problem

It looks like in the class
org.springframework.social.twitter.api.impl.TweetDeserializer

and method public Tweet deserialize(JsonNode node) SimpleDateFormat is created
for every node. I leads performance problems. As I can see the dateFormat is a constant TIMELINE_DATE_FORMAT so we can make dateFormat static and reuse it.

I have found similar problems in some other places in Tweeter code. Please check all places where SimpleDateFormat is used.

This problem is very serious in case of using in Android because of its issue described in the following topics
https://code.google.com/p/android/issues/detail?id=3147
https://code.google.com/p/android-rome-feed-reader/issues/detail?id=1
http://stackoverflow.com/questions/3905545/android-load-timezone-too-long-loaded-time-zone-names-for-en-us
http://stackoverflow.com/questions/454315/how-do-you-format-date-and-time-in-android

Every using of SimpleDateFormat lead to whole ONE SECOND delay in Android.
The best will be not using SimpleDateFormat at all as it is done in Spring Social Facebook.

update_with_media.json return 503 (Service Unavailable); invoking error handler

Hi,

I'm trying to tweet via spring-social-twitter but returns "503 (Service Unavailable); invoking error handler"

I copy-n-paste some logs below.

I tried to post via Twitter Console and I saw my post. Is it possible that request header is not set ContentType correctly? I saw that twitter console set Multipartform/data and I don't think (I don't see) what spring-social does that.

Thanks in advance.

2013-12-04 22:18:29,416 DEBUG (org.springframework.http.client.support.HttpAccessor:78) - Created POST request for "https://api.twitter.com/1.1/statuses/update_with_media.json"
2013-12-04 22:18:29,435 DEBUG (org.springframework.web.client.RestTemplate$AcceptHeaderRequestCallback:579) - Setting request Accept header to [application/json, application/*+json]
2013-12-04 22:18:29,436 DEBUG (org.springframework.web.client.RestTemplate$HttpEntityRequestCallback:657) - Writing [{status=[Try again till come!], media=[file [/var/www/html/static/resources/attaches/203.png]]}] using [org.springframework.social.twitter.api.impl.TwitterEscapingFormHttpMessageConverter@48a5de9b]
2013-12-04 22:18:31,303 WARN (org.springframework.web.client.RestTemplate:529) - POST request for "https://api.twitter.com/1.1/statuses/update_with_media.json" resulted in 503 (Service Unavailable); invoking error handler

ConnectController call back url is incorrect

I have set up the application url 。
But it callback url is
http://sns-share.com/event/connect/twitter?oauth_token=oZsVYgAAAAAAuIRKAAABVIA6IRM&oauth_verifier=QZ6uEK5aNDAz8aFfAmalg3Srni0J3np1

@Configuration
public class SocialConfig {

    @Bean
    public ConnectController connectController(ConnectionFactoryLocator connectionFactoryLocator,ConnectionRepository connectionRepository) {
        ConnectController controller = new ConnectController(connectionFactoryLocator, connectionRepository);
        controller.setApplicationUrl("http://sns-share.com/event");
        return controller ;
    }

}

Can change the post url /connect/twitter ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.