How to get YouTube URL in background?

Tags: , ,

For my school project, I need to extract Video URL from Youtube from a Chrome extension. It means I should play a video on Youtube and I need the URL of that video displayed in my chrome extension body.
How should I get this video URL using Javascript?


window.location.href if you are on the page playing a video.

Source: stackoverflow