acalejos

acalejos OP

Hi everyone,

I recently made a library of Req plugins for some web-crawl-adjacent stuff I’m working on and figured I would share it.

https://github.com/acalejos/req_crawl/

The library is called ReqCrawl and is a place for Req plugins related to common crawling functions.

Right now it supports parsing robots.txt and sitemap’s, but there’s potential to add more plugins for other features.

Plugins

ReqCrawl.Robots

A Req plugin to parse robots.txt files

You can attach this plugin to any %Req.Request you use for a crawler and it will only run against
URLs with a path of /robots.txt.

It outputs a map with the following fields:

  • :errors - A list of any errors encountered during parsing
  • :sitemaps - A list of the sitemaps
  • :rules - A map of the rules with User-Agents as the keys and a map with the following values as the fields:
    • :allow - A list of allowed paths
    • :disallow - A list of the disallowed paths

ReqCrawl.Sitemap

Gathers all URLs from a Sitemap or SitemapIndex according to the specification described
at https://sitemaps.org/protocol.html

Supports the following formats:

  • .xml (for sitemap and sitemapindex)
  • .txt (for sitemap)

Outputs a 2-Tuple of {type, urls} where type is one of :sitemap or :sitemapindex and urls is a list
of URL strings extracted from the body.

Output is stored in the ReqResponse in the private field under the :crawl_sitemap key

Where Next? Top

Trending in Announcing Top

bluzky
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
387 15136 120
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
shahryarjb
The Chelekom project is a library of Phoenix and LiveView components generated via Mix tasks to fit developer needs seamlessly. One of i...
New
kip
Please say hi to a new lib, Astro that aims to deliver easy-to-consume astronomy calculations of practical use. For now it only calculat...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

Other Trending Topics Top

type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New
matt-savvy
Is there a word for the ~> symbol used in Version strings? Do you also just call it a Squiggle Arrow™ ?!
New

We're in Beta

About us Mission Statement