Package org.opengraph

Examples of org.opengraph.OpenGraph


import static org.junit.Assert.*;

public class OpenGraphTest {
  @Test
  public void shouldHandleMissingContentType() throws java.lang.Exception {
    OpenGraph site = new OpenGraph("http://www.bbc.com/future/story/20140428-the-myth-of-tech-revolutions", true);
    assertEquals("Why it’s time to ditch the word ‘revolution’ in tech", site.getContent("title"));
    assertEquals("624", site.getContent("image:width"));
  }
View Full Code Here


    assertEquals("624", site.getContent("image:width"));
  }

  @Test
  public void shouldNoOGMarkup() throws java.lang.Exception {
    OpenGraph site = new OpenGraph("http://clang.llvm.org/docs/UsersManual.html", true);
    assertNull(site.getContent("title"));
  }
View Full Code Here

 
  public static void main(String [] args)
  {
    try
    {
      OpenGraph movie = new OpenGraph(uri, true);
      System.out.println("Movie: " + movie.getContent("title"));
      for (MetaElement director : movie.getProperties("director"))
      {
        OpenGraph extendedInfo = director.getExtendedData();
        System.out.println("Directed by: " + extendedInfo.getContent("title"));
      }
     
      for (MetaElement member : movie.getProperties("cast"))
      {
        OpenGraph extendedInfo = member.getExtendedData();
        System.out.println("Starring: " + extendedInfo.getContent("title"));
      }
     
    }
    catch (Exception e)
    {
View Full Code Here

TOP

Related Classes of org.opengraph.OpenGraph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.