Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
searx
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
crawlers
searx
Commits
f1e873f0
Commit
f1e873f0
authored
Sep 23, 2019
by
Mudada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add readability
parent
3cd592a2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
3 deletions
+47
-3
.gitmodules
.gitmodules
+3
-0
Main.hs
app/Main.hs
+4
-2
inline-js
inline-js
+1
-0
package.yaml
package.yaml
+5
-0
SEARX.hs
src/SEARX.hs
+30
-0
stack.yaml
stack.yaml
+4
-1
No files found.
.gitmodules
0 → 100644
View file @
f1e873f0
[submodule "inline-js"]
path = inline-js
url = https://github.com/tweag/inline-js
app/Main.hs
View file @
f1e873f0
...
...
@@ -6,7 +6,9 @@ import SEARX
main
::
IO
()
main
=
do
res
<-
getMetadataWith
"ia"
300
res
<-
getMetadataWith
"ia"
1
case
res
of
(
Left
err
)
->
print
err
(
Right
r
)
->
print
r
(
Right
r
)
->
do
a
<-
parseWebsite
"https://www.lemonde.fr/economie/article/2019/09/23/thomas-cook-semble-se-diriger-vers-une-faillite_6012630_3234.html"
print
a
inline-js
@
ad33fe42
Subproject commit ad33fe42821d146a6dc8c18c4f31ee7ba27e3fa4
package.yaml
View file @
f1e873f0
...
...
@@ -28,6 +28,11 @@ dependencies:
-
servant-client
-
http-client
-
http-client-tls
-
inline-js
-
inline-js-core
-
process
-
directory
-
temporary
library
:
source-dirs
:
src
...
...
src/SEARX.hs
View file @
f1e873f0
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
module
SEARX
where
import
Network.HTTP.Client
(
newManager
)
import
Network.HTTP.Client.TLS
(
tlsManagerSettings
)
import
Language.JavaScript.Inline
import
System.Directory
import
System.IO.Temp
import
System.Process
import
Servant.Client
import
SEARX.Client
import
Data.Foldable
import
qualified
Data.Text
as
T
{-
...
...
@@ -20,6 +31,25 @@ getMetadataWith2 q = do
runClientM
(
search
(
Just
q
)
(
Just
1
)
(
Just
3
)
(
Just
""
)
(
Just
All
)
(
Just
Json
))
(
mkClientEnv
manager'
$
BaseUrl
Https
"search.iscpif.fr"
443
""
)
{--
read($url, function(err, article, meta) {
// Title
article.close();
-}
parseWebsite
::
T
.
Text
->
IO
Int
parseWebsite
url
=
withSystemTempDirectory
""
$
\
tmpdir
->
do
withCurrentDirectory
tmpdir
$
traverse_
callCommand
[
"npm init --yes"
,
"npm install --save node-readability"
]
withJSSession
defJSSessionOpts
{
nodeWorkDir
=
Just
tmpdir
}
[
block
|
return 12;
});
|]
specConcatEith
::
Semigroup
a
=>
Either
b
a
->
Either
b
a
->
Either
b
a
specConcatEith
(
Left
_
)
b
=
b
...
...
stack.yaml
View file @
f1e873f0
...
...
@@ -34,10 +34,13 @@ resolver: lts-14.4
# - wai
packages
:
-
.
# Dependency packages to be pulled from upstream that are not in the resolver
# using the same syntax as the packages field.
# (e.g., acme-missiles-0.3)
# extra-deps: []
extra-deps
:
-
./inline-js/inline-js-core
-
./inline-js/inline-js
# Override default flag values for local packages and extra-deps
# flags: {}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment