Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Retrieving Data Using Akka-HTTP, Open Graph, and Scala

DZone's Guide to

Retrieving Data Using Akka-HTTP, Open Graph, and Scala

Using standard Scala with the AKKA-HTTP library you can retrieve any metadata and open graph data — useful for cleanly parsing web pages and getting content provider annotated data.

· Java Zone ·
Free Resource

Atomist automates your software deliver experience. It's how modern teams deliver modern software.

In this blog, we are using Akka-HTTP and the Open Graph protocol to retrieve data from a URL.

Open Graph Protocol

The Open Graph protocol enables any web page to become a rich object in a social graph. For instance, this is used on Facebook to allow any web page to have the same functionality as any other object on Facebook.

While many different technologies and schemas exist and could be combined together, there isn’t a single technology that provides enough information to richly represent any web page within the social graph.

With the help of the Open Graph protocol and Akka-HTTP, I developed a mini project that can retrieve data from a URL, like:

1. https://www.youtube.com/

2. https://soundcloud.com/stream

You can find the complete code here.

The build.sbt file of the project contains all dependencies.

Image title

The UrlMetaDataActor.scala file gets the data from the URL.

Image title

Now, let's look at an example of the tool doing its work:

Image title

And there you have it! You've pulled metadata from a URL with Scala, Akka-HTTP, and the Open Graph protocol.

Resources

Thanks!

Get the open source Atomist Software Delivery Machine and start automating your delivery right there on your own laptop, today!

Topics:
scala ,akka ,open graph ,java

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}