All Downloads are FREE. Search and download functionalities are using the official Maven repository.

talystcode.streaming-facebook_2.11.0.0.3.source-code.FacebookDemo.scala Maven / Gradle / Ivy

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