Three weeks in, putting what I’ve learned to the test?

Danny Padron
4 min readMay 8, 2020

--

First two weeks of lessons at FlatIron were brutal to say the least. I spent probably way too many hours on some of these lessons but four weeks ago I knew nothing about coding, and yet here we are at the end of the first project week for the course, project done, fully functional and not broken! It might not be the prettiest or the flashiest CLI program out there but it does what it’s supposed to do. I probably would’ve had more time to add in more bells and whistles but I spent a ton of time trying to get my second scrape to work.

The reason I wanted to get into coding/programming to begin with was because I want to get into video game design industry. So of course my first project of my choice would have to do with, you guessed it, video games. I built a CLI program based around the popular PC game “League of Legends”. What it does is that it gives you a list of all the champions and you can select the champion of your choice and see their stats as well as see their each individual abilities. If you have never heard of “League of Legends”, it’s what is considered a “Multiplayer Online Battle Arena” game. You have different champions with different abilities that each play an important role in accordance with other champions that your team as picked. My second scrape, honestly the hardest part for me during this whole project, happens here in the abilities of each champion

When I thought about and decided on the topic for my project the website I had found with the info that I needed was a really good site, everything was labeled perfectly and correctly, or so I thought. The problem I ran into on my second scrape was that I had no clue how to do it! I knew that I wanted to be able to select a champion from my list but how did I make that selection turn into “opening another web page and doing the whole scraping process again”. It took a long time and a whole lot of commented out code but I had finally got it working, sort of. My issue was that the link I was taking from the original scrape of champion names was not a link to the individual champions abilities. Instead it was a link that went to a page filled with blog posts about different “builds” for champions. There is different items in the game that you can acquire to give you better stats. So I had to figure out a way to get my User’s input of the champion of their choice and use that link to skip the first page it originally takes you to and have it redirect into a tab that was within this blog post page.

My dilemma was that the current list of active champions on “League of Legends” is 148 champions. I tried every kind of iteration I could think of to get Nokogiri to open up each link that I scraped from the original page, with no success. So after testing my brain all day on this I finally thought of something so simple that it couldn’t possibly work right? String Interpolation into a URL link? I was at the end of the list of ideas and out of options I thought whats one more error message lets try this :

`https://mobafire.com#{@champion_links[champion_input.to_i — 1]}/abilities`

So not only did I have to the interpolation but also had to incorporate the User’s original champion selection so it knew exactly which link from the huge list to run. Which the champion_input variable is the selected champion carried over from the main menu selection. I did get lucky in the sense that every champions web page about abilities was exactly as the one that I managed to get on the first scrape with just a simple /abilities after it. It was so rewarding the first time I went to test this and not only did it NOT break but it actually gave me back the abilities of the champion I had picked.

With as much as I struggled with the second scrape the rest of the project was still challenging but seemed so much easier than this one simple thing. I might have been just burned out and was running on fumes and thats why I struggled with it but it did take me a while to finally wrap my head around how to get it done, what I wanted it to do and how to get it to do that. Most likely there might be a simpler way of doing it I’m not sure, but I do know that after building this project and running through the program countless number of times testing things, that right before going into project week I was questioning how much of these lessons did I actually learn, is one week enough for me to be able to create a project like this with only two weeks of experience? After this week and this project I can not wait to see what else I will learn and what I will be able to create at the end of it.

--

--

Danny Padron
Danny Padron

Written by Danny Padron

Full stack web developer with experience in Ruby on Rails, JavaScript, React and Redux and learning more!

No responses yet