Podcast Summary
Building a Vaccine Bot with JavaScript, CSS, and Node Modules: Leverage Sanity for a structured content CMS, Sentry for error handling, and Node modules for efficient web development projects.
In this episode of Syntax, Wes and Scott discuss Wes's project of building a vaccine bot using JavaScript, CSS, and Node modules. They also share their experiences and practical tips in web development. Sponsored by Sanity and Sentry, they highlight the benefits of these tools for developers and end-users. Sanity is a structured content CMS that offers APIs, a user-friendly CMS editing UI, and customizable React components. Sentry is an error and exception handling tool that provides performance metrics and user misery scores to help improve website load times and log errors. By using these tools, developers can create efficient and effective web development projects.
A JavaScript coder creates a vaccine bot to simplify the vaccine appointment process: A JavaScript coder developed a bot to check vaccine availability every 5 minutes at three pharmacy websites, saving time and effort for those trying to secure appointments during a chaotic and inefficient vaccine rollout process.
When faced with inefficiencies and frustration in accessing essential services like getting a COVID-19 vaccine, an individual utilized their JavaScript coding skills to create a vaccine bot. The bot aimed to simplify the process by regularly checking vaccine availability at three different pharmacy websites: Shoppers Drug Mart, Costco, and Walmart. The bot's creation was a response to the complex and chaotic vaccine rollout process in Canada, where accessibility varied greatly and was often limited to certain groups. The individual ensured they weren't taking vaccines away from those who needed them most before using the bot for their age group. The bot's success came from its ability to regularly check for vaccine availability every 5 minutes, saving time and effort for those trying to secure a vaccine appointment. The creation of this bot highlights the potential of technology to streamline processes and address inefficiencies in essential services.
Reverse Engineering a Website's API Request: To access private data from a website, reverse engineer its network requests and replicate them using Node.js fetch for a more authentic response.
To access data from websites that aren't publicly available through APIs, you can reverse engineer their network requests and replicate those requests yourself. This involves visiting the website, identifying the API request in the network tab, and copying the request to use in your own code. For this, using Node.js fetch is recommended as it includes cookies and session IDs in the response, making the request more authentic. This method was demonstrated through the example of finding out if flu shots were available at a pharmacy's website. It's a valuable skill for those interested in web scraping and understanding how websites function behind the scenes. As a back end developer, having this knowledge can be particularly useful. The process starts with visiting a website, identifying the API request, copying the request, and replicating it using Node.js fetch.
Understanding the approaches and tools for automated website requests: When simple requests are enough, use fetch. For complex interactions, use Puppeteer. Set custom headers for cookies or JWTs. Variableize URL parts for flexibility. Find API endpoints for larger datasets.
When making automated requests to websites, it's essential to understand the different approaches and tools available to handle various scenarios. When possible, using a fetch request is the faster choice for development as it bypasses the need for opening a headless browser and waiting for pages to load. However, if the website requires more complex interactions like clicking buttons or hovering over elements, then using a library like Puppeteer is necessary. When working with websites, it's important to note that cookies or JSON Web Tokens (JWTs) can sometimes be sent as custom headers instead of cookies. Therefore, setting custom headers is necessary to ensure successful requests. Another crucial step is identifying and variableizing the parts of the URL that differ from one request to another, such as store IDs or booking form IDs. This process helps make the automated requests more flexible and adaptable to various scenarios. When dealing with larger datasets, finding an API endpoint to retrieve a list of stores or locations can be helpful, especially when the user base expands. By understanding the different approaches and tools available, developers can optimize their workflow and build more efficient and effective automated systems.
Navigating complex APIs with multiple steps and restrictions: Manually copying and pasting cookies and tokens, and carefully identifying necessary components, are crucial for accessing data from complex APIs with multiple steps and restrictions.
Working with APIs that have restrictions and require multiple steps to access data can be a complex process. These APIs may require specific cookies or tokens to function, and figuring out what is necessary can involve deleting unnecessary parts of requests and identifying which components are essential. For instance, in the case of accessing vaccine availability data from Walmart, the process involved answering a series of questions, receiving new cookies and tokens at each step, and extracting the tokens from HTML pages. This multi-step process was time-consuming and required patience, as the API could change at any time. To overcome this, I had to manually copy and paste cookies from the browser to make the script work, as an alternative to automating the process. Caching available vaccines and their time stamps in an array variable was also necessary to ensure the script checked for updates every 5 minutes without missing out on vaccines that were available for longer than that. Overall, working with APIs that have multiple steps and restrictions can be a complex and manual process, requiring careful attention to detail and patience to figure out the necessary components.
Tracking vaccine availability with a Telegram bot: Combined techniques of checking for duplicates, using in-memory storage, and a Telegram bot for notifications effectively tracked vaccine availability.
A simple and effective solution for tracking vaccine availability was created using a combination of techniques including checking for duplicate alerts, using in-memory storage, and implementing a Telegram bot for notifications. The developer shared how they checked for duplicate alerts to avoid false positives, used in-memory storage instead of a database to keep things lightweight, and utilized Telegram's bot API to send notifications with vaccine availability. They also mentioned using Node Cron to rerun the function every 5 minutes. The project was initially intended as a pop-up solution, but the developer expressed that they would consider using a database for more long-term flexibility. The developer's persistence paid off when they successfully secured a vaccine for themselves and their wife through the system. Overall, this is a great example of using programming skills to solve a real-world problem in a creative and effective way. Whether it's tracking vaccines or anything else, the key is to keep trying and be persistent in your efforts.
Exploring new skills and problem-solving: The speaker's passion for learning and figuring things out drives them to go the extra mile, from joining a Twitter account to propagating plants.
Some people, including the speaker, enjoy the process of figuring out how things are done and going the extra mile, even if it means putting in more effort and time. The speaker shared an example of how they got involved in the Twitter account "vaccine hunters" and their fascination with learning about fetch requests. They also mentioned their experience with propagating hydrangea plants and their failure to propagate stink plants despite numerous attempts. The speaker acknowledged that they could have simply bought the plants, but their personality type drives them to find solutions and learn new skills. The conversation also touched on the speaker's interest in landscaping and houseplants, specifically their love for snake plants and their past failures in propagating them. Overall, the speaker's passion for learning and problem-solving is a significant part of their personality.
Monstera plants' popularity leads to automation ideas: Explore automation ideas for Monstera farms using JavaScript, learn from code examples, and enhance developer skills.
Monstera houseplants, specifically their leaves, have become quite popular and valuable in the market, with some leaves selling for up to $150. This trend has led to an increase in propagation efforts. Monstera plants are known for growing large, making them an attractive addition to any home. Wes Bos, a podcast host, expressed his interest in automating the watering of a potential Monstera farm using JavaScript. The Wyze sprinkler automation discussed earlier sparked this idea. While the code for the entire project may not be the best, reading it can help improve developer skills. The importance of reading code cannot be overstated, especially for reverse engineering APIs, hacking together projects, or creating schedulers, Telegram bots, or similar tasks.