Beispiel #1
0
 public TwitterFeedDriver()
 {
     thr         = Thread.CurrentThread;
     da          = new DataAnalyzer();
     up          = new urlProcess();
     dm          = new DataModel();
     ic          = new io_class();
     er          = new emojiRef();
     dc          = new dataCollection();
     dd          = new DisplayData();
     hp          = new HashtagProcess();
     tac         = new tweetAvgCalc();
     token       = "AAAAAAAAAAAAAAAAAAAAAJADKgEAAAAAD4w2DLjwp9rtzAPQFnnlqUaF32c%3DUO6irrSGMTKi4LYutW1K0EZpGbajPMotfdlJlqen26pn7iokyR";
     twitterPath = "https://api.twitter.com/2/tweets/sample/stream";
     dm.seconds  = 0;
     StartStreaming();
 }
Beispiel #2
0
 public emojiRef initER()
 {
     er = new emojiRef();
     return(er);
 }
        //dm.outputFeed += outputText;
        public async void processData(List <string> FeedList, DataModel dm, DataAnalyzer da, emojiRef er, urlProcess up)
        {
            var backFeed = await passList(FeedList);

            string outputText = "";
            await Task.Run(() =>
            {
                foreach (string ele in backFeed)
                {
                    StrippedText   = da.TextStrip(ele) + " ";
                    dm.totalMedia += da.SearchForPicUrl(StrippedText);
                    dm.fCount     += da.mentionedWord(StrippedText, "f**k");
                    dm.trumpCount += da.mentionedWord(StrippedText, "trump");
                    dm.bidenCount += da.mentionedWord(StrippedText, "biden");
                    //pngCount += da.mentionedWord(StrippedText, ".png");
                    //jpgCount += da.mentionedWord(StrippedText, ".jpg");
                    percentUrl    = up.urlTracker(StrippedText, dm.totalTweet);
                    er.emojiTally = da.tallyEmoji(StrippedText, er.emojiTally, er.emojiName, dm.totalTweet).Item1;
                    //h += da.tallyEmoji(StrippedText, er.emojiTally, er.emojiName, dm.totalTweet).Item2;
                    dm.totalEmoji += da.tallyEmoji(StrippedText, er.emojiTally, er.emojiName, dm.totalTweet).Item3;
                    tu             = up.topUrl();
                    te             = da.topEmojis(er.emojiName, er.emojiTally);
                    outputText    += StrippedText + "\r\n" + "-----------------------------------------------------------\r\n";
                }
            });

            percentTweet     = ((100 / float.Parse(dm.totalTweet.ToString()))) * dm.totalEmoji;
            percentTweet     = float.Parse(Math.Round(percentTweet, 2).ToString());
            dm.percentTweet  = percentTweet;
            dm.backfeedCount = backFeed.Count;
            dm.totalTweet   += backFeed.Count;
            foreach (string s in te)
            {
                dm.topE += "    " + s + "\r\n";
            }

            foreach (string s in tu)
            {
                dm.top3Url += "    " + s + "\r\n";
            }
            //configure shutoff for the following
            dm.outputFeed += outputText;
            backFeed.Clear();
        }