what's up y'all this is Hussein Nasser
from IGeometry where we discuss
software engineering by example and this
is our reverse engineering series where
we pick a mainstream app and we try to
analyze it pick up the best practices
does those big companies use and their
app and their applications and their
user experiences and the user interface
and how they configure their api's in a
very optimal way so and today is another
another episode for YouTube but this
time I want to go and discuss the the
YouTube watch page right so in the
previous episode we discussed the videos
I think API and we talked about how this
is working we started to guess the
backend api's and I think we we came to
a conclusion that it's sort of around
the page size and all that stuff and
what is getting being brought from the
backend right and those are really
interesting so in this episode I want to
take the basically the watch so when you
click the watch page you click a video
you try to play it what really happens
there ok so let's just pick up our cover
video here about friend here roberto
blake very famous beautiful but i like
to watch him he has a lot of good videos
on tips on youtube and he's an
entrepreneur
alright so i'm gonna pick a video that i
did not watch before so let's pick one
video right i'm gonna click on that
video and immediately from i don't know
that one of they do that i didn't watch
so he can pick an example or a video I
watched in a video I thought I didn't
watch this is probably a video I didn't
watch let's click on this so it's a 16
minutes video so I'm clicking on it so
this was not the video that I was
planning to
video immediately plays right we have
some sort of data being pulled here so I
don't want to pull any more data I'm
gonna immediately turn off the internet
so no one interconnection so now what
happened here we made a query we asked
the server
hey please open this YouTube video with
this ID so we have the ID somewhere as a
result of the video API and we asked
this server hey I want to watch this
video so we asked that and we started
pulled details about this video so we
know this video size thumbnail perhaps
we get it we get the title and then we
give the number of likes which is
something we didn't get back in the
video API number dislikes an option to
share an option to download the
subscribe button so this tells me that
if I am subscribed to this person or not
so that the fact that whether you are
subscribe or not is also returned as
part of this payload from the server
so am I subscribed or not so I can
display the correct ah icon in this case
I am subscribed but I'm not actually see
if you notice here I'm not notified I
don't have the full notification on
Roberto right we'll all come to that
what is coming up next is the
description that's the question I want
to answer did
the description came back from the first
time I clicked on that video did the
description came back or not we know we
got the title but if I click here oh
yeah so I although I do not have the
internet on I was able to open the
description books and all this text is
returned just like sometimes can be be
heavy I think there's a fixed length
what is that maximum numbers I think
5000 characters so you tube take a head
and when you open that YouTube video
they put there if they return the stream
which we will talk about and they'll
also return the title and they will also
return the description but initially if
you notice they don't show you that
description and that is very deliberate
user experience because they want to
show you something else and guess what
they want to show you this which is how
many videos were there let's let's count
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
17 videos I don't know why a number 17 I
was just so random
but they want they show you 17 videos of
the up next or the suggested videos this
is the main traffic for YouTube that
this is how they make you continue
watching YouTube right this is more
important than showing the description
of this video so if you want to click on
the description you can always expand
that but by default they want you to
watch all this stuff so they show you
the suggested videos first alright I
think this is a user experience design
by probably the strategic team the
content discovery team so they say okay
we're gonna return the suggested videos
what do we return there we return the
title so it's like some sort of an array
I guess in the same end point we return
the array we return the title who is
the owner of this video and how many
views and that's pretty much ed right
and then there is a nice option here
since its suggested you can opt out says
you know what I'm not really interested
of Linda Cohen tips so I can say not
interested right and guess what
although there is no connection since
video removed which is a client side app
that's actually pretty cool you can you
can just hide all of them without having
internet so we know that this is a
client-side behavior all right so they
first hide that video from your view
right I wonder if they recommend
something else instead now they don't so
they hide it and they make a request
which fails obviously because there's no
internet connection
oh man oh it can go forever I'm just
discussing all that stuff which is
pretty cool if you think about it
alright
so we'll go back and play the video in a
second but look at that we do not return
the comments and that's pretty cool
because returning the comedy is
expensive so oh my god just think about
it guys right while designing this user
interface you can you can influence the
API design as a result so if you design
the you user experience first
you can ask by the way I want you to
have an option in the API to either
return the comments suggested video or
both time in this case because of the
bandwidth will become really large you
can ask hey I want I rather get the
suggested video instead of them for
example the ban the the the comments and
this for important for user experience
to see the suggested videos instead of
the comment and obviously as you start
loading once you start scrolling down
you start you start loading this video
right and you start loading all this
details so yeah and uh if I know you
today but I play the video we're gonna
talk wonder everybody
today that something actually pretty
really important at least I feel it's
important time
how can for how far I can scroll right
so it's good obviously the data here is
not available because I don't have
internet but I have Donna the first
three second or four seconds right but
guess what I cannot play them anymore
although alloy I disconnected my
internet right and although I cashed
those five seconds YouTube app decided
to discard that for some reason another
thing that is returned is the
merchandise off of that user if he had
any all right guys I think I'll stop
here there's a lot to to discuss here
but I'm gonna make it a short episode we
can go and deep details about this in
the next video you guys stay awesome
alright and check out with other content
of this gen a few new to this channel
consider subscribing we talked about
software engineering concepts and design
and best practices and a considered
chick and subscribing to this channel if
you want to know more about that
software engineer if you want to become
better software engineer alright guys
I'll guys see you in the next one
goodbye