og-parser

1.0.5 • Public • Published

og-parser

node js module to parse open graph details from given url

Installation

npm install og-parser --save

Usage

var ogParser = require("og-parser");
ogParser("https://www.youtube.com/watch?v=7UaPL5PGywo", function(error, data) {
    console.log(error, data);
  }
});

Ouput

null { title: '5 Most Dangerous Hackers Of All Time - YouTube',
  og: 
   { site_name: 'YouTube',
     url: 'http://www.youtube.com/watch?v=7UaPL5PGywo',
     title: '5 Most Dangerous Hackers Of All Time',
     image: { url: 'https://i.ytimg.com/vi/7UaPL5PGywo/maxresdefault.jpg' },
     description: 'Here are 5 of the most dangerous hackers to ever walk the streets of the Internet. Visit our site: http://TopTrending.com Like us on Facebook: https://www.fa...',
     type: 'video',
     video: [ [Object], [Object] ] },
  al: 
   { ios: 
      { app_store_id: '544007664',
        app_name: 'YouTube',
        url: 'vnd.youtube://www.youtube.com/watch?v=7UaPL5PGywo&feature=applinks' },
     android: 
      { url: 'vnd.youtube://www.youtube.com/watch?v=7UaPL5PGywo&feature=applinks',
        app_name: 'YouTube',
        package: 'com.google.android.youtube' },
     web: { url: 'http://www.youtube.com/watch?v=7UaPL5PGywo&feature=applinks' } },
  twitter: 
   { card: 'player',
     site: { name: '@youtube' },
     url: 'http://www.youtube.com/watch?v=7UaPL5PGywo',
     title: '5 Most Dangerous Hackers Of All Time',
     description: 'Here are 5 of the most dangerous hackers to ever walk the streets of the Internet. Visit our site: http://TopTrending.com Like us on Facebook: https://www.fa...',
     image: 'https://i.ytimg.com/vi/7UaPL5PGywo/maxresdefault.jpg',
     app: { name: [Object], id: [Object], url: [Object] },
     player: 
      { name: 'https://www.youtube.com/embed/7UaPL5PGywo',
        width: '1280',
        height: '720' } },
  images: 
   [ { id: 'logo',
       usemap: '#doodle',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       style: 'background-image: url(https://s.ytimg.com/yts/img/doodles/yt_yoodle_music_awards_2015_1x-vflk--_qN.png); background-size: auto;' },
     { class: 'icon meh',
       src: '//s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-icon': '//s.ytimg.com/yts/img/meh7-vflGevej7.png',
       alt: '' },
     { alt: 'Top Trending',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': 'https://yt3.ggpht.com/-7txXmVVIYCg/AAAAAAAAAAI/AAAAAAAAAAA/QbRvS8aqwP8/s88-c-k-no/photo.jpg',
       width: '48',
       height: '48' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/1zjK0XB-Rv4/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/E6KqOp-bBbQ/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/6MlfhgD2D1o/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/_KGe-NDkREQ/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/zOawkpqtkk4/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/4Q87hpdJpnU/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/6qpudAhYhpc/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/q-dQdSXnhAY/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/Y9wQyPToxyg/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/K0gapPSYkZY/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/3vF8DVzGxk4/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/aB8fplh21hk/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/hqKafI7Amd8/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/wGXW-3HyQ_o/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/K1hiQza6xjQ/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/_qW8yAV8dJM/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/2TdRXosMu08/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/VLXI7-vmFAY/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/SsDZ7-esM_4/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { alt: '',
       src: 'https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif',
       'data-thumb': '//i.ytimg.com/vi_webp/QIqA66eYpC0/default.webp',
       'aria-hidden': 'true',
       width: '120',
       height: '90' },
     { src: '//www.youtube-nocookie.com/gen_204?attributionpartner=Omnia_Media_Affiliate',
       border: '0',
       width: '1',
       height: '1' } ],
  meta: 
   { url: 'http://www.youtube.com/watch?v=7UaPL5PGywo',
     name: '5 Most Dangerous Hackers Of All Time',
     description: 'Here are 5 of the most dangerous hackers to ever walk the streets of the Internet. Visit our site: http://TopTrending.com Like us on Facebook: https://www.fa...',
     paid: 'False',
     channelId: 'UCtg5C-d_3rPUgMaxr285mQQ',
     videoId: '7UaPL5PGywo',
     duration: 'PT4M32S',
     unlisted: 'False',
     author: { url: 'https://plus.google.com/113354316305697462391' },
     thumbnailUrl: 'https://i.ytimg.com/vi/7UaPL5PGywo/maxresdefault.jpg',
     thumbnail: 
      { url: 'https://i.ytimg.com/vi/7UaPL5PGywo/maxresdefault.jpg',
        width: '1280',
        height: '720' },
     embedURL: 'https://www.youtube.com/embed/7UaPL5PGywo',
     playerType: 'HTML5 Flash',
     width: '1280',
     height: '720',
     isFamilyFriendly: 'True',
     regionsAllowed: 'AD,AE,AF,AG,AI,AL,AM,AO,AQ,AR,AS,AT,AU,AW,AX,AZ,BA,BB,BD,BE,BF,BG,BH,BI,BJ,BL,BM,BN,BO,BQ,BR,BS,BT,BV,BW,BY,BZ,CA,CC,CD,CF,CG,CH,CI,CK,CL,CM,CN,CO,CR,CU,CV,CW,CX,CY,CZ,DE,DJ,DK,DM,DO,DZ,EC,EE,EG,EH,ER,ES,ET,FI,FJ,FK,FM,FO,FR,GA,GB,GD,GE,GF,GG,GH,GI,GL,GM,GN,GP,GQ,GR,GS,GT,GU,GW,GY,HK,HM,HN,HR,HT,HU,ID,IE,IL,IM,IN,IO,IQ,IR,IS,IT,JE,JM,JO,JP,KE,KG,KH,KI,KM,KN,KP,KR,KW,KY,KZ,LA,LB,LC,LI,LK,LR,LS,LT,LU,LV,LY,MA,MC,MD,ME,MF,MG,MH,MK,ML,MM,MN,MO,MP,MQ,MR,MS,MT,MU,MV,MW,MX,MY,MZ,NA,NC,NE,NF,NG,NI,NL,NO,NP,NR,NU,NZ,OM,PA,PE,PF,PG,PH,PK,PL,PM,PN,PR,PS,PT,PW,PY,QA,RE,RO,RS,RU,RW,SA,SB,SC,SD,SE,SG,SH,SI,SJ,SK,SL,SM,SN,SO,SR,SS,ST,SV,SX,SY,SZ,TC,TD,TF,TG,TH,TJ,TK,TL,TM,TN,TO,TR,TT,TV,TW,TZ,UA,UG,UM,US,UY,UZ,VA,VC,VE,VG,VI,VN,VU,WF,WS,YE,YT,ZA,ZM,ZW',
     interactionCount: '1731026',
     datePublished: '2015-02-15',
     genre: 'Education' } }

Versions

1.0.5

  • Added logic to parse more meta information from body.
  • Added logic to scrap out all the images used in the page.

Package Sidebar

Install

npm i og-parser

Weekly Downloads

1

Version

1.0.5

License

Apache-2.0

Last publish

Collaborators

  • chitranshu.asthana