diff options
author | Daniel Schadt <kingdread@gmx.de> | 2023-12-02 11:52:18 +0100 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2023-12-02 11:52:18 +0100 |
commit | 430c17097cba8c970c2826be0e622b6cb7bb6818 (patch) | |
tree | 33f63a17c359816b176aa364c130c32257e8cc4b /app | |
download | MiniScalp-430c17097cba8c970c2826be0e622b6cb7bb6818.tar.gz MiniScalp-430c17097cba8c970c2826be0e622b6cb7bb6818.tar.bz2 MiniScalp-430c17097cba8c970c2826be0e622b6cb7bb6818.zip |
Diffstat (limited to 'app')
-rw-r--r-- | app/Main.hs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/Main.hs b/app/Main.hs new file mode 100644 index 0000000..7c960b1 --- /dev/null +++ b/app/Main.hs @@ -0,0 +1,20 @@ +module Main (main) where + +import Data.Text +import MiniScalp.Predicates +import MiniScalp.Query +import MiniScalp.Sources +import MiniScalp.Types + +data MensaLine = MensaLine Text [Text] deriving (Show) + +source :: Text +source = "<!DOCTYPE html><html><div class=\"content\"><p>Hey <span id=\"username\">Alice</span>!</p></div></html>" + +nameScraper :: Scraper Text +nameScraper = chroot ("div" @: [hasClass "content"]) $ chroot ("span" @: ["id" @= "username"]) text + +main :: IO () +main = do + let scraped = scrapeText source nameScraper + print scraped |