talystcode.streaming-facebook_2.11.0.0.3.source-code.FacebookDemo.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of streaming-facebook_2.11 Show documentation
Show all versions of streaming-facebook_2.11 Show documentation
A library for reading social data from Facebook using Spark Streaming.
The newest version!
import com.github.catalystcode.fortis.spark.streaming.facebook.FacebookAuth
import org.apache.log4j.{BasicConfigurator, Level, Logger}
object FacebookDemo {
def main(args: Array[String]) {
val mode = args.headOption.getOrElse("")
// configure page for which to ingest posts
val pageIds = List("aljazeera", "TheEconomist")
// configure interaction with facebook api
val auth = FacebookAuth(accessToken = System.getenv("FACEBOOK_AUTH_TOKEN"), appId = System.getenv("FACEBOOK_APP_ID"), appSecret = System.getenv("FACEBOOK_APP_SECRET"))
// configure logging
BasicConfigurator.configure()
Logger.getRootLogger.setLevel(Level.ERROR)
Logger.getLogger("libfacebook").setLevel(Level.DEBUG)
if (mode.contains("standalone")) new FacebookDemoStandalone(pageIds.head, auth).run()
if (mode.contains("spark")) new FacebookDemoSpark(pageIds.toSet, auth).run()
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy