Skip to content

Instantly share code, notes, and snippets.

@kamiyaowl
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamiyaowl/3ade64da6d19c3c094af to your computer and use it in GitHub Desktop.
Save kamiyaowl/3ade64da6d19c3c094af to your computer and use it in GitHub Desktop.
黒歴史クリーナーっぽいの
name := "deleter"
version := "0.1"
libraryDependencies ++= Seq(
"org.twitter4j" % "twitter4j-core" % "4.0.1" ,
)
import twitter4j._
object Deleter {
def toLong(str:String) : Either[Exception,Long] = try Right(str.toLong) catch { case e:Exception => Left(e)}
def main(args:Array[String]) : Unit = {
val t = TwitterFactory.getSingleton
val tr = t.tweets
io.Source.fromFile("tweets.csv").getLines.toStream
.map(_.split(',')(0)).tail
.map(_.replaceAll("\"","")).map(toLong(_).fold(_ => None, Some(_)))
.filter(_ match { case Some(x) => true; case _ => false}).map(_.get)
.zipWithIndex.par.foreach(x => {
val id : Long = x._1
val index = x._2
try {
val re = tr.destroyStatus(id)
println(s"[$index] : $id ${re.getText}")
} catch {
case x => Unit
}
})
}
}
debug=false
oauth.consumerKey=XXXXXXXX
oauth.consumerSecret=XXXXXXXXXX
oauth.accessToken=XXXXXXXXXX
oauth.accessTokenSecret=XXXXXXXXXX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment