Last active
August 29, 2015 14:19
-
-
Save zaltoprofen/0f5a5ea26b91ac08eb83 to your computer and use it in GitHub Desktop.
enumerate the urls of π£ and π from twitter.
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
| import twitter4j._ | |
| object Main{ | |
| def main(args: Array[String]): Unit = { | |
| val t = new TwitterStreamFactory().getInstance | |
| t.addListener(new UserStreamAdapter { | |
| override def onStatus(status: Status): Unit = { | |
| val urls = status.getMediaEntities().collect { case e:MediaEntity if e.getType == "photo" => e.getMediaURL } | |
| val eurls = status.getExtendedMediaEntities().collect { case e:ExtendedMediaEntity if e.getType == "photo" => e.getMediaURL } | |
| (urls ++ eurls).distinct.foreach(println) | |
| } | |
| }) | |
| val q = new FilterQuery().track(Array[String]("ε―ΏεΈ", "γ©γΌγ‘γ³")) | |
| t.filter(q) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment