g8rswimmer / go-twitter Goto Github PK
View Code? Open in Web Editor NEWThis is a go library for twitter v2 API integration.
License: MIT License
This is a go library for twitter v2 API integration.
License: MIT License
When I call
lookups, err := tweet.FilteredStream(context.Background(), fieldOpts)
In tweet.go the call:
err := decoder.Decode(e);
returns invalid character '<' looking for beginning of value
This is then passed up to the caller of .FilteredStream, with the error being tweet lookup response error decode: invalid character '<' looking for beginning of value
This isn't a very meaningful error, I think it should be relayed to the user that a 404 has occurred.
Information:
req: GET https://api.twitter.com//2/tweets/search/stream
resp.Status: 404 Not Found
Blocking users is a core security feature on Twitter. Using the endpoints in the manage blocks endpoint group, you can build safer experiences for Twitter users or block users programmatically based on previous engagements. You can also unblock users after a given period of time, based on the criteria that you determine. Using blocks lookup, you can see who you or an authenticated user has blocked. This can be useful for determining how you can interact with a given account.
https://developer.twitter.com/en/docs/twitter-api/users/blocks/introduction
Hi there! Thanks for your go-twitter library. Just to let you know we've added a listing on the Twitter Tools & Libraries page (with the note that it is in alpha) :-) The first v2-compatible Go library we've included! Thank you!
Feel free to add a shields.io version badge to your README, if you'd like.
Our Libraries and SDKs forum welcomes any further announcements.
Is there already an implementation for handling rate limits (v2)?
I'm thinking of using the x-rate-limit-reset
HTTP header to trigger an automatic waiting period, similar to what tweepy does.
Unfortunately, at least for UserLookupResponse
there is no meta object yet.
Add the user follows lookup
https://developer.twitter.com/en/docs/twitter-api/users/follows/introduction
Is there any plans of implementing premium search twitter APIs, I know they are currently only based on v1.1 but I do not see their implementation in V1 package of go-twitter library as well?
List follows lookup group has two available endpoints. You are able to retrieve details on followers of a specified List and get data on which Lists a user follows. These endpoints can be used to enable people to curate and organize Tweets based on what type of Lists other users are following.
https://developer.twitter.com/en/docs/twitter-api/lists/list-follows/introduction
This is for v2 of the library for the tweet lookup
https://developer.twitter.com/en/docs/twitter-api/tweets/lookup/introduction
Hi Sean - can you follow or DM me on Twitter? apologies for the weird GH issue reach out :-)
Add the user follower APIs
https://developer.twitter.com/en/docs/twitter-api/users/follows/introduction
Follow another user
https://developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/post-users-source_user_id-following
Unfollow a user
https://developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/delete-users-source_id-following
Add the user follow lookup APIs
https://developer.twitter.com/en/docs/twitter-api/users/follows/introduction
Add the filtered stream to the v2 library
https://developer.twitter.com/en/docs/twitter-api/tweets/filtered-stream/introduction
maybe happend at:
resp, err := client.TweetRecentSearch(context.Background(), query, opts)
if err != nil {
log.Fatal(err)
return nil, err
}
logs:
twiiter callout status 429 UsageCapExceeded:Usage cap exceeded: Monthly product cap
Add the hide replies API to the v2 library
https://developer.twitter.com/en/docs/twitter-api/tweets/hide-replies/introduction
Add the tweet sampled stream API
https://developer.twitter.com/en/docs/twitter-api/tweets/sampled-stream/introduction
Today, we are launching improvements to the Retweets lookup endpoint and the Likes lookup endpoint which show you which accounts have liked or retweeted a Tweet. Now, you will be able to retrieve the full list of accounts that have Liked or Retweeted a Tweet.
Previously, you were limited to the 100 most recent Likes or Retweets with these endpoints. We heard your feedback that this was too limiting and have updated these endpoints to now return all results.
To retrieve a complete list of Likes and Retweets, you can now use pagination. In addition, you can authenticate these endpoints with either OAuth 1.0a User Context, OAuth 2.0 Authorization Code Flow with PKCE, or OAuth 2.0 Bearer Token.
We’re continuing to add new features and functionality to Twitter API v2. Be sure to keep an eye on our public roadmap for the latest. As always, we’d love to hear what you think. Please reach out with any questions or feedback on what you’d like to see in the future.
Hi, I was wondering why Functions like FilteredStream
,
Line 515 in aa7833a
SampledStream
Line 554 in aa7833a
Is it possible to change it so that it start's returning a channel and function, maybe a Stop function, when called we could close the channel?
Any other suggestions?
The Spaces lookup endpoints help you lookup live or scheduled Spaces, and enable you to build discovery experiences to give your users ways to find Spaces they may be interested in.
https://developer.twitter.com/en/docs/twitter-api/spaces/lookup/introduction
This List lookup group has two available endpoints. You are able to retrieve a specified List by ID and get details on user-owned Lists. With the Lists endpoints, you can build solutions that enable people to curate and organize Tweets based on preferences, interests, groups, or topics.
https://developer.twitter.com/en/docs/twitter-api/lists/list-lookup/introduction
Add the endpoints for recent search
https://developer.twitter.com/en/docs/twitter-api/tweets/search/introduction
Line 446 in 916f262
Think it should be 201 rather than 200, but i am not 100% sure. I get 201 response when running the code and it registers as an error :O
Members lookup group has two available endpoints. You are able to retrieve details on members of a specified List and see which Lists a user is a member of. These endpoints can be used to enable people to curate and organize new Lists based on the membership information.
https://developer.twitter.com/en/docs/twitter-api/lists/list-members/introduction
The manage pinned List endpoints allow you to pin and unpin a List on behalf of an authenticated user. For these endpoints, there are two methods available: POST and DELETE. The POST method allows you to pin a List, and the DELETE method allows you to unpin a List. There is a user rate limit of 50 requests per 15 minutes for both endpoints.
https://developer.twitter.com/en/docs/twitter-api/lists/pinned-lists/introduction
This endpoint allows you to search Spaces by their title, and to filter results by status. This endpoint is useful to discover live or upcoming Spaces based on keywords, mentioned users or hashtags in their title.
https://developer.twitter.com/en/docs/twitter-api/spaces/search/introduction
List Tweets lookup has one available endpoint to retrieve Tweets from a specified List. With this endpoint, you can build solutions that enable users to customize, organize and prioritize the Tweets they see in their timeline.
https://developer.twitter.com/en/docs/twitter-api/lists/list-tweets/introduction
Twitter Lists allows users to customize, organize and prioritize the Tweets they see in their timeline. With the Lists endpoints, you can build solutions that enable people to curate and organize Tweets based on preferences, interests, groups, or topics.
https://developer.twitter.com/en/docs/twitter-api/lists/manage-lists/introduction
Update the user lookup APIs
https://developer.twitter.com/en/docs/twitter-api/users/lookup/introduction
The tweet dictionary, lookup
, does not correctly associate the tweet expansion references.
Unfortunately, v2 of the library is needed to address some short comings of the fist version. This is the kick off to try and make sure that this new version provides better functionality to the users.
Needs
Add the manage tweets client the v2 package
Add the tweet counts to the v2 library
https://developer.twitter.com/en/docs/twitter-api/tweets/counts/introduction
Add github action for golangci linter.
Add the tweet->retweets
https://developer.twitter.com/en/docs/twitter-api/tweets/retweets/introduction
https://developer.twitter.com/en/docs/twitter-api/tweets/retweets/api-reference/post-users-id-retweets
https://developer.twitter.com/en/docs/twitter-api/tweets/retweets/api-reference/delete-users-id-retweets-tweet_id
There is a typo that needs to be corrected
UserRetweetLookuoOpts -> UserRetweetLookupOpts
Add the tweet and user likes
https://developer.twitter.com/en/docs/twitter-api/tweets/likes/introduction
Add Go mod to the project and update outdated libraries like ioutil.
When the pinned_tweet
option is passed in the user lookups, the tweet is not properly associated with the user.
in v2 TweetRecentSearch: got result some text incomplete display.
{
"Raw": {
"data": [{
"id": "1496269047071223810",
"text": "RT @Arad064083512: @OfficialTravlad @TheRealM0nk @TheWolfyofBSC @SpyWolfNetwork The strongest predators of nature are wolves. This is becau…",
"author_id": "1387190115202707461",
"conversation_id": "1496269047071223810",
"created_at": "2022-02-22T23:41:54.000Z",
"lang": "en"
}, {
"id": "1496269031975890944",
"text": "RT @KKi09918980: @OfficialTravlad @TheRealM0nk @TheWolfyofBSC @SpyWolfNetwork Security is the most valuable asset that is not easily obtain…",
"author_id": "1387190115202707461",
"conversation_id": "1496269031975890944",
"created_at": "2022-02-22T23:41:51.000Z",
"lang": "en"
}, {
"id": "1496269025537675264",
"text": "@HustlersWallSt 🔥💰 #wallstreet #Ethereum #BTC 📈📈📈📈📈📈 https://t.co/abZAF9NwOV",
"author_id": "235851878",
"conversation_id": "1496269025537675264",
"created_at": "2022-02-22T23:41:49.000Z",
"lang": "und"
}]}}
i set options
opts := twitter.TweetRecentSearchOpts{
Expansions: []twitter.Expansion{twitter.ExpansionEntitiesMentionsUserName, twitter.ExpansionAuthorID},
TweetFields: []twitter.TweetField{twitter.TweetFieldText, twitter.TweetFieldCreatedAt,
twitter.TweetFieldConversationID, twitter.TweetFieldLanguage, twitter.TweetFieldEntities, twitter.TweetFieldContextAnnotations},
// twitter.TweetFieldNonPublicMetrics, twitter.TweetFieldOrganicMetrics, twitter.TweetFieldPromotedMetrics, twitter.TweetFieldPublicMetrics,
MaxResults: 100,
NextToken: nextToken,
// UserFields: []twitter.UserField{twitter.UserFieldName, twitter.UserFieldID, twitter.UserFieldUserName},
}
Add the user lookup APIs to v2
https://developer.twitter.com/en/docs/twitter-api/users/lookup/introduction
V2 has a couple of new endpoints for tweet timelines.
https://developer.twitter.com/en/docs/twitter-api/tweets/timelines/introduction
Add the user timelines APIs to v2
https://developer.twitter.com/en/docs/twitter-api/tweets/timelines/introduction
Where there is a response that is XML, properly handle it.
Muting an account allows you to remove an account's Tweets from your timeline without unfollowing or blocking that account. Muted accounts will not know that you've muted them and you can unmute them at any time. With manage mutes endpoints, developers can create safer experiences for people on Twitter. One example of how to build with manage mutes is an application that allows you to mute accounts that might Tweet about specific topics for a specified length of time. With the mutes lookup endpoint, you can see who you or an authenticated user has muted. This can be useful to determine how you interact with the muted accounts.
https://developer.twitter.com/en/docs/twitter-api/users/mutes/introduction
It's been a pleasure using library with oauth 2.0 bearer token authorization. Great job!
Now I'm trying to get responses with oauth1.0 for api v2 as described here
https://developer.twitter.com/en/docs/twitter-api/tweets/lookup/api-reference/get-tweets
As I understand I just need to write new authorize struct, that will use oauth1.0
type authorize struct {
Token string
}
func ( a authorize ) Add( req *http.Request ) {
req.Header.Add( "Authorization", fmt.Sprintf( "Bearer %s", a.Token ) )
}
Found several oauth1.0 implementation like this
github.com/dghubble/oauth1
They all seem to provide authorization logic through http.Client
So I've tried to use client from this lib but it didn't work
twAppConfig := oauth1.NewConfig(CONSUMER_KEY, CONSUMER_SECRET)
token := oauth1.NewToken(TOKEN, TOKEN_SECRET)
httpClient := twAppConfig.Client(oauth1.NoContext, token)tweet := &twitter.Tweet{
Authorizer: authorize{},
Client: httpClient,
Host: "https://api.twitter.com",
}
Writing custom oauth implementation for this case doesn't seem right, so I believe there is a way to use the existing solutions, that I just don't see
Please help :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.