Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
webarchive-api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
labs-team
webarchive-api
Commits
732a122c
Commit
732a122c
authored
6 years ago
by
Stefan Karner
Browse files
Options
Downloads
Patches
Plain Diff
Add fulltext search methods 'seed' and 'capture'
parent
d9a40571
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
webarchiv.py
+50
-0
50 additions, 0 deletions
webarchiv.py
with
50 additions
and
0 deletions
webarchiv.py
+
50
−
0
View file @
732a122c
...
...
@@ -149,6 +149,56 @@ class WebarchivSession:
self
.
_display_http_error
(
e
)
print
(
'
Query for
"
{}
"
not added
'
.
format
(
query_string
))
def
fulltext_search_within_domain
(
self
,
query_string
,
domain
,
from_
=
None
,
to_
=
None
):
"""
Start a fulltext seed search query in the Webarchive.
:param query_string: String to search for
:param domain: Search only within this domain name
:param from_: Optional earliest date bound for the search
in the format YYYYMM.
:param to_: Optional latest date bound for the search
in the format YYYYMM.
:return: HTTP Response object
"""
params
=
{
'
q
'
:
query_string
,
'
g
'
:
domain
}
if
from_
:
params
[
'
from
'
]
=
from_
if
to_
:
params
[
'
to
'
]
=
to_
try
:
response
=
self
.
_get
(
op
=
'
/search/fulltext/seed
'
,
params
=
params
)
return
self
.
waitForResponse
(
response
)
except
HTTPError
as
e
:
self
.
_display_http_error
(
e
)
def
fulltext_search_within_url
(
self
,
query_string
,
url
,
pagesize
=
10
,
from_
=
None
,
to_
=
None
):
"""
Start a fulltext capture search query in the Webarchive.
:param query_string: String to search for
:param url: Search only captures starting at this exact web address
:param from_: Optional earliest date bound for the search
in the format YYYYMM.
:param to_: Optional latest date bound for the search
in the format YYYYMM.
:return: HTTP Response object
"""
params
=
{
'
q
'
:
query_string
,
'
g
'
:
url
,
'
pagesize
'
:
pagesize
}
if
from_
:
params
[
'
from
'
]
=
from_
if
to_
:
params
[
'
to
'
]
=
to_
try
:
response
=
self
.
_get
(
op
=
'
/search/fulltext/capture
'
,
params
=
params
)
return
self
.
waitForResponse
(
response
)
except
HTTPError
as
e
:
self
.
_display_http_error
(
e
)
def
wayback_search
(
self
,
query_string
,
from_
=
None
,
to_
=
None
):
"""
Start a wayback search query in the Webarchive.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment