简体   繁体   中英

Twitterizer Problems

I am trying to figure out if twitterizer is still relevant. The library looks really old. And the current project i am working on uses it. I am using the following code...

private static OAuthTokens OAuthTokens()
        {
            var accessToken = "<insert>";
            var accessTokenSecret = "<insert>";
            var consumerKey = "<insert>";
            var consumerSecret = "<insert>";

            return new OAuthTokens
            {
                ConsumerKey = consumerKey,
                ConsumerSecret = consumerSecret,
                AccessToken = accessToken,
                AccessTokenSecret = accessTokenSecret
            };
        }

if i do the following call

var responseFollowersIds = TwitterFriendship.FollowersIds(credentials, new UsersIdsOptions()
            {
                UseSSL = true,
                APIBaseAddress = "http://api.twitter.com/1.1/",
                ScreenName = screenName
            });

I can see that i have followers and that the request being made looks like this

https://api.twitter.com/1.1/followers/ids.json?screen_name=screenname&cursor=-1

notice that i set the APIBaseAddress to the latest version, but if i try and get the followers i use the following

var responseFollowers = TwitterFriendship.Followers(credentials, new FollowersOptions
            {
                ScreenName = screenName,
                UseSSL = true,
                APIBaseAddress = "http://api.twitter.com/1.1/",
            });

But then i get an error

{"errors":[{"message":"Sorry, that page does not exist","code":34}]}

upon further investigation i realized that TwitterFriendship.Followers request url is wrong and that is buried deep in the twitterizer code. The request made is

https://api.twitter.com/1.1/statuses/followers.json?cursor=-1&screen_name=screenname

and should be

https://api.twitter.com/1.1/followers/list.json

according to the new twitter documentation. Is there an easy way to fix it?

A little bit late, but just in case anyone faces this problem again. You can easily fix it by modifiying the code of Twitterizer at \\Methods\\User\\FollowersCommand.cs , look for the constructor and change the URL of the method:

public FollowersCommand(OAuthTokens tokens, FollowersOptions options)
: base(HTTPVerb.GET, "followers/list.json", tokens, options)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM