Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YouTube embed asks for consent #326

Closed
BabyDino opened this issue Apr 1, 2021 · 9 comments
Closed

YouTube embed asks for consent #326

BabyDino opened this issue Apr 1, 2021 · 9 comments

Comments

@BabyDino
Copy link

BabyDino commented Apr 1, 2021

Hi all,

Suddenly we get the following error on youtube embeds:

-- [21-04-01 13:02:43]:30220    -- fallback from domain to generic { 'youtube.com': true } https://www.youtube.com/watch?v=dQw4w9WgXcQ
-- [21-04-01 13:02:43]:30220    -- plugin redirect (by "htmlparser") https://consent.youtube.com/m?continue=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdQw4w9WgXcQ&gl=NL&m=0&pc=yt&uxe=23983172&hl=en&src=1
-- [21-04-01 13:02:44]:30220    -- plugin redirect (by "htmlparser") https://consent.youtube.com/ml?continue=https://www.youtube.com/watch?v%3DdQw4w9WgXcQ&gl=NL&hl=en&pc=yt&uxe=23983172&src=1

The debug output is:

{
    "meta": {
        "title": "Before you continue to YouTube",
        "canonical": "https://consent.youtube.com/ml?continue=https://www.youtube.com/watch?v%3DdQw4w9WgXcQ&gl=NL&hl=en&pc=yt&uxe=23983172&src=1"
    },
    "links": [
        {
            "href": "//www.google.com/favicon.ico",
            "rel": [
                "shortcut",
                "icon",
                "ssl"
            ],
            "type": "image/icon"
        }
    ],
    "h2": true,
    "rel": []
}

Googling this issue does not provide any hits. Anyone with a solution?

@iparamonau
Copy link
Member

iparamonau commented Apr 1, 2021

It doesn't yet redirect us to the consents, see debugger.

Also cannot repeat in on local host.

In any case, Iframely supports working directly with YouTube gdata API, and you should use it too. Get your SDK key from Google and configure it in your local config file as youtube: {api_key:...}

@BabyDino
Copy link
Author

BabyDino commented Apr 1, 2021

Thank you. I was running an old version with an even older config. Thanks for your quick response! Fixed

@BabyDino BabyDino closed this as completed Apr 1, 2021
@marwonline
Copy link
Contributor

marwonline commented Apr 6, 2021

Sorry, to bug you again.

I've exactly the issue described above, on all my EU instances. The same version hosted on US servers still works as intended.

I guess the only workaround for me is to get a Youtube API key.

EDIT:

Using an API token works fine.

@iparamonau
Copy link
Member

Alright, thanks @marwonline for EU servers hint. I'll make it a sticky issue.

Here's the alternative fix you can apply to your Iframely instance:
https://gist.github.com/iparamonau/3ed562a0de4517ab641da8ca728bafcf

@iparamonau iparamonau pinned this issue Apr 6, 2021
@thomas-negrault
Copy link

I have the same issue. I added the Google API key but on some api calls it's working, on others I have the same error as @BabyDino.
I have the issue from my local computer and a remote server, based in France so in EU.
I do not understand, the more I try and the more I have errors. When I debug in youtube.video.js I can see that the URL called is correct, with my API Key:
https://www.googleapis.com/youtube/v3/videos?part=snippet%2Cplayer&key={MY KEY}&id=dQw4w9WgXcQ
When I call this URL I have the correct result:

