Commit 711abfab authored by Alexandre Delanoë's avatar Alexandre Delanoë

work together

parent a8a0f838
...@@ -31,24 +31,26 @@ getMetadataWith2 q = do ...@@ -31,24 +31,26 @@ getMetadataWith2 q = do
runClientM runClientM
(search (Just q) (Just 1) (Just 3) (Just "") (Just All) (Just Json)) (search (Just q) (Just 1) (Just 3) (Just "") (Just All) (Just Json))
(mkClientEnv manager' $ BaseUrl Https "search.iscpif.fr" 443 "") (mkClientEnv manager' $ BaseUrl Https "search.iscpif.fr" 443 "")
{--
read($url, function(err, article, meta) { parseWebsite :: T.Text -> IO T.Text
// Title
article.close();
-}
parseWebsite :: T.Text -> IO Int
parseWebsite url = parseWebsite url =
withSystemTempDirectory "" $ \tmpdir -> do withSystemTempDirectory "" $ \tmpdir -> do
withCurrentDirectory tmpdir $ withCurrentDirectory tmpdir $
traverse_ traverse_
callCommand callCommand
["npm init --yes", "npm install --save node-readability"] [ "npm init --yes"
, "npm install --save readability"
-- , "npm install --save node-readability"
]
withJSSession withJSSession
defJSSessionOpts {nodeWorkDir = Just tmpdir} defJSSessionOpts {nodeWorkDir = Just tmpdir}
[block| [block|
return 12; const read = (await import("readability")).default,
}); reader = new Readability("<body>bal<title>title</title></body>").parse();
return reader.title;
|] |]
specConcatEith :: Semigroup a => Either b a -> Either b a -> Either b a specConcatEith :: Semigroup a => Either b a -> Either b a -> Either b a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment