Commit 8e7abe7d authored by Mael NICOLAS's avatar Mael NICOLAS

Update README.md

parent ef9e638c
# halCrawler
# HAL API Crawler
## API documentation
https://api.archives-ouvertes.fr/docs
\ No newline at end of file
## Base website
https://api.archives-ouvertes.fr/docs
## Usage
### Entry function
The basic entry point of this crawler is the function `HAL.` `getMetadataWith`.
This function take a `Text` representing the query you want to run on hal
and a `Maybe Int` representing the maximum number of result you want to get.
### Return Type
The return type is a bit more tricky, it's **either** a `ClientError` or a `HAL.Client` `Response Corpus`.
In the usage it's exactly working as the other crawler `Documents` type, but it facilitate on the implementation side.
`Response x` represent a collection of `x` and the number of `x` returned.
` HAL.Doc.Corpus.` `Corpus` is a simple type that contain every informations we need (id,title,abstract,publicationDate,sources).
### Exemple
Here is a basic main using the entry point of the crawler and printing the 5 first results.
```hs
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Network.HTTP.Client (newManager)
import Network.HTTP.Client.TLS (tlsManagerSettings)
import Servant.Client
import HAL (getMetadataWith)
import HAL.Client
import HAL.Doc
import Tree
main :: IO ()
main = do
res <- getMetadataWith "artificial intelligence" (Just 10)
case res of
(Left err) -> print err
(Right val) -> print $ take 5 $ _docs val
```
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