7

I am creating an app which uses share functions of YouTube to add YouTube videos in my playlist, since the id of the videos in YouTube is hard to type for the users. The basic steps are:

  1. The user opens YouTube
  2. The user opens a specific video
  3. The user click on the share option
  4. He clicks on my app.

By checking the follow tutorial I found a easy way to get the shared link from YouTube: http://developer.android.com/training/sharing/receive.html

And I got the videos links liked with the follow structure:

https://youtu.be/VIDEO_ID

Where VIDEO_ID is the id of the video. Here is an example: https://youtu.be/prkQ6QFv-_Y

What I wonder is if all the videos shared by YouTube will have this structure or depending on the version, the structure will change?

If the answer of the previous question is yes, please, provide the link structure for corresponding version of YouTube.

jiahao
  • 3,373
  • 2
  • 35
  • 36
  • 1
    did you give a look at these pages ? https://developers.google.com/youtube/ – Bxtr Aug 05 '15 at 09:34
  • For curiosity, Why would you like to know structure of YouTube videos? IMO, you only need to concern with video IDs. Structure of its URL does not matter. – frogatto Aug 11 '15 at 12:27

3 Answers3

9

Sharing YouTube formats (What is the format of the video shared by YouTube App):

In order to test your query i have installed several versions of youtube and gathered results :

While using YouTube versions ,

5.9.4.9
5.9.0.13
5.9.0.12
5.10.1.5
5.13.3
5.14.5
5.16.4
5.17.6
6.0.13
10.02.3
10.03.5
10.05.6

I could get the format as : https://youtu.be/idgoeshere

Also if tested in browsers we have the same format

Use Format in your own risk - YouTube enter image description here

Youtube I.D parsing for new URL formats

Edit 1 :

Why different versions of YouTube app tested ?

Just to make sure that is there any formatting differences used in their apps.

Community
  • 1
  • 1
Tharif
  • 13,794
  • 9
  • 55
  • 77
  • I don't think this helps him. He is developing his own custom app and is not an end-user of any versions of the Youtube app from Google. The **[Youtube I.D parsing](http://stackoverflow.com/questions/7693218/youtube-i-d-parsing-for-new-url-formats)** might help though since this here question is a concern about handling multiple versions of Youtube URL link formatting. – VC.One Aug 10 '15 at 09:44
  • @VC.One yes you suggested right..but the intention was to check the format differences exist in multiple versions of youtube..also i have stated references of stack posts which shows the guarantee of formats they use.. – Tharif Aug 10 '15 at 09:59
  • Reproducing the _screenshot_ of another answer (I first wondered why it looked blurred...) is not user-friendly. On my smartphone, I can't read it unless I tilt the phone, and it has a resolution of 1440 x 2560. – Walter Tross Aug 12 '15 at 06:18
  • @WalterTross but i have given a link to that question as well..or shall i provide just the link..in order to get the summary of that post i added that screen – Tharif Aug 12 '15 at 06:27
6

Even if you use the YouTube Data API V3 you still cannot get the full video URL. Only video IDs are returned.

However, the video IDs are unique. If you know the ID then the URL is:

https://www.youtube.com/watch?v=VIDEO_ID

or using the short form:

https://youtu.be/VIDEO_ID

There's no guarantee they won't change at some point, but it's extremely unlikely and they have no reason to do it.

aergistal
  • 29,947
  • 5
  • 70
  • 92
4

There is no need to be concerned with the various format versions. If Youtube changed anything they would simply have their servers re-direct any "other-style" requests to the same relevant content. As they currently do so anyways.

It's in their best interest when offering quality of service that people say "Youtube links work!!" instead of saying "Oh Youtube? those links work sometimes..."

What I wonder is if all the videos shared by YouTube will have this structure* or depending on the version, the structure will change? ( * meaning: https://youtu.be/VIDEO_ID)

Not every link you share will have that structure, but it is the current style used by Youtube for shares.

What if the structure is different? So what? As long as the VIDEO_ID is correct then the right video content will be found no problem. The VIDEO_ID is just a reference number to the Youtube server to access the correct video content. The server understands all known versions of Youtube URLs so you can give it a valid one and it will work.

The current answers do not contain enough detail.

There is nothing more to add. Good luck with your project. It will be great.

VC.One
  • 14,790
  • 4
  • 25
  • 57