jacktuck / unfurl

Metadata scraper with support for oEmbed, Twitter Cards and Open Graph Protocol for Node.js :zap:
MIT License
474 stars 51 forks source link

Youtube OEmbed not picked up #69

Closed trieloff closed 3 years ago

trieloff commented 3 years ago

Even with #67 fixed, OEmbed for YouTube is not working.

trieloff commented 3 years ago

From #67:

<link
      rel="alternate"
      type="application/json+oembed"
      href="http://www.youtube.com/oembed?format=json&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DccYpEv4APec"
      title='Google Translate Sings: "The Sound of Silence" (Simon &amp; Garfunkel)'
    />

Trying the HTTP URL YouTube provides yields:

$ http "http://www.youtube.com/oembed?format=json&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DccYpEv4APec"
HTTP/1.1 403 Forbidden
Cache-Control: private
Content-Encoding: gzip
Content-Length: 132
Content-Type: application/json; charset=UTF-8
Date: Wed, 06 Jan 2021 09:58:05 GMT
Server: scaffolding on HTTPServer2
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 0

{
    "error": {
        "code": 403,
        "message": "SSL is required to perform this operation.",
        "status": "PERMISSION_DENIED"
    }
}

Upgrading to HTTPS makes it work:

$ http "https://www.youtube.com/oembed?format=json&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DccYpEv4APec"
HTTP/1.1 200 OK
Alt-Svc: h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Cache-Control: private
Content-Encoding: gzip
Content-Type: application/json
Date: Wed, 06 Jan 2021 10:01:37 GMT
Server: scaffolding on HTTPServer2
Transfer-Encoding: chunked
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 0

{
    "author_name": "Twisted Translations",
    "author_url": "https://www.youtube.com/c/twistedtranslations",
    "height": 113,
    "html": "<iframe width=\"200\" height=\"113\" src=\"https://www.youtube.com/embed/ccYpEv4APec?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>",
    "provider_name": "YouTube",
    "provider_url": "https://www.youtube.com/",
    "thumbnail_height": 360,
    "thumbnail_url": "https://i.ytimg.com/vi/ccYpEv4APec/hqdefault.jpg",
    "thumbnail_width": 480,
    "title": "Google Translate Sings: \"The Sound of Silence\" (Simon & Garfunkel)",
    "type": "video",
    "version": "1.0",
    "width": 200
}

🤦

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 5.2.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: