Ejemplo n.º 1
0
 /// <summary>
 /// 指定したscreen_nameのユーザのツイートを指定個数取得する。(Retryあり)
 /// </summary>
 /// <param name="token"></param>
 /// <param name="user_id"></param>
 /// <param name="maxCount"></param>
 /// <param name="sleep"></param>
 /// <param name="report"></param>
 /// <returns></returns>
 public static IEnumerable<Status> GetUserTimeLines(List<Tokens> tokens, ulong user_id, int maxCount, TimeSpan sleep, Action<string> report)
 {
     var list2 = tokens.UserTimelineRetry(sleep, report, id => user_id, count => 100, exclude_replies => true, include_rts => false);
     int c = 0;
     long maxId = long.MaxValue;
     foreach (var item in list2)
     {
         maxId = item.Id;
         c++;
         yield return item;
     }
     while (true)
     {
         list2 = tokens.UserTimelineRetry(sleep, report, id => user_id, count => 100, max_id => (maxId - 1).ToString(), exclude_replies => true, include_rts => false);
         int c1 = 0;
         foreach (var item in list2)
         {
             maxId = item.Id;
             yield return item;
             c++;
             c1++;
             if (maxCount <= c) break;
         }
         if (c1 < 20) break;
         if (maxCount <= c) break;
     }
 }