DEV Community

dwarfŧ
dwarfŧ

Posted on

using llama finder and deno to scrape websites

what is llama finder?
llama finder is a tool made by me on replit and we will be using it to find keywords on websites

getting started
first we need to go onto the llama finder repl, once you are on it, it should look something likes this:
Image description

if we run this it will say how many times the word llama appears in the website walkingwithllamas.co.uk. We don't want this though!

changing the code
at the top right click fork this will put the code into your workspace and save it on your profile. Next, open index.ts this is where the scraper source code is. In the code you will notice a few comments (the text after //) these are to help you know where everything is.

searching different websites
the first line of code contains a url, you can change this to any website you want! HOWEVER, not all websites allow you to do this as a security measure.

changing the keyword
on line line there is a long line of code:

const count = (html.match(/llama/g) || []).length;
Enter fullscreen mode Exit fullscreen mode

this searches for the word llama and counts how many times it was there, we can change this by changing the word llama to something else like cat.

changing the output
on line 11 it logs how many times it saw your word, however if you run this it will work but instead of saing how may times it saw the word cat it would say "amount of times llama appeared: (the amount of times your word appeared)", we do not want this so change the word llama to you word you are scraping

goodbye
i hope you enjoyed the tool i created and have a good day

Top comments (0)