OSD600 Lab 6

This week we started to get familiar with Telescope a tool made by students of OSD 600 to track blogs written for Senecas Open Source class. The first task of this week's lab was to set up telescope and get it to run on our local machine. I first read the envirenmet-setup.md file and decided I will use the docker and docker-compose method. After I forked and cloned the repository I downloaded docker decktop (this comes with docker and docker-compose) then followed the steps to run it. I did run into some minor issues when trying to run it, but was able to figure it out! 

After I got that working I started the second part of lab 6. For this part, we had to modify our link checker to search for links in the last 10 telescope posts. To be honest, at first, I had no idea how to do this. But then I took a minute to think about it and start writing some code (It's easier for me to visualize). Eventually, I figured it out! I used fetch() to grab the JSON data from http://localhost:3000/posts (the telescope REST API)

 then I went through that array and used fetch() again to fetch() each blog post (eg  http://localhost:3000/posts/8868d79346). I then used response.html to get the HTML of each blog post (I didn't know about that before, had to do some research). After that, I stored the HTML of every post into one text file.  From there I was able to use my existing code to go through the file and check all the links. I am really happy we did this lab because by doing it I discovered a flaw in my link checker app. The first time I ran it I was getting many links (3000+) I was not sure if something was wrong or if that's expected. I talked to David about it and realized I never took out duplicates from the array. After I did that the size went down a lot!  Besides that modification, there were not many changes to my code,  everything was minor (adding a --telescope option and writing a new function for that use case). The existing code I had written in the past worked well. 


Finally, I uploaded the files I had to write to finish this lab to this gist. Overall, this lab went pretty well, and I am looking forward to the next lab and starting to work on Telescope!












Comments

Popular posts from this blog

OSD600 Release 0.4 Part 3

OSD600 Lab 5

Release 0.3 PR2