Skip to content

Naokotani/encouter-builder-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PF2 SRD web scraper

Introduction

Web scraper for pf2srd.com that puts all monsters into a database to be queried by a web app that builds randomized PF2 encounters. It is designed to work with this repository, which is a Svelte/Rust application

Building

To build this project, create a .env file that has access to a PostgreSQL database in this format:

DATABASE_URL=postgres://username:password@localhost/database

For information on how to run a PostgreSQL database see the documentation here.

Once the database is correctly configured run cargo build --release.

Usage

Before you can actually run the process you will need to manually create the tables like so:

ColumnTypeNullable
creature_idintegernot null
urlcharacter varying(100)
namecharacter varying(100)
levelinteger
alignmentcharacter varying(15)
monster_typecharacter varying(100)
sizecharacter varying(15)
is_casterboolean
is_rangedboolean
aquaticboolean

and a traits table like so:

ColumnType
creature_idinteger
traitcharacter varying(50)
Foreign-key constraints:
    "traits_creature_id_fkey" FOREIGN KEY (creature_id) REFERENCES monsters(creature_id)

Once the database is correctly configured just run the binary ./web_scaraper.

Testing

Unit testing is possible by running cargo test these tests are designed to ensure that data is correctly sanitized for the database.

Note

The encounter builder web application does not currently use the traits table, but I wanted to store them in case I wanted access to them.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages