Created
March 10, 2014 17:28
-
-
Save aoisensi/9469767 to your computer and use it in GitHub Desktop.
C#でTwitterのお互いをRTしあってるスパムアカウントを探すコード CoreTweetが必要です コンスマキーも特にあれです MIT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PIN?:4860011 | |
Success. | |
First Node User? (a.k.a "@aoisensi") | |
@rtktkr1000 | |
rtktkr1000 | |
yappa__suki | |
animals_kyun | |
yasutoshi131312 | |
chotto_eehanasi | |
BotTerracehouse | |
eeyanwa | |
kaunntodaunn_ | |
koukousakka_ | |
ginesu1_ | |
yasuyasuyasu121 | |
rinathi_fan | |
daikikunn_fan | |
LINE_bakushou | |
gennka_ | |
kyuusha_tokushu | |
yousann_fan | |
Complite. Please push any key. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Text; | |
using System.Threading.Tasks; | |
using CoreTweet; | |
namespace FindSpam | |
{ | |
class Program | |
{ | |
readonly static string CONSUMER_KEY = "lfzmEWSyrpXBcz07LiQ"; | |
readonly static string CONSUMER_SECRET = "faOlusPmoFOsKskoc1aLEmwKtvK7rOOWKkue5etI"; | |
static List<string> spams = new List<string>(); | |
static void Main() | |
{ | |
var session = OAuth.Authorize(CONSUMER_KEY, CONSUMER_SECRET); | |
System.Diagnostics.Process.Start(session.AuthorizeUri.AbsoluteUri); | |
Console.Write("PIN?:"); | |
var twitter = session.GetTokens(Console.ReadLine()); | |
Console.WriteLine("Success."); | |
Console.WriteLine("First Node User? (a.k.a \"@aoisensi\")"); | |
Console.Write('@'); | |
var name = Console.ReadLine(); | |
Find(twitter, name); | |
Console.WriteLine("Complite. Please push any key."); | |
Console.ReadKey(); | |
} | |
static void Find(Tokens twitter, string name) | |
{ | |
//すでに探索済みの場合スキップする | |
if (spams.Contains(name)) | |
return; | |
var tweets = twitter.Statuses.UserTimeline(screen_name => name); | |
var rted = tweets.Take(20).Where(tw => tw.RetweetedStatus != null).Select(tw => tw.RetweetedStatus).ToArray(); | |
//最初の20個のツイートの内、リツイート数が10個以下ならスキップする | |
if (rted.Count() < 12) | |
return; | |
spams.Add(name); | |
Console.WriteLine(name); | |
foreach(var u in rted.Select(tw => tw.User).Distinct()) | |
{ | |
Find(twitter, u.ScreenName); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment