コード例 #1
0
ファイル: Program.cs プロジェクト: aidentity3b/TYMFollower
        static Cursored <User> InternalGather(Tokens tokens, long?Cursor, Tym userToProcess, GatheringSettings.SearchGroupType SearchGroup)
        {
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("START REQUEST");
            Console.ForegroundColor = ConsoleColor.Gray;
            Cursored <User> gathereds = new Cursored <User>();

            try
            {
                switch (SearchGroup)
                {
                case GatheringSettings.SearchGroupType.Follow:
                    return(tokens.Friends.List(user_id => userToProcess.Id, cursor => Cursor, count => 200));

                case GatheringSettings.SearchGroupType.Follower:
                    return(tokens.Followers.List(user_id => userToProcess.Id, cursor => Cursor, count => 200));
                }
            }
            catch (Exception e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("リクエストに失敗しました。: " + e.Message);
                Console.ForegroundColor = ConsoleColor.Gray;
                if (e.Message == "Rate limit exceeded")
                {
                    Console.WriteLine("API制限は15分後に解除されます。15分後に再開します。");
                    Thread.Sleep(910000);
                }
                else
                {
                    throw e;
                }
            }
            return(null);
        }
コード例 #2
0
ファイル: TwitterTools.cs プロジェクト: s4kr4/SignFrame
        // ユーザーのフォロワーを取得
        public static async Task <Cursored <User> > FriendList(long?userId, long?cursor = null)
        {
            if (tokens != null)
            {
                Cursored <User> users = null;

                try
                {
                    if (userId != null)
                    {
                        users = await tokens.Friends.ListAsync(user_id : (long)userId, cursor : cursor, count : 100);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    return(null);
                }

                if (users != null)
                {
                    return(users);
                }
                else
                {
                    MessageBox.Show("取得失敗");
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: s1500729/DiceBotConsole
        static void Response(string Message)
        {
            //リプを送るTextBoxに名前がある かつ フォロワーにいる
            //ときにツイート
            if (Message != OldMessage)
            {
                Cursored <User> users     = bot.token.Friends.List();
                List <string>   usernames = GetReplyUserName();

                foreach (var user in users)
                {
                    for (int j = 0; j < usernames.Count; j++)
                    {
                        if (user.ScreenName == usernames[j])
                        {
                            try
                            {
                                bot.token.Statuses.Update
                                    (new { status = "@" + usernames[j] + Environment.NewLine + Message, in_reply_to_status_id = user.Id });

                                Console.WriteLine("@" + usernames[j] + "へ通知します" + "\r\n");
                            }
                            catch
                            {
                                Console.WriteLine("---:投稿できませんでした。");
                            }
                        }
                    }
                }

                // Slackに通知
                WebHook.Upload(Message);
            }

            OldMessage = Message;
        }
コード例 #4
0
ファイル: Statuses.cs プロジェクト: Chicken4WP8/Chicken4WP8
 /// <summary>
 /// <para>Enumerates a collection of up to 100 user IDs belonging to users who have retweeted the tweet specified by the id parameter.</para>
 /// <para>This method offers similar data to GET statuses/retweets/:id and replaces API v1's GET statuses/:id/retweeted_by/ids method.</para>
 /// <para>Available parameters:</para>
 /// <para>- <c>long</c> id (required)</para>
 /// <para>- <c>long</c> cursor (semi-optional)</para>
 /// <para>Don't use stringify_ids</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The IDs.</returns>
 public IEnumerable <long> EnumerateRetweetersIds <T>(EnumerateMode mode, T parameters)
 {
     return(Cursored <long> .Enumerate <T>(this.Tokens, "statuses/retweeters/ids", mode, parameters));
 }
コード例 #5
0
ファイル: Friendships.cs プロジェクト: yuta-inoue/CoreTweet
 /// <summary>
 /// <para>Enumerate numeric IDs for every protected user for whom the authenticating user has a pending follow request.</para>
 /// <para>Available parameters: </para>
 /// <para>- <c>long</c> cursor (semi-optional)</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The IDs.</returns>
 public IEnumerable <long> EnumerateOutgoing <T>(EnumerateMode mode, T parameters)
 {
     return(Cursored <long> .Enumerate <T>(this.Tokens, "friendships/outgoing", mode, parameters));
 }
コード例 #6
0
ファイル: Friendships.cs プロジェクト: yuta-inoue/CoreTweet
 /// <summary>
 /// <para>Enumerate numeric IDs for every protected user for whom the authenticating user has a pending follow request.</para>
 /// <para>Available parameters: </para>
 /// <para>- <c>long</c> cursor (semi-optional)</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The IDs.</returns>
 public IEnumerable <long> EnumerateOutgoing(EnumerateMode mode, IDictionary <string, object> parameters)
 {
     return(Cursored <long> .Enumerate(this.Tokens, "friendships/outgoing", mode, parameters));
 }
コード例 #7
0
ファイル: Program.cs プロジェクト: aidentity3b/TYMFollower
        static void SingleGathering(Tokens tokens, List <Tym> Tyms, GatheringSettings settings, GatheringHistory History)
        {
            GatheringHistory.SingleGatheringState State = History.GetState(settings) as GatheringHistory.SingleGatheringState;

            if (State != null)
            {
                Console.WriteLine("以前にこの設定で途中まで検索を行った履歴があります。途中から再開しますか?[y/n]");
                switch (settings.SearchOrigin)
                {
                case GatheringSettings.SearchOriginType.Direct:
                    Console.WriteLine($"({State.CurrentTym.Name}, @{State.CurrentTym.Screen_name})");
                    break;

                case GatheringSettings.SearchOriginType.Specified:
                    Console.WriteLine($"(@{State.SpecifiedScreenName})");
                    break;
                }
                switch (Console.ReadLine())
                {
                case "n":
                    switch (settings.SearchOrigin)
                    {
                    case GatheringSettings.SearchOriginType.Direct:
                        State = new GatheringHistory.SingleGatheringState(null, new Tym(currentUser, true));
                        break;

                    case GatheringSettings.SearchOriginType.Specified:
                        Console.WriteLine("検索の起点となるユーザーのIDを入力してください");
                        Console.Write("@");
                        State = new GatheringHistory.SingleGatheringState(null, Console.ReadLine());
                        break;

                    default:
                        State = new GatheringHistory.SingleGatheringState(null, new Tym(currentUser, true));
                        break;
                    }
                    break;

                default:
                    break;
                }
            }
            else
            {
                switch (settings.SearchOrigin)
                {
                case GatheringSettings.SearchOriginType.Direct:
                    State = new GatheringHistory.SingleGatheringState(null, new Tym(currentUser, true));
                    break;

                case GatheringSettings.SearchOriginType.Specified:
                    Console.WriteLine("検索の起点となるユーザーのIDを入力してください");
                    Console.Write("@");
                    State = new GatheringHistory.SingleGatheringState(null, Console.ReadLine());
                    break;

                default:
                    State = new GatheringHistory.SingleGatheringState(null, new Tym(currentUser, true));
                    break;
                }
            }
            History.SetState(settings, State);
            GatheringHistory.SaveHistory("history.dat", History);
            int TymCounter = 0;

            while (true)
            {
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("累計収集戸山生数:" + TymCounter.ToString());
                Cursored <User> gathereds = null;
                try
                {
                    switch (settings.SearchOrigin)
                    {
                    case GatheringSettings.SearchOriginType.Direct:
                        gathereds = InternalGather(tokens, State.Cursor, State.CurrentTym, settings.SearchGroup);
                        break;

                    case GatheringSettings.SearchOriginType.Specified:
                        gathereds = InternalGather(tokens, State.Cursor, State.SpecifiedScreenName, settings.SearchGroup);
                        break;
                    }
                }
                catch (Exception)
                {
                    return;
                }
                if (gathereds == null)
                {
                    continue;
                }
                foreach (User gathered in gathereds)
                {
                    if (IsTym(gathered))
                    {
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        Console.WriteLine("●戸山生っぽい!");
                        Console.ForegroundColor = ConsoleColor.Gray;
                        Console.WriteLine($"{gathered.Name} ({gathered.ScreenName})");
                        Console.WriteLine(gathered.Description);
                        Tym tym;
                        switch (settings.SearchOrigin)
                        {
                        case GatheringSettings.SearchOriginType.Direct:
                            tym = new Tym(gathered, (settings.SearchGroup == GatheringSettings.SearchGroupType.Follow ? true : false));
                            break;

                        case GatheringSettings.SearchOriginType.Specified:
                        default:
                            tym = new Tym(gathered, false);
                            break;
                        }

                        if (!Tyms.Contains(tym))
                        {
                            TymCounter++;
                            Tyms.Add(tym);
                        }
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Magenta;
                        Console.WriteLine("●戸山生じゃないかも……");
                        Console.ForegroundColor = ConsoleColor.Gray;
                        Console.WriteLine($"{gathered.Name} ({gathered.ScreenName})");
                        Console.WriteLine(gathered.Description);
                    }
                }
                if (gathereds.NextCursor == 0)
                {
                    //Last Page
                    State = null;
                    History.SetState(settings, State);
                    GatheringHistory.SaveHistory("history.dat", History);
                    break;
                }
                else
                {
                    State.Cursor = gathereds.NextCursor;
                    History.SetState(settings, State);
                    GatheringHistory.SaveHistory("history.dat", History);
                }
            }
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("収集終了");
            Console.WriteLine("累計収集戸山生数:" + TymCounter.ToString());
            Console.ForegroundColor = ConsoleColor.Gray;
        }
コード例 #8
0
 /// <summary>
 /// <para>Enumerates user objects for users following the specified user.</para>
 /// <para>At this time, results are ordered with the most recent following first; however, this ordering is subject to unannounced change and eventual consistency issues.</para>
 /// <para>Results are given in groups of 20 users and multiple "pages" of results can be navigated through using the next_cursor value in subsequent requests.</para>
 /// <para>Note: Either a screen_name or a user_id should be provided.</para>
 /// <para>Available parameters:</para>
 /// <para>- <c>long</c> id (optional)</para>
 /// <para>- <c>string</c> screen_name (optional)</para>
 /// <para>- <c>bool</c> include_entities (optional)</para>
 /// <para>- <c>bool</c> skip_status (optional)</para>
 /// <para>- <c>long</c> cursor (optional)</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The users.</returns>
 public IEnumerable <User> EnumerateList(EnumerateMode mode, IDictionary <string, object> parameters)
 {
     return(Cursored <User> .Enumerate(this.Tokens, "followers/list", mode, parameters));
 }
コード例 #9
0
 /// <summary>
 /// <para>Enumerates user IDs for every user following the specified user.</para>
 /// <para>At this time, results are ordered with the most recent following first; however, this ordering is subject to unannounced change and eventual consistency issues.</para>
 /// <para>Results are given in groups of 5,000 user IDs and multiple "pages" of results can be navigated through using the next_cursor value in subsequent requests.</para>
 /// <para>This method is especially powerful when used in conjunction with GET users/lookup, a method that allows you to convert user IDs into full user objects in bulk.</para>
 /// <para>Available parameters:</para>
 /// <para>- <c>long</c> user_id (optional)</para>
 /// <para>- <c>string</c> screen_name (optional)</para>
 /// <para>- <c>int</c> count (optional)</para>
 /// <para>- <c>long</c> cursor (optional)</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The IDs.</returns>
 public IEnumerable <long> EnumerateIds <T>(EnumerateMode mode, T parameters)
 {
     return(Cursored <long> .Enumerate <T>(this.Tokens, "followers/ids", mode, parameters));
 }
コード例 #10
0
 public IEnumerable <User> Enumerate(EnumerateMode mode, IDictionary <string, object> parameters)
 {
     return(Cursored <User> .Enumerate(this.Tokens, "lists/members", mode, parameters));
 }
コード例 #11
0
 /// <summary>
 /// <para>Returns the members of the specified list. Private list members will only be shown if the authenticated user owns the specified list.</para>
 /// <para>Note: Either a list_id or a slug is required. If providing a list_slug, an owner_screen_name or owner_id is also required.</para>
 /// <para>The response from the API will include a previous_cursor and next_cursor to allow paging back and forth. See Using cursors to navigate collections for more information.</para>
 /// <para>Avaliable parameters: </para>
 /// <para><paramref name="long list_id (required)"/> : The numerical id of the list.</para>
 /// <para><paramref name="string slug (required)"/> : You can identify a list by its slug instead of its numerical id. If you decide to do so, note that you'll also have to specify the list owner using the owner_id or owner_screen_name parameters.</para>
 /// <para><paramref name="string owner_sereen_name (optional)"/> : The screen name of the user who owns the list being requested by a slug.</para>
 /// <para><paramref name="long owner_id (optional)"/> : The user ID of the user who owns the list being requested by a slug.</para>
 /// <para><paramref name="long cursor (optional)"/> : The first cursor. If not be specified, enumerating starts from the first page.</para>
 /// </summary>
 /// <returns>
 /// Users.
 /// </returns>
 /// <see cref="https://dev.twitter.com/docs/misc/cursoring"/>
 /// <param name='mode'>
 /// <para> Specify whether enumerating goes to the next page or the previous.</para>
 /// </param>
 /// <param name='parameters'>
 /// Parameters.
 /// </param>
 public IEnumerable <User> Enumerate(EnumerateMode mode, params Expression <Func <string, object> >[] parameters)
 {
     return(Cursored <User> .Enumerate(this.Tokens, "lists/members", mode, parameters));
 }
コード例 #12
0
 public IEnumerable <User> EnumerateSubscriptions <T>(EnumerateMode mode, T parameters)
 {
     return(Cursored <User> .Enumerate <T>(this.Tokens, "lists/subscriptions", mode, parameters));
 }
コード例 #13
0
ファイル: Program.cs プロジェクト: devel-retar-jp/EABadFinder
        //自分のFollowersとFriendsを取得
        static void getMyIds()
        {
            //Twitter API接続
            try
            {
                //認証
                Tokens tokens = Tokens.Create(sgjson.ConsumerKey, sgjson.ConsumerSecret, sgjson.AccessToken, sgjson.AccessSecret);

                //パラメータ
                var parm = new Dictionary <string, object>();           //条件指定用Dictionary
                parm["screen_name"] = sgjson.parm_screen_name;          //取得したいユーザーID
                if (sgjson.parm_cursor != "")
                {
                    parm["cursor"] = sgjson.parm_cursor;
                }                                                                       //設定があればカーソル設定

                //followers/listを取得
                int count = 0;
                parm["cursor"] = -1;
                parm["count"]  = sgjson.count;                     //取得数
                for (; ;)
                {
                    Cursored <User> fls = tokens.Followers.List(parm);
                    Console.WriteLine("Id                 ,ScreenName         ,Friends,Followers,CreatedAt                 ,Name");
                    foreach (var f in fls)
                    {
                        FollowersList.Add(f);

                        DateTime tyears = DateTime.Now.AddDays(sgjson.datespan);
                        if (tyears < f.CreatedAt)
                        {
                            FollowersIdsExcept.Add((long)f.Id);

                            Console.WriteLine("{0,-19},{1,-19},{2,-7},{3,-9},{4,-26},{5}"
                                              , f.Id
                                              , f.ScreenName
                                              , f.FriendsCount
                                              , f.FollowersCount
                                              , f.CreatedAt
                                              , f.Name
                                              );
                        }
                    }
                    //
                    if (fls.NextCursor == 0)
                    {
                        count = count + fls.Count;
                        Console.WriteLine("followers/list : gets : {0}", count);
                        break;
                    }
                    else
                    {
                        parm["cursor"] = fls.NextCursor;            //カーソル設定
                        count          = count + fls.Count;

                        Console.WriteLine("followers/list : gets : {0}", count);
                        Console.WriteLine("followers/list : ");
                        getSleep(sgjson.sleeptime);//停止時間
                    }
                }
            }
            catch (TwitterException e)
            {
                //CoreTweetエラー。
                Console.WriteLine("CoreTweet Error : {0}", e.Message);
            }
            catch (System.Net.WebException e)
            {
                //インターネット接続エラー。
                Console.WriteLine("Internet Error : {0}", e.Message);
            }
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: devel-retar-jp/EABadFinder
        //フォロワーをフォローしている相手を抽出
        static void getFollowersIds()
        {
            //IDごとにとってくる
            int getlimit = Constants.sgFollowersLimit;

            //foreach (var fi in FollowersIds)
            foreach (var fi in FollowersIdsExcept.Distinct())
            {
                Console.WriteLine("followers/ids :  {0}", fi);

                List <long> FoIds = new List <long>();
                List <long> FrIds = new List <long>();

                //Twitter API接続
                try
                {
                    //認証
                    Tokens tokens = Tokens.Create(sgjson.ConsumerKey, sgjson.ConsumerSecret, sgjson.AccessToken, sgjson.AccessSecret);

                    //パラメータ
                    var parm = new Dictionary <string, object>(); //条件指定用Dictionary
                    parm["count"]   = sgjson.parm_count;          //取得数
                    parm["user_id"] = fi;                         //取得したいユーザーID
                    if (sgjson.parm_cursor != "")
                    {
                        parm["cursor"] = sgjson.parm_cursor;
                    }                                                                       //設定があればカーソル設定

                    //followers/idsを取得
                    int count = 0;
                    parm["cursor"] = -1;

                    for (; ;)
                    {
                        Cursored <long> fls = tokens.Followers.Ids(parm);
                        foreach (var f in fls)
                        {
                            FoIds.Add(f);
                        }
                        //
                        if (fls.NextCursor == 0)
                        {
                            count = count + fls.Count;
                            Console.WriteLine("followers/ids : 獲得数 : {0}", count);
                            break;
                        }
                        else
                        {
                            //Console.WriteLine(" : 次のカーソル : {0}", fls.NextCursor);
                            parm["cursor"] = fls.NextCursor;            //カーソル設定
                            count          = count + fls.Count;

                            Console.WriteLine("followers/ids : 獲得数 : {0}", count);
                            Console.WriteLine("followers/ids : ");
                            getSleep(sgjson.sleeptime);//停止時間
                        }
                    }

                    //friends/idsを取得
                    count          = 0;
                    parm["cursor"] = -1;
                    for (; ;)
                    {
                        Cursored <long> fls = tokens.Friends.Ids(parm);
                        foreach (var f in fls)
                        {
                            FrIds.Add(f);
                        }
                        //
                        if (fls.NextCursor == 0)
                        {
                            count = count + fls.Count;
                            Console.WriteLine("friends/ids : 獲得数 : {0}", count);
                            break;
                        }
                        else
                        {
                            parm["cursor"] = fls.NextCursor;            //カーソル設定
                            count          = count + fls.Count;

                            Console.WriteLine("friends/ids : 獲得数 : {0}", count);
                            Console.WriteLine("friends/ids : ");
                            getSleep(sgjson.sleeptime);//停止時間
                        }
                    }

                    //共通項目
                    var IdsExcept = FoIds.Except <long>(FrIds).ToList();
                    Console.WriteLine("followers only/ids : {0}", IdsExcept.Count());

                    foreach (var f in IdsExcept)
                    {
                        F_FollowersIds.Add(f);
                    }
                }
                catch (TwitterException e)
                {
                    //CoreTweetエラー。
                    Console.WriteLine("CoreTweet Error : {0}", e.Message);
                    //Console.ReadKey();
                }
                catch (System.Net.WebException e)
                {
                    //インターネット接続エラー。
                    Console.WriteLine("Internet Error : {0}", e.Message);
                    // Console.ReadKey();
                }
                getSleep(sgjson.sleeptime);//停止時間

                //取得上限
                if (getlimit < 0)
                {
                    break;
                }
                else
                {
                    getlimit--;
                }
            }
        }
コード例 #15
0
ファイル: Program.cs プロジェクト: aidentity3b/TYMFollower
        static void IndirectGathering(Tokens tokens, List <Tym> Tyms, GatheringSettings settings, GatheringHistory History)
        {
            GatheringHistory.IndirectGatheringState State = History.GetState(settings) as GatheringHistory.IndirectGatheringState;
            int startIndex = 0;

            if (State != null)
            {
                Console.WriteLine("以前にこの設定で途中まで検索を行った履歴があります。途中から再開しますか?[y/n]");
                switch (Console.ReadLine())
                {
                case "n":
                    State = new GatheringHistory.IndirectGatheringState(null, null);
                    break;

                default:
                    int index = Tyms.IndexOf(State.CurrentTym);
                    if (index == -1)
                    {
                        startIndex = 0;
                    }
                    else
                    {
                        startIndex = index;
                    }
                    break;
                }
            }
            else
            {
                State = new GatheringHistory.IndirectGatheringState(null, null);
            }
            History.SetState(settings, State);
            GatheringHistory.SaveHistory("history.dat", History);
            int TymCounter = 0;

            for (int i = 0; i < Tyms.Count; i++)
            {
                if (startIndex <= i)
                {
                    //Process
                    State.CurrentTym = Tyms[i];
                    History.SetState(settings, State);
                    GatheringHistory.SaveHistory("history.dat", History);
                    while (true)
                    {
                        Tym.SaveTymList("tyms.dat", Tyms, false);
                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.WriteLine("累計収集戸山生数:" + TymCounter.ToString());
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine($"これから処理する戸山生:{State.CurrentTym.Name} (@{State.CurrentTym.Screen_name})");
                        Console.ForegroundColor = ConsoleColor.Gray;
                        Cursored <User> gathereds = null;
                        try
                        {
                            gathereds = InternalGather(tokens, State.Cursor, State.CurrentTym, settings.SearchGroup);
                        }
                        catch (Exception)
                        {
                            return;
                        }
                        if (gathereds == null)
                        {
                            continue;
                        }
                        foreach (User gathered in gathereds)
                        {
                            if (IsTym(gathered))
                            {
                                Console.ForegroundColor = ConsoleColor.Yellow;
                                Console.WriteLine("●戸山生っぽい!");
                                Console.ForegroundColor = ConsoleColor.Gray;
                                Console.WriteLine($"{gathered.Name} ({gathered.ScreenName})");
                                Console.WriteLine(gathered.Description);
                                Tym tempTym = new Tym(gathered, false);
                                if (!Tyms.Contains(tempTym))
                                {
                                    TymCounter++;
                                    Tyms.Add(tempTym);
                                }
                            }
                            else
                            {
                                Console.ForegroundColor = ConsoleColor.Magenta;
                                Console.WriteLine("●戸山生じゃないかも……");
                                Console.ForegroundColor = ConsoleColor.Gray;
                                Console.WriteLine($"{gathered.Name} ({gathered.ScreenName})");
                                Console.WriteLine(gathered.Description);
                            }
                        }
                        if (gathereds.NextCursor == 0)
                        {
                            //Last Page
                            State.Cursor = null;
                            History.SetState(settings, State);
                            GatheringHistory.SaveHistory("history.dat", History);
                            break;
                        }
                        else
                        {
                            State.Cursor = gathereds.NextCursor;
                            History.SetState(settings, State);
                            GatheringHistory.SaveHistory("history.dat", History);
                        }
                    }
                }
            }
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("収集終了");
            Console.WriteLine("累計収集戸山生数:" + TymCounter.ToString());
            Console.ForegroundColor = ConsoleColor.Gray;
        }
コード例 #16
0
 /// <summary>
 /// <para>Enumerates user IDs for every user following the specified user.</para>
 /// <para>At this time, results are ordered with the most recent following first; however, this ordering is subject to unannounced change and eventual consistency issues.</para>
 /// <para>Results are given in groups of 5,000 user IDs and multiple "pages" of results can be navigated through using the next_cursor value in subsequent requests.</para>
 /// <para>This method is especially powerful when used in conjunction with GET users/lookup, a method that allows you to convert user IDs into full user objects in bulk.</para>
 /// <para>Available parameters:</para>
 /// <para>- <c>long</c> user_id (optional)</para>
 /// <para>- <c>string</c> screen_name (optional)</para>
 /// <para>- <c>int</c> count (optional)</para>
 /// <para>- <c>long</c> cursor (optional)</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The IDs.</returns>
 public IEnumerable <long> EnumerateIds(EnumerateMode mode, params Expression <Func <string, object> >[] parameters)
 {
     return(Cursored <long> .Enumerate(this.Tokens, "followers/ids", mode, parameters));
 }
コード例 #17
0
 /// <summary>
 /// <para>Enumerates user IDs for every user following the specified user.</para>
 /// <para>At this time, results are ordered with the most recent following first; however, this ordering is subject to unannounced change and eventual consistency issues.</para>
 /// <para>Results are given in groups of 5,000 user IDs and multiple "pages" of results can be navigated through using the next_cursor value in subsequent requests.</para>
 /// <para>This method is especially powerful when used in conjunction with GET users/lookup, a method that allows you to convert user IDs into full user objects in bulk.</para>
 /// <para>Available parameters:</para>
 /// <para>- <c>long</c> user_id (optional)</para>
 /// <para>- <c>string</c> screen_name (optional)</para>
 /// <para>- <c>int</c> count (optional)</para>
 /// <para>- <c>long</c> cursor (optional)</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The IDs.</returns>
 public IEnumerable <long> EnumerateIds(EnumerateMode mode, IDictionary <string, object> parameters)
 {
     return(Cursored <long> .Enumerate(this.Tokens, "followers/ids", mode, parameters));
 }
コード例 #18
0
 public IEnumerable <User> Enumerate <T>(EnumerateMode mode, T parameters)
 {
     return(Cursored <User> .Enumerate <T>(this.Tokens, "lists/members", mode, parameters));
 }
コード例 #19
0
 /// <summary>
 /// <para>Enumerates user objects for users following the specified user.</para>
 /// <para>At this time, results are ordered with the most recent following first; however, this ordering is subject to unannounced change and eventual consistency issues.</para>
 /// <para>Results are given in groups of 20 users and multiple "pages" of results can be navigated through using the next_cursor value in subsequent requests.</para>
 /// <para>Note: Either a screen_name or a user_id should be provided.</para>
 /// <para>Available parameters:</para>
 /// <para>- <c>long</c> id (optional)</para>
 /// <para>- <c>string</c> screen_name (optional)</para>
 /// <para>- <c>bool</c> include_entities (optional)</para>
 /// <para>- <c>bool</c> skip_status (optional)</para>
 /// <para>- <c>long</c> cursor (optional)</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The users.</returns>
 public IEnumerable <User> EnumerateList(EnumerateMode mode, params Expression <Func <string, object> >[] parameters)
 {
     return(Cursored <User> .Enumerate(this.Tokens, "followers/list", mode, parameters));
 }
コード例 #20
0
ファイル: Friendships.cs プロジェクト: yuta-inoue/CoreTweet
 /// <summary>
 /// <para>Enumerate numeric IDs for every protected user for whom the authenticating user has a pending follow request.</para>
 /// <para>Available parameters: </para>
 /// <para>- <c>long</c> cursor (semi-optional)</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The IDs.</returns>
 public IEnumerable <long> EnumerateOutgoing(EnumerateMode mode, params Expression <Func <string, object> >[] parameters)
 {
     return(Cursored <long> .Enumerate(this.Tokens, "friendships/outgoing", mode, parameters));
 }
コード例 #21
0
 /// <summary>
 /// <para>Enumerates user objects for users following the specified user.</para>
 /// <para>At this time, results are ordered with the most recent following first; however, this ordering is subject to unannounced change and eventual consistency issues.</para>
 /// <para>Results are given in groups of 20 users and multiple "pages" of results can be navigated through using the next_cursor value in subsequent requests.</para>
 /// <para>Note: Either a screen_name or a user_id should be provided.</para>
 /// <para>Available parameters:</para>
 /// <para>- <c>long</c> id (optional)</para>
 /// <para>- <c>string</c> screen_name (optional)</para>
 /// <para>- <c>bool</c> include_entities (optional)</para>
 /// <para>- <c>bool</c> skip_status (optional)</para>
 /// <para>- <c>long</c> cursor (optional)</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The users.</returns>
 public IEnumerable <User> EnumerateList <T>(EnumerateMode mode, T parameters)
 {
     return(Cursored <User> .Enumerate <T>(this.Tokens, "followers/list", mode, parameters));
 }
コード例 #22
0
ファイル: Program.cs プロジェクト: aidentity3b/TYMFollower
        /// <summary>
        /// あるアカウントが戸山生がどうか判定する。
        /// </summary>
        /// <param name="user">判定対象のユーザー。</param>
        /// <param name="rateSearch">そのユーザーのフォロワーに占める戸山生の割合を検索に使用する。</param>
        /// <returns></returns>
        static bool IsTym(User user, Tokens tokens = null, List <Tym> GatheredTym = null, bool rateSearch = false)
        {
            string desc = user.Description;

            string[] keywords = { "戸山", "とやま", "tym", "Tym", "TYM", "Toyama", "TOYAMA", "toyama", "めめち", "めめ物", "めめ化", "めめ生", "めめ地学", "めめ地", "めめ数", "めめぶつ", "めめか", "めめなま", "めめちがく" };
            bool     isTym    = false;

            foreach (string keyword in keywords)
            {
                if (desc.Contains(keyword))
                {
                    isTym = true;
                }
            }
            if (isTym)
            {
                Console.ForegroundColor = ConsoleColor.Magenta;
                Console.WriteLine("■プロフィールから戸山生であると推測されます。");
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("□プロフィールから戸山生かどうか判別できませんでした。");
            }

            if (!isTym && rateSearch)
            {
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("□フォロワーに占める既知の戸山生の割合を調査します。");
                if (user.IsProtected)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("□鍵アカのフォロワーは調査できません。スキップします。");
                    return(isTym);
                }
                //フォロワーにしめる戸山生の割合を調べる。
                if (tokens == null || GatheredTym == null)
                {
                    Console.ForegroundColor = ConsoleColor.Gray;
                    throw new NullReferenceException("引数が不正(null)です。");
                }
                Cursored <User> followers = tokens.Followers.List(user_id: user.Id.Value, count: 200);
                int             tymCount  = 0;
                foreach (User follower in followers)
                {
                    if (GatheredTym.Contains(new Tym(follower, false)))
                    {
                        tymCount++;
                    }
                }
                float rate = (float)tymCount / followers.Count;
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("□フォロワーに占める既知の戸山生の割合: " + (rate * 100).ToString());
                if (rate > 0.4f)
                {
                    Console.ForegroundColor = ConsoleColor.Magenta;
                    Console.WriteLine("■フォロワーに占める既知の戸山生の割合から戸山生であると推測されます。");
                    isTym = true;
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("□フォロワーに占める既知の戸山生の割から戸山生かどうか判別できませんでした。");
                }
            }
            Console.ForegroundColor = ConsoleColor.Gray;
            return(isTym);
        }