wfind :: Text -> Int -> [SearchPattern] -> TChan (Maybe Text) -> IO ()
wfind uri' depth patterns chan = do
  hSetBuffering stdout LineBuffering
  let suri = unpack uri'
      Just crawlHostURI = URI.parseURI suri
      spider = defaultSpider (ScrapedPage 0 mempty)
            & name .~ "wfind-spider"
            & startUrl .~ (ScrapedPage 1 "START", uri')
            & extract .~ parse depth patterns crawlHostURI
            & load .~ Just (\x -> do
                let payload = encodeToLazyText x :: LText
                atomically $ writeTChan chan $ Just (toStrict payload)
                return ())
  _ <- atomically $ writeTChan chan $ Just "Starting Search..."
  _ <- runSpider spider
  _ <- atomically $ writeTChan chan Nothing
  return ()
wfind :: Text -> Int -> [SearchPattern] -> TChan (Maybe Text) -> IO ()
wfind uri' depth patterns chan = do
  hSetBuffering stdout LineBuffering
  let suri = unpack uri'
      Just crawlHostURI = URI.parseURI suri
      spider = defaultSpider (ScrapedPage 0 mempty)
            & name .~ "wfind-spider"
            & startUrl .~ (ScrapedPage 1 "START", uri')
            & extract .~ parse depth patterns crawlHostURI
            & load .~ Just (\x -> do
                let payload = encodeToLazyText x :: LText
                atomically $ writeTChan chan $ Just (toStrict payload)
                return ())
  _ <- atomically $ writeTChan chan $ Just "Starting Search..."
  _ <- runSpider spider
  _ <- atomically $ writeTChan chan Nothing
  return ()
wfind uri' depth patterns chan = do
  hSetBuffering stdout LineBuffering
  let suri = unpack uri'
      Just crawlHostURI = URI.parseURI suri
      spider = defaultSpider (ScrapedPage 0 mempty)
            & name .~ "wfind-spider"
            & startUrl .~ (ScrapedPage 1 "START", uri')
            & extract .~ parse depth patterns crawlHostURI
            & load .~ Just (\x -> do
                let payload = encodeToLazyText x :: LText
                atomically $ writeTChan chan $ Just (toStrict payload)
                return ())
  _ <- atomically $ writeTChan chan $ Just "Starting Search..."
  _ <- runSpider spider
  _ <- atomically $ writeTChan chan Nothing
  return ()