Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
searx-engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
searx-engine
Commits
2292e6e1
Commit
2292e6e1
authored
Jan 02, 2020
by
Adam Tauber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] handle missing result size
parent
a1b85571
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
bing.py
searx/engines/bing.py
+4
-3
No files found.
searx/engines/bing.py
View file @
2292e6e1
...
...
@@ -63,6 +63,8 @@ def response(resp):
results
=
[]
result_len
=
0
dom
=
html
.
fromstring
(
resp
.
text
)
# parse results
for
result
in
eval_xpath
(
dom
,
'//div[@class="sa_cc"]'
):
...
...
@@ -89,8 +91,7 @@ def response(resp):
'content'
:
content
})
try
:
result_len_container
=
""
.
join
(
eval_xpath
(
dom
,
'//span[@class="sb_count"]/text()'
))
result_len_container
=
utils
.
to_string
(
result_len_container
)
result_len_container
=
""
.
join
(
eval_xpath
(
dom
,
'//span[@class="sb_count"]//text()'
))
if
"-"
in
result_len_container
:
# Remove the part "from-to" for paginated request ...
result_len_container
=
result_len_container
[
result_len_container
.
find
(
"-"
)
*
2
+
2
:]
...
...
@@ -102,7 +103,7 @@ def response(resp):
logger
.
debug
(
'result error :
\n
%
s'
,
e
)
pass
if
_get_offset_from_pageno
(
resp
.
search_params
.
get
(
"pageno"
,
0
))
>
result_len
:
if
result_len
and
_get_offset_from_pageno
(
resp
.
search_params
.
get
(
"pageno"
,
0
))
>
result_len
:
return
[]
results
.
append
({
'number_of_results'
:
result_len
})
...
...
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