Tiny library which fetches open graph data from the specified URL, powered by akka-http client and WebDriver
What this library can do, compared to Akka Open Graph Fetcher
This library can parse asynchronously-rendered HTML body using WebDriver, so it can fetch correct open graph from web pages like Google Map.
UTF-8
- This library internally uses jBrowserDriver.
- jBrowserDriver currently cannot detect correct encoding (see this issue).
- Hence
akka-webdriver-open-graph-fetcher
cannot either.
import akka.actor.ActorSystem
import scala.concurrent.Await
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
import com.github.tkqubo.akka_open_graph_fetcher._
implicit val system = ActorSystem("console")
val fetcher = WebDriverOpenGraphFetcher()
val future = fetcher.fetch("https://www.google.co.jp/maps/place/Higashi-ginza+Station")
val openGraph = Await.result(future, Duration.Inf)
println(openGraph.url)
println(openGraph.title)
println(openGraph.description)
println(openGraph.image)
println(openGraph.error)
// https://www.google.co.jp/maps/place/Higashi-ginza+Station
// Some(東銀座駅)
// Some(〒104-0061 東京都中央区銀座4丁目10 東銀座駅)
// Some(https://maps.google.com/maps/api/staticmap?sensor=false¢er=35.6697002801969%2C139.76495121525855&zoom=16&size=256x256&language=ja&markers=35.669700299999995%2C139.7671399&client=google-maps-frontend&signature=sAUn5_JMlqwmTV4XMqdAnAcdDyE)
// None