Check out example codes for "download youtube videos". It will help you in understanding the concepts better.

Code Example 1

add pp to the url
https://www.youtube.com/watch?v=dQw4w9WgXcQ
becomes
https://www.youtubepp.com/watch?v=dQw4w9WgXcQ
it works for videos and playlists

Learn ReactJs, React Native from akashmittal.com