tweetsharp

Unable to cast object of type [TweetSharp.TwitterUser]' to type 'TweetSharp.TwitterCursorList`1[TweetSharp.TwitterUser]'


hi i want to get follower list via tweetsharp but i have a exception this = Unable to cast object of type 'System.Collections.Generic.List1[TweetSharp.TwitterUser]' to type 'TweetSharp.TwitterCursorList1[TweetSharp.TwitterUser]'.

help me please HOW CAN I GET FOLLOWERLIST?

my code like this

 string aranan = "anilsarii";
    var AramaAyari = new SearchForUserOptions { Q = aranan, Count = 25 };
    var users = ts.SearchForUser(AramaAyari); //Get list of users by query
    //...
    //var asd=ts.FollowList(new FollowListOptions{ OwnerId= 2603023494});


    var followers = ts.ListFollowers(new ListFollowersOptions { Cursor = -1 });

    while (followers.NextCursor != null)
    {

        followers = ts.ListFollowers(new ListFollowersOptions { followers.NextCursor });



    }

Solution

  • You may just need to change this line;

    followers = ts.ListFollowers(new ListFollowersOptions { followers.NextCursor });
    

    to

    followers = ts.ListFollowers(new ListFollowersOptions { Cursor = followers.NextCursor });
    

    If that doesn't work, it's likely a problem in TweetSharp itself. TweetSharp has been abandoned by the original authors and is no longer maintained. As a result, there are a number of problems using it with the current Twitter API, due to changes on Twitter's end in the last few years. However there are several forks of TweetSharp that are current.

    I tried your code with the one line modified above using TweetMoaSharp (a fork, available on Nuget, or on github here; https://github.com/Yortw/tweetmoasharp) and it worked fine.

    Full disclosure: TweetMoaSharp is a fork primarily maintained by me. If you search Nuget for 'TweetSharp' you should find several others.