コード例 #1
0
ファイル: Program.cs プロジェクト: jeason0813/SocioBoard
        private static void twitterreport()
        {
            Api.TwitterReport.TwitterReport profiles = new Api.TwitterReport.TwitterReport();
            List <string> profileids     = (List <string>) new JavaScriptSerializer().Deserialize(profiles.getprofileids(), typeof(List <string>));
            string        totalfollowers = string.Empty;
            string        totalfollowing = string.Empty;

            foreach (string profileid in profileids)
            {
                Domain.Socioboard.Domain.TwitterReport insert = new Domain.Socioboard.Domain.TwitterReport();
                profiles.Timeout = -1;
                try
                {
                    totalfollowers = profiles.gettotalfollowers(profileid);
                    totalfollowing = profiles.gettotalfollowing(profileid);
                    Console.WriteLine("totalfollowers =" + totalfollowers);
                    Console.WriteLine("totalfollowing =" + totalfollowing);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                profiles.Timeout = -1;

                try
                {
                    Domain.Socioboard.Domain.ReturnData r = (Domain.Socioboard.Domain.ReturnData)(new JavaScriptSerializer().Deserialize(profiles.newfollower(profileid), typeof(Domain.Socioboard.Domain.ReturnData)));
                    Console.WriteLine("1");
                    profiles.Timeout = -1;

                    Domain.Socioboard.Domain.ReturnData r0 = (Domain.Socioboard.Domain.ReturnData)(new JavaScriptSerializer().Deserialize(profiles.youfollowed(profileid), typeof(Domain.Socioboard.Domain.ReturnData)));
                    Console.WriteLine("1");
                    profiles.Timeout = -1;


                    Domain.Socioboard.Domain.ReturnData r1 = (Domain.Socioboard.Domain.ReturnData)(new JavaScriptSerializer().Deserialize(profiles.directmessage(profileid), typeof(Domain.Socioboard.Domain.ReturnData)));
                    Console.WriteLine("2");
                    profiles.Timeout = -1;

                    Domain.Socioboard.Domain.ReturnData r2 = (Domain.Socioboard.Domain.ReturnData)(new JavaScriptSerializer().Deserialize(profiles.directmessagesent(profileid), typeof(Domain.Socioboard.Domain.ReturnData)));
                    Console.WriteLine("3");
                    profiles.Timeout = -1;

                    Domain.Socioboard.Domain.ReturnData r3 = (Domain.Socioboard.Domain.ReturnData)(new JavaScriptSerializer().Deserialize(profiles.twittermention(profileid), typeof(Domain.Socioboard.Domain.ReturnData)));
                    Console.WriteLine("4");
                    profiles.Timeout = -1;

                    Domain.Socioboard.Domain.ReturnData r4 = (Domain.Socioboard.Domain.ReturnData)(new JavaScriptSerializer().Deserialize(profiles.twitterretweets(profileid), typeof(Domain.Socioboard.Domain.ReturnData)));
                    Console.WriteLine("4");
                    profiles.Timeout = -1;

                    Domain.Socioboard.Domain.ReturnData r5 = (Domain.Socioboard.Domain.ReturnData)(new JavaScriptSerializer().Deserialize(profiles.clicks(profileid), typeof(Domain.Socioboard.Domain.ReturnData)));
                    Console.WriteLine("5");
                    profiles.Timeout = -1;

                    Domain.Socioboard.Domain.ReturnData r6 = (Domain.Socioboard.Domain.ReturnData)(new JavaScriptSerializer().Deserialize(profiles.messagerecieved(profileid), typeof(Domain.Socioboard.Domain.ReturnData)));
                    Console.WriteLine("6");
                    profiles.Timeout = -1;

                    Domain.Socioboard.Domain.ReturnData r7 = (Domain.Socioboard.Domain.ReturnData)(new JavaScriptSerializer().Deserialize(profiles.messagesent(profileid), typeof(Domain.Socioboard.Domain.ReturnData)));
                    Console.WriteLine("7");


                    insert.Id = Guid.NewGuid();
                    insert.twitterprofileid = profileid;
                    insert.totalfollower    = Int32.Parse(totalfollowers);
                    insert.totalconnection  = Int32.Parse(totalfollowing);

                    insert.newfollower_15        = r._15;
                    insert.newfollower_30        = r._30;
                    insert.newfollower_60        = r._60;
                    insert.newfollower_90        = r._90;
                    insert.perday_newfollower_15 = r.perday_15;
                    insert.perday_newfollower_30 = r.perday_30;
                    insert.perday_newfollower_60 = r.perday_60;
                    insert.perday_newfollower_90 = r.perday_90;

                    insert.following_15        = r0._15;
                    insert.following_30        = r0._30;
                    insert.following_60        = r0._60;
                    insert.following_90        = r0._90;
                    insert.perday_following_15 = r0.perday_15;
                    insert.perday_following_30 = r0.perday_30;
                    insert.perday_following_60 = r0.perday_60;
                    insert.perday_following_90 = r0.perday_90;


                    insert.directmessage_15        = r1._15;
                    insert.directmessage_30        = r1._30;
                    insert.directmessage_60        = r1._60;
                    insert.directmessage_90        = r1._90;
                    insert.perday_directmessage_15 = r1.perday_15;
                    insert.perday_directmessage_30 = r1.perday_30;
                    insert.perday_directmessage_60 = r1.perday_60;
                    insert.perday_directmessage_90 = r1.perday_90;

                    insert.directmessagesent_15        = r2._15;
                    insert.directmessagesent_30        = r2._30;
                    insert.directmessagesent_60        = r2._60;
                    insert.directmessagesent_90        = r2._90;
                    insert.perday_directmessagesent_15 = r2.perday_15;
                    insert.perday_directmessagesent_30 = r2.perday_30;
                    insert.perday_directmessagesent_60 = r2.perday_60;
                    insert.perday_directmessagesent_90 = r2.perday_90;


                    insert.mention_15        = r3._15;
                    insert.mention_30        = r3._30;
                    insert.mention_60        = r3._60;
                    insert.mention_90        = r3._90;
                    insert.perday_mention_15 = r3.perday_15;
                    insert.perday_mention_30 = r3.perday_30;
                    insert.perday_mention_60 = r3.perday_60;
                    insert.perday_mention_90 = r3.perday_90;

                    insert.retweets_15        = r4._15;
                    insert.retweets_30        = r4._30;
                    insert.retweets_60        = r4._60;
                    insert.retweets_90        = r4._90;
                    insert.perday_retweets_15 = r4.perday_15;
                    insert.perday_retweets_30 = r4.perday_30;
                    insert.perday_retweets_60 = r4.perday_60;
                    insert.perday_retweets_90 = r4.perday_90;

                    insert.click_15        = r5._15;
                    insert.click_30        = r5._30;
                    insert.click_60        = r5._60;
                    insert.click_90        = r5._90;
                    insert.perday_click_15 = r5.perday_15;
                    insert.perday_click_30 = r5.perday_30;
                    insert.perday_click_60 = r5.perday_60;
                    insert.perday_click_90 = r5.perday_90;

                    insert.messagerecieved_15        = r6._15;
                    insert.messagerecieved_30        = r6._30;
                    insert.messagerecieved_60        = r6._60;
                    insert.messagerecieved_90        = r6._90;
                    insert.perday_messagerecieved_15 = r6.perday_15;
                    insert.perday_messagerecieved_30 = r6.perday_30;
                    insert.perday_messagerecieved_60 = r6.perday_60;
                    insert.perday_messagerecieved_90 = r6.perday_90;

                    insert.messagesent_15        = r7._15;
                    insert.messagesent_30        = r7._30;
                    insert.messagesent_60        = r7._60;
                    insert.messagesent_90        = r7._90;
                    insert.perday_messagesent_15 = r7.perday_15;
                    insert.perday_messagesent_30 = r7.perday_30;
                    insert.perday_messagesent_60 = r7.perday_60;
                    insert.perday_messagesent_90 = r7.perday_90;



                    string senddata = new JavaScriptSerializer().Serialize(insert);
                    //    Console.WriteLine("Insert");
                    profiles.insertdata(senddata);
                    profiles.top_five_fans(profileid);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                Thread.Sleep(5 * 1000);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: prog-moh/socioboard-core
        private static void twitterreport()
        {
            Api.TwitterReport.TwitterReport profiles = new Api.TwitterReport.TwitterReport();
            List<string> profileids = (List<string>)new JavaScriptSerializer().Deserialize(profiles.getprofileids(), typeof(List<string>));
            string totalfollowers = string.Empty;
            string totalfollowing = string.Empty;
            foreach (string profileid in profileids)
            {

                Domain.Socioboard.Domain.TwitterReport insert = new Domain.Socioboard.Domain.TwitterReport();
                profiles.Timeout = -1;
                try
                {

                    totalfollowers = profiles.gettotalfollowers(profileid);
                    totalfollowing = profiles.gettotalfollowing(profileid);
                    Console.WriteLine("totalfollowers =" + totalfollowers);
                    Console.WriteLine("totalfollowing =" + totalfollowing);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                profiles.Timeout = -1;

                try
                {
                    Domain.Socioboard.Domain.ReturnData r = (Domain.Socioboard.Domain.ReturnData)(new JavaScriptSerializer().Deserialize(profiles.newfollower(profileid), typeof(Domain.Socioboard.Domain.ReturnData)));
                    Console.WriteLine("1");
                    profiles.Timeout = -1;

                    Domain.Socioboard.Domain.ReturnData r0 = (Domain.Socioboard.Domain.ReturnData)(new JavaScriptSerializer().Deserialize(profiles.youfollowed(profileid), typeof(Domain.Socioboard.Domain.ReturnData)));
                    Console.WriteLine("1");
                    profiles.Timeout = -1;


                    Domain.Socioboard.Domain.ReturnData r1 = (Domain.Socioboard.Domain.ReturnData)(new JavaScriptSerializer().Deserialize(profiles.directmessage(profileid), typeof(Domain.Socioboard.Domain.ReturnData)));
                    Console.WriteLine("2");
                    profiles.Timeout = -1;

                    Domain.Socioboard.Domain.ReturnData r2 = (Domain.Socioboard.Domain.ReturnData)(new JavaScriptSerializer().Deserialize(profiles.directmessagesent(profileid), typeof(Domain.Socioboard.Domain.ReturnData)));
                    Console.WriteLine("3");
                    profiles.Timeout = -1;

                    Domain.Socioboard.Domain.ReturnData r3 = (Domain.Socioboard.Domain.ReturnData)(new JavaScriptSerializer().Deserialize(profiles.twittermention(profileid), typeof(Domain.Socioboard.Domain.ReturnData)));
                    Console.WriteLine("4");
                    profiles.Timeout = -1;

                    Domain.Socioboard.Domain.ReturnData r4 = (Domain.Socioboard.Domain.ReturnData)(new JavaScriptSerializer().Deserialize(profiles.twitterretweets(profileid), typeof(Domain.Socioboard.Domain.ReturnData)));
                    Console.WriteLine("4");
                    profiles.Timeout = -1;

                    Domain.Socioboard.Domain.ReturnData r5 = (Domain.Socioboard.Domain.ReturnData)(new JavaScriptSerializer().Deserialize(profiles.clicks(profileid), typeof(Domain.Socioboard.Domain.ReturnData)));
                    Console.WriteLine("5");
                    profiles.Timeout = -1;

                    Domain.Socioboard.Domain.ReturnData r6 = (Domain.Socioboard.Domain.ReturnData)(new JavaScriptSerializer().Deserialize(profiles.messagerecieved(profileid), typeof(Domain.Socioboard.Domain.ReturnData)));
                    Console.WriteLine("6");
                    profiles.Timeout = -1;

                    Domain.Socioboard.Domain.ReturnData r7 = (Domain.Socioboard.Domain.ReturnData)(new JavaScriptSerializer().Deserialize(profiles.messagesent(profileid), typeof(Domain.Socioboard.Domain.ReturnData)));
                    Console.WriteLine("7");


                    insert.Id = Guid.NewGuid();
                    insert.twitterprofileid = profileid;
                    insert.totalfollower = Int32.Parse(totalfollowers);
                    insert.totalconnection = Int32.Parse(totalfollowing);

                    insert.newfollower_15 = r._15;
                    insert.newfollower_30 = r._30;
                    insert.newfollower_60 = r._60;
                    insert.newfollower_90 = r._90;
                    insert.perday_newfollower_15 = r.perday_15;
                    insert.perday_newfollower_30 = r.perday_30;
                    insert.perday_newfollower_60 = r.perday_60;
                    insert.perday_newfollower_90 = r.perday_90;

                    insert.following_15 = r0._15;
                    insert.following_30 = r0._30;
                    insert.following_60 = r0._60;
                    insert.following_90 = r0._90;
                    insert.perday_following_15 = r0.perday_15;
                    insert.perday_following_30 = r0.perday_30;
                    insert.perday_following_60 = r0.perday_60;
                    insert.perday_following_90 = r0.perday_90;


                    insert.directmessage_15 = r1._15;
                    insert.directmessage_30 = r1._30;
                    insert.directmessage_60 = r1._60;
                    insert.directmessage_90 = r1._90;
                    insert.perday_directmessage_15 = r1.perday_15;
                    insert.perday_directmessage_30 = r1.perday_30;
                    insert.perday_directmessage_60 = r1.perday_60;
                    insert.perday_directmessage_90 = r1.perday_90;

                    insert.directmessagesent_15 = r2._15;
                    insert.directmessagesent_30 = r2._30;
                    insert.directmessagesent_60 = r2._60;
                    insert.directmessagesent_90 = r2._90;
                    insert.perday_directmessagesent_15 = r2.perday_15;
                    insert.perday_directmessagesent_30 = r2.perday_30;
                    insert.perday_directmessagesent_60 = r2.perday_60;
                    insert.perday_directmessagesent_90 = r2.perday_90;


                    insert.mention_15 = r3._15;
                    insert.mention_30 = r3._30;
                    insert.mention_60 = r3._60;
                    insert.mention_90 = r3._90;
                    insert.perday_mention_15 = r3.perday_15;
                    insert.perday_mention_30 = r3.perday_30;
                    insert.perday_mention_60 = r3.perday_60;
                    insert.perday_mention_90 = r3.perday_90;

                    insert.retweets_15 = r4._15;
                    insert.retweets_30 = r4._30;
                    insert.retweets_60 = r4._60;
                    insert.retweets_90 = r4._90;
                    insert.perday_retweets_15 = r4.perday_15;
                    insert.perday_retweets_30 = r4.perday_30;
                    insert.perday_retweets_60 = r4.perday_60;
                    insert.perday_retweets_90 = r4.perday_90;

                    insert.click_15 = r5._15;
                    insert.click_30 = r5._30;
                    insert.click_60 = r5._60;
                    insert.click_90 = r5._90;
                    insert.perday_click_15 = r5.perday_15;
                    insert.perday_click_30 = r5.perday_30;
                    insert.perday_click_60 = r5.perday_60;
                    insert.perday_click_90 = r5.perday_90;

                    insert.messagerecieved_15 = r6._15;
                    insert.messagerecieved_30 = r6._30;
                    insert.messagerecieved_60 = r6._60;
                    insert.messagerecieved_90 = r6._90;
                    insert.perday_messagerecieved_15 = r6.perday_15;
                    insert.perday_messagerecieved_30 = r6.perday_30;
                    insert.perday_messagerecieved_60 = r6.perday_60;
                    insert.perday_messagerecieved_90 = r6.perday_90;

                    insert.messagesent_15 = r7._15;
                    insert.messagesent_30 = r7._30;
                    insert.messagesent_60 = r7._60;
                    insert.messagesent_90 = r7._90;
                    insert.perday_messagesent_15 = r7.perday_15;
                    insert.perday_messagesent_30 = r7.perday_30;
                    insert.perday_messagesent_60 = r7.perday_60;
                    insert.perday_messagesent_90 = r7.perday_90;

                   

                    string senddata = new JavaScriptSerializer().Serialize(insert);
                    //    Console.WriteLine("Insert");
                    profiles.insertdata(senddata);
                    profiles.top_five_fans(profileid);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                Thread.Sleep(5 * 1000);
            }


        }