Add NYTimes recipe extraction from __NEXT_DATA__ JSON tag
- Add Roux.NYTimes module with:
- extractNextData: finds <script id="__NEXT_DATA__"> tag in HTML
and parses its JSON content via aeson
- parseNYTRecipe: maps NYTimes recipe JSON structure into a
typed intermediate representation (NYTRecipe, NYTIngredientGroup,
NYTIngredientItem, NYTStepGroup, NYTStepItem)
- Supports all NYTimes Cooking data: title, URL, total time, yield,
topnote, ingredient groups (with section names), step groups
- Add aeson to dependencies
- Add 4 tests: extraction + parsing for both fried-rice and
carrot-risotto example HTML files
- Wire NYTimesSpec into test runner
This commit is contained in:
@@ -3,13 +3,16 @@ module Main (main) where
|
||||
import Test.Tasty (defaultMain, testGroup)
|
||||
import Test.Tasty.Hspec (testSpec)
|
||||
|
||||
import qualified Roux.NYTimesSpec
|
||||
import qualified Roux.ParserSpec
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
parserTests <- testSpec "Parser" Roux.ParserSpec.spec
|
||||
nytTests <- testSpec "NYTimes" Roux.NYTimesSpec.spec
|
||||
defaultMain $
|
||||
testGroup
|
||||
"roux-server"
|
||||
[ parserTests
|
||||
, nytTests
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user