{
    "kind": "youtube#videoListResponse",
    "etag": "FzAY1WD9iOlt8EyAHbnwqhVQ-9w",
    "items": [
        {
            "kind": "youtube#video",
            "etag": "bBPKyoyrCCCacy4GS8LdSZMaEok",
            "id": "dQw4w9WgXcQ",
            "snippet": {
                "publishedAt": "2009-10-25T06:57:33Z",
                "channelId": "UC38IQsAvIsxxjztdMZQtwHA",
                "title": "Rick Astley - Never Gonna Give You Up (Video)",
                "description": "Rick Astley's official music video for “Never Gonna Give You Up” \nListen to Rick Astley: https://RickAstley.lnk.to/_listenYD\n\nSubscribe to the official Rick Astley YouTube channel: https://RickAstley.lnk.to/subscribeYD\n\nFollow Rick Astley:\nFacebook: https://RickAstley.lnk.to/followFI\nTwitter: https://RickAstley.lnk.to/followTI\nInstagram: https://RickAstley.lnk.to/followII\nWebsite: https://RickAstley.lnk.to/followWI\nSpotify: https://RickAstley.lnk.to/followSI\n\nLyrics:\nNever gonna give you up\nNever gonna let you down\nNever gonna run around and desert you\nNever gonna make you cry\nNever gonna say goodbye\nNever gonna tell a lie and hurt you\n\n#RickAstley #NeverGonnaGiveYouUp #DancePop",
                "thumbnails": {
                    "default": {
                        "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/default.jpg",
                        "width": 120,
                        "height": 90
                    },
                    "medium": {
                        "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/mqdefault.jpg",
                        "width": 320,
                        "height": 180
                    },
                    "high": {
                        "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
                        "width": 480,
                        "height": 360
                    },
                    "standard": {
                        "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/sddefault.jpg",
                        "width": 640,
                        "height": 480
                    },
                    "maxres": {
                        "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg",
                        "width": 1280,
                        "height": 720
                    }
                },
                "channelTitle": "RickAstleyVEVO",
                "tags": [
                    "the boys soundtrack",
                    "the boys amazon prime",
                    "Never gonna give you up the boys",
                    "RickAstleyvevo",
                    "vevo",
                    "official",
                    "Rick Roll",
                    "video",
                    "music video",
                    "Rick Astley album",
                    "rick astley official",
                    "single",
                    "album",
                    "together forever",
                    "Never Gonna Give You Up",
                    "Whenever You Need Somebody",
                    "pop",
                    "rickrolled",
                    "WRECK-IT RALPH 2",
                    "Fortnite song Fortnite item shop Fortnite time shop today Fortnite montage",
                    "Fortnite event",
                    "Fortnite dance",
                    "fortnite never gonna give you up"
                ],
                "categoryId": "10",
                "liveBroadcastContent": "none",
                "localized": {
                    "title": "Rick Astley - Never Gonna Give You Up (Video)",
                    "description": "Rick Astley's official music video for “Never Gonna Give You Up” \nListen to Rick Astley: https://RickAstley.lnk.to/_listenYD\n\nSubscribe to the official Rick Astley YouTube channel: https://RickAstley.lnk.to/subscribeYD\n\nFollow Rick Astley:\nFacebook: https://RickAstley.lnk.to/followFI\nTwitter: https://RickAstley.lnk.to/followTI\nInstagram: https://RickAstley.lnk.to/followII\nWebsite: https://RickAstley.lnk.to/followWI\nSpotify: https://RickAstley.lnk.to/followSI\n\nLyrics:\nNever gonna give you up\nNever gonna let you down\nNever gonna run around and desert you\nNever gonna make you cry\nNever gonna say goodbye\nNever gonna tell a lie and hurt you\n\n#RickAstley #NeverGonnaGiveYouUp #DancePop"
                },
                "defaultAudioLanguage": "en-US"
            },
            "contentDetails": {
                "duration": "PT3M33S",
                "dimension": "2d",
                "definition": "hd",
                "caption": "false",
                "licensedContent": true,
                "contentRating": {},
                "projection": "rectangular"
            },
            "status": {
                "uploadStatus": "processed",
                "privacyStatus": "public",
                "license": "youtube",
                "embeddable": true,
                "publicStatsViewable": true,
                "madeForKids": false
            },
            "statistics": {
                "viewCount": "914531242",
                "likeCount": "9173631",
                "dislikeCount": "272085",
                "favoriteCount": "0",
                "commentCount": "1516867"
            },
            "player": {
                "embedHtml": "<iframe width=\"480\" height=\"270\" src=\"//www.youtube.com/embed/dQw4w9WgXcQ\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
            }
        }
    ],
    "pageInfo": {
        "totalResults": 1,
        "resultsPerPage": 1
    }
}

But in, it does not work, the console output is:

- Loading /iframely for https://www.youtube.com/watch?v=dQw4w9WgXcQ
-- plugin redirect (by "htmlparser") https://consent.youtube.com/m?continue=https%3A%2F%2Fwww.youtube.com%2F&gl=FR&m=0&pc=yt&uxe=23983172&hl=en&src=1
-- plugin redirect (by "htmlparser") https://consent.youtube.com/m?continue=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdQw4w9WgXcQ&gl=FR&m=0&pc=yt&uxe=23983172&hl=en&src=1
-- plugin redirect (by "htmlparser") https://consent.youtube.com/ml?continue=https://www.youtube.com/&gl=FR&hl=en&pc=yt&uxe=23983172&src=1
-- plugin redirect (by "htmlparser") https://consent.youtube.com/ml?continue=https://www.youtube.com/watch?v%3DdQw4w9WgXcQ&gl=FR&hl=en&pc=yt&uxe=23983172&src=1

And the call to /iframely?uri=https://www.youtube.com/watch?v=dQw4w9WgXcQ is the same as @BabyDino:

{
    "meta": {
        "title": "Before you continue to YouTube",
        "canonical": "https://consent.youtube.com/ml?continue=https://www.youtube.com/watch?v%3DdQw4w9WgXcQ&gl=FR&hl=en&pc=yt&uxe=23983172&src=1"
    },
    "links": [
        {
            "href": "//www.google.com/favicon.ico",
            "rel": [
                "shortcut",
                "icon",
                "ssl"
            ],
            "type": "image/icon"
        }
    ],
    "rel": []
}

@iparamonau
Copy link
Member

There are two URLs running in your log.

One is for https://youtube.com - root, and it's understandable. We do domain-icon there, and need to fetch the root page for that. You can ignore that.

The second one is the video redirects indeed. It is only possible if HTMLParser plugin is used on that URL, e.g. by referring to meta, twitter or og. We don't do use those in our default domain plugins for YouTube, so perhaps there's some private plugin of yours that triggers that?

@thomas-negrault
Copy link

You are a life saver 😄
I actually have a custom plugin to get the og image of news articles, with a too permissive regex that match everything /^https?:\/\/.*/ I fixed it by only putting my domains, I did not think it could interfere with the other plugins !
Anyway, it's fixed so thank you 🎉

@hondem
Copy link

hondem commented Jul 20, 2021

Hello guys. I have exactly the same issue with Google Maps. Setup was done according to the tutorial. Without any API key, I was unable to embed YouTube. After creating an API key with YouTube API's enabled, YouTube embedding started working. Unfortunately cannot say the same for Google Maps. I've assigned the same key Maps Embed API, but didn't help. Has somebody developed a fix for this already?

@iparamonau
Copy link
Member

@hondem this issue is now closed and it's probably worth submitting a new one for Google Maps. Please include the console log from your local instance to see the html redirect if any.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants