This week for my OSD class I had to work with a Seneca project called Telescope. It displays blogs that students right (It even displays this blog that I am currently posting)
You can find Telescope here: https://telescope.cdot.systems/
The first task was setting up the development env for telescope, it was pretty easy on my MacOS that I code on since I could use homebrew to install everything that I needed.
Using the Telescopes rest API was very easy for me and I ran into no problems.
Now getting to where I actually coded. I was tasked with upgrading my Link Check program (https://github.com/MLJBrackett/link-check) and integrating telescope support for the project. Basically I would get the first 10 posts and run my link check on all urls that were inside the posts.
Everything was fairly easy to do, I just requested the page, parsed all the urls out of the page, requests for each of the urls and displayed the status code.
You can look at my gist here: https://gist.github.com/MLJBrackett/93f7351d4778557197c420d80abe10c0
The only bad thing that I found was that I would have to redo my functions if I wanted to clean up the code a bit, but as a proof of concept program it runs perfectly fine. Later I will implement changes to clean up everything and make it easier to understand.
One issue that I had actually was when I was finding all the urls in the page my regex was grabbing extra stuff at the end (Why does regex for urls have to be so hard?). I decided to first turn it into a dictionary so I can delete all the repeats, then I would check if the final character was "," since it seemed to be grabbing a lot of those with the regex that I chose to use, and I just deleted that from the end of the string. After that I was mostly getting the correct urls from the webpage.
Top comments (0)