` } document.addEventListener("DOMContentLoaded", function() { document.querySelectorAll('#apd-root oembed[url]').forEach(function(el) { var urlString = el.getAttribute('url') var url = urlParser(urlString) var code; // Youtube Short if (url.host.indexOf('youtu.be') > -1) { var video_id = url.pathname.split('/')[1] code = youtubeIframe(video_id) } // Youtube else if (url.host.indexOf('youtube.com') > -1) { var video_id = url.query_params.get('v') code = youtubeIframe(video_id) } // Vimeo else if (url.host.indexOf('vimeo.com') > -1) { var video_id = url.pathname.split('/')[1] code = vimeoIframe(video_id) } // Spotify else if (url.host.indexOf('spotify.com') > -1) { var id = url.pathname.split('/')[2] code = spotifyIframe(id) } el.innerHTML = code }) })