Ejemplo n.º 1
0
        public IEnumerable <string> ReadAPI()
        {
            var login = this.GetUpperRawler <TwitterLogin>();

            if (login == null)
            {
                ReportManage.ErrReport(this, "TwitterLoginをTweetUserTimelineの上流に配置してください");
                yield break;
            }

            Dictionary <string, object> dic = new Dictionary <string, object>()
            {
                { "cursor", cursor },
                { "count", 5000 }
            };

            if (ScreenName.IsNullOrEmpty() == false)
            {
                dic.Add("screen_name", ScreenName.Convert(this));
            }
            else if (UserId.IsNullOrEmpty() == false)
            {
                dic.Add("user_id", UserId.Convert(this));
            }
            else
            {
                if (ParentUserIdType == RawlerTwitter.ParentUserIdType.ScreenName)
                {
                    dic.Add("screen_name", GetText());
                }
                else if (ParentUserIdType == RawlerTwitter.ParentUserIdType.UserId)
                {
                    dic.Add("user_id", GetText());
                }
            }
            var result = login.Token.Friends.Ids(dic);

            foreach (var item in result.Result)
            {
                yield return(item.ToString());
            }
            if (result.NextCursor > 0)
            {
                cursor = result.NextCursor;
            }
            else
            {
                cursor = -1;
            }
        }