Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search: some Bing fixes (UA spoofing, example test, regex) #1852

Merged
merged 1 commit into from
Apr 30, 2020
Merged

Conversation

dgw
Copy link
Member

@dgw dgw commented Apr 27, 2020

Description

Bing results look different than they used to; the HTML has changed a little. Seems like Bing also sends fake "No results" pages to the default requests user-agent, so we now spoof for both DDG and Bing.

Not knowing how long this was broken, I added an example test for Bing. Hopefully it will help us catch future breakage, while not becoming an annoyance. If it starts failing at random too often, I'll nuke it.

This should also fix the xkcd plugin not being able to find comics by keyword, since it relies on the search plugin's Bing function.

Checklist

  • I have read CONTRIBUTING.md
  • I can and do license this contribution under the EFLv2
  • No issues are reported by make qa (runs make quality and make test)
    • I ran tests with coverage3 and -k 'test_example_bing', so I only paid attention to tests directly related to this change.
  • I have tested the functionality of the things this change touches

Bing results look different than they used to; the HTML has changed a
little. Seems like Bing also sends fake "No results" pages to the
default requests user-agent, so we now spoof for both DDG and Bing.

Not knowing how long this was broken, I added an example test for Bing.
Hopefully it will help us catch future breakage, while not becoming an
annoyance. If it starts failing at random too often, I'll nuke it.

This should also fix the xkcd plugin not being able to find comics by
keyword, since it relies on the search plugin's Bing function.
@dgw dgw added Tweak Bugfix Generally, PRs that reference (and fix) one or more issue(s) labels Apr 27, 2020
@dgw dgw added this to the 7.0.2 milestone Apr 27, 2020
@dgw dgw requested a review from a team April 27, 2020 02:28
@dgw
Copy link
Member Author

dgw commented Apr 27, 2020

I already had to kick two of the seven CI builds for this, but only one of those was actually Bing. (The other was some weird-ass mismatch in a rand test, which is a whole other can of worms.)

Still, though, I'm not sure if this test is a great idea, given my comments in 484aa38 (Aug 2018).

Copy link
Contributor

@Exirel Exirel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Search is so ugly... :D

@dgw
Copy link
Member Author

dgw commented Apr 29, 2020

Hoping for #1853 to go in first, in which case I'll update this to take advantage of recorded HTTP requests and bypass the random "No results" issue entirely.

@dgw dgw merged commit 0c00af2 into 7.0.x Apr 30, 2020
@dgw dgw deleted the fix-bing branch April 30, 2020 18:32
dgw added a commit that referenced this pull request Apr 30, 2020
I should have revisited #1364 and dropped these from #1852. They're
nothing but trouble until we have #1853 or something like it to replay
known-good HTTP requests and isolate our tests from random bad replies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix Generally, PRs that reference (and fix) one or more issue(s) Tweak
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants