Welcome everybody you're watching Mr Fugu data science. We're accessing two api's today which are
very simple. Someone on Instagram reached out to me and wanted a little assistance using the
Minecraft API to take your username convert it into a uuid which will be used for the Hypixel
API to extract inventory armor. As always feel free here to hit me up on my socials the code
will be linked in the description below. As well as the comments section. Let's get into this
today. We need the request for API calls Json to handle our data formatting. As well
as pandas to throw it into a data frame. Later future investigations will be decoding or the
prospect of decoding these data which may or may not be possible, unsure. First let's reach into the
Minecraft API. I am creating an inventory armor list where we will store our data. Creating an
input selection for our user of interest. You see this F string right here is storing our API that
we're using from Mojang where we're taking the user profile for Minecraft and we're using the
input statement of the player of Interest. I don't think you need this for the parameters. But this
portion of code was given to me and I just needed to help them get it working. We need to make sure
that everything is okay within a response code of 200. If it was a 403 we would have an error if
429 I think you have too many function calls and you're going to get some throttling if I'm
correct. The person of interest that I used for this formatting today for the input was
Dan capitalize TDM and from it you notice that we stored our data as a Json string with the response
printed as text. I have two print statements here. The data and the data ID. Pay attention
to this, the first is printing off the statement where we have the information for the data. The
next thing it looks like you're printing off the same thing, correct. Since this is a dictionary we
could take the ID portion of this data and print it off as a value because you're calling the key.
Let's think about this and say it one more time. I took the data grabbed the key of ID and printed
off the value which is this user ID for this particular person Dan. We're taking our username
as this here. And retrieving this to input as our uuid into Sky Blocks or the Hypixel API. You will
need to get an API key for this which will come from you logging in to that specific account and
then doing a slash API or slash API new. I know it'll give you a API key. We're going into this
API for Skyblocks. We need to use the profile of Interest take our API key and then input the data
that we had from above from the user ID which was the numeric value returned. We do a get request to
grab the data from this API. Same as we did before pulling the data. We want a response code of 200
and if it is we would like to print off the text. Let's do this line by line so we can get an idea
of what's going on. Let's block out that code and we get a success value I'm going to scroll down
and we'll see what we get so for this profile ID. This is what we graph from the Dan TDM.This
is what we're using to input into the Skyblock's API. So why do we use the Minecraft? if you don't
know the uuid which is this right here. Then you could find it by putting in a particular player.
If it's a valid response you'll get a value kicked out. If it is not a valid response and
there's no information you'll have basically an empty header or HTML body I should say.
The information that we're interested is this today. Okay these are key value pairs nested
dictionaries let's play around with this to get an idea. Because it's very important to learn how to
manipulate and play with Json data. Let's unblock this and go step by step. We store this response
as a Json string once again and we're going to iterate through the profile section. Let's
scroll a little bit and here's our key that we're interested in to pull these data. Because we want
to go further inside of it. I want to go inside the member section that is storing our inventory
armor that we're interested in. You could pull any key value pairs you want. But this is illustrating
what you want to do. I call these items why? Because it's going to return a tuple of your key value
pairs. Position zero in the tuple will be your key. Position one will be your value. so
we can print that off and get an idea let's block this out so this prints off our tuple. This is the
uuid. This is position number one which is storing our Json data or our dictionary of key value pairs.
We need to further go inside this and we're going to take position one which is this all of this
junk. We're going to take the key of inventory armor and return the values of this. So here's
the key and we want to return anything that;s inside of this. Pay attention to this type zero. So just go
and grab that and this is what we're interested in. This little value came from the last portion.
I said pay attention for the type we're not going to need that. So what do we do? Well let's create a
place to store our data for our values and grab that position one. And let's chuck it into a data
frame and see what happens. Let's do that wait what's going on. It's repeating the same
old junk. So something looks kind of awry. What is a rye here? Oh okay, each time I'm calling this is
restoring this same thing as a new entry within our data frame. That's what's going on. How do I
avoid this? And now we get this printed off how it should be. We have kind of an issue don't we. Let's
think about what's going on and why this might be an issue. We need to decode this at some point.
If this is of Interest let's take this right here and let's look at it. We need to figure a
way to break this down at some point. If that's of interest to us to figure out what kind of decoding
is necessary. I had some hiccups with trying to decode this so if anyone has some valuable tools
let me know. But that's a possible future video it depends on if people have interest or want
to contact me about this. This is just a really simple basic video to help you if you're trying
to investigate Minecraft or sky blocks to do some data parsing, pull specific information that you
may have of Interest. There's other people who did some videos. But feel free to let me know if you
want to see anything else. But as always I'd like to say please like share and subscribe and if you
subscribe turn on that notification bell. Thanks for watching, if you have any suggestions hit me
up in the comments section or in my community tab. Here's a few tutorials and links that may
help someone if you'd like to help support the channel, I have buy me a coffee super thanks,
Channel memberships. See you next video. Bye. hey kid don't ever let them get inside your head