Over a million developers have joined DZone.

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

Verify, standardize, and correct the Big 4 + more– name, email, phone and global addresses – try our Data Quality APIs now at Melissa Developer Portal!

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.



Developers! Quickly and easily gain access to the tools and information you need! Explore, test and combine our data quality APIs at Melissa Developer Portal – home to tools that save time and boost revenue. Our APIs verify, standardize, and correct the Big 4 + more – name, email, phone and global addresses – to ensure accurate delivery, prevent blacklisting and identify risks in real-time.

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 }}