2016년 10월 30일 일요일

CORS 없이 Meta 정보 취득 | Get Meta Information without CORS

1. Yahoo API

Get the result of Yahoo API via AJAX.

YQL Query

select * from html where url='http://www.google.com' and xpath='*'

Endpoint

https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D'http%3A%2F%2Fwww.google.com'%20and%20xpath%3D'*'&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys

JSON Result

 "query": {
  "count": 1,
  "created": "2016-10-30T13:47:54Z",
  "lang": "en-US",
  "results": {
   "html": {
    "itemscope": "",
    "itemtype": "http://schema.org/WebPage",
    "lang": "en-SG",
    "head": {
     "meta": [
      {
       "content": "/logos/doodles/2016/halloween-2016-5643419163557888.4-hp.png",
       "itemprop": "image"
      },
      {
       "content": "Happy Halloween 2016! #GoogleDoodle",
       "property": "og:description"
      },
      {
       "content": "http://www.google.com/logos/doodles/2016/halloween-2016-5643419163557888.7-thp.png",
       "property": "og:image"
      },
 ...

2. jQuery-LiveUrl

Filter url and image and provide a preview from textarea like Facebook.

댓글 없음:

댓글 쓰기