-
Notifications
You must be signed in to change notification settings - Fork 53
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
Make Bing search asynchronous #570
Conversation
Hey @parradam - thanks for giving this one a shot :-) appreciated. Re point 2, moving it into JS: I wasn't thinking of that, b/c the python code to parse the returned results and get the real image sources works, and it ought to be relatively easy to still call that method from ajax, but modify it so that it returns just a list of image URLs. I don't think that moving that call and the parsing to JS reduces any complexity, it just moves code and rewrites it. So, I feel that something like this should work:
and that struct would then be handled by the ajax call from the template. Does that make sense? Re point 1: "This seems to work some of the time, but not always." -- sometimes I get weird blocky things in my image list, and I haven't bothered to look into it :-) 👋 |
(assigning to you b/c you're still hacking at it, just so I see it on the project board) |
Hey @jzohrab ! Happy to keep hacking away :-) hopefully with more sleep behind me this time! Thanks for your patience and for your input! So here is my thought process, based on our conversation so far, just to ensure we are on the same page. The
On the plus side, it looks like Bing is talking to me again. I did some debugging yesterday on that, and will see if there's anything I can do with the headers (such as Hope this is useful, and if it sounds sensible, I'm happy to get this done tomorrow! |
Hey @parradam - that sounds like what I was thinking too. Thx for chatting about it to clarify -- writing a good spec takes time and sometimes I skip it :-) Cheers! |
0ced891
to
9322479
Compare
Hey @jzohrab , no problem :-) I've force pushed an updated approach - see what you think! Usual issues with Bing not playing ball, but I was able to experiment returning an object with an Any thoughts on testing? I guess we could mock the Bing response and check the image renders, might be a pain though? |
Will take a look soon, am sick. 🤒 Yeah testing is a big hassle and I didn’t bother :-). During testing there’s a variable set to disable images actually. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @parradam - Haven't tried the code but it looks great! One small comment tweak requested. Is this still draft, or do you think it's good to go?
(PRs go to the dev branch, master is for launched code) |
@jzohrab Hope you're feeling better! Appreciate the feedback! Have incorporated your comment, I'd just like to make sure that Bing behaves as expected before I mark it as ready. Should be able to confirm that in the next day or two. Thanks for fixing the base branch, I realised and rebased it locally but didn't update the PR - oops! |
@jzohrab quick update! I've been experimenting with this and I get a blank page back (again) which is quite annoying: <!DOCTYPE html><html xml:lang="en" xmlns=http://www.w3.org/1999/xhtml xmlns:Web=http://schemas.live.com/Web><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Bing</title><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><meta name="viewport" content="width=device-width, initial-scale=1"></head><body></body></html> I've been messing around with different headers (user agent, referer, accept-language, accept) but no luck so far. I can return a dummy image by subbing in Thought I'd raise a flag now before I go too far down this rabbit hole! |
Thanks @parradam , I’ll try it out today. I’ve had times when the URL went dark, maybe periodic blacklisting. Clears up eventually, so far. Will let you know, thanks! |
@parradam - it's working fine for me, are you still seeing a blank screen? Looks great! |
@jzohrab amazing! Yes, still dark for me. Possibly due to the amount of experimentation I did! Thanks so much for testing it! I'll just push my commit (from memory it was just the docstring but will check) and then I'll mark it for review. :-) |
9322479
to
fa48e7d
Compare
I've rebased onto Lute's Double checked and all tests seem to be passing. Hope it's ok! :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I'll fix the conflicts which I just created now. :-) Cheers!
Thanks very much @parradam, super! |
This PR removes the template tags for images, and replaces them with a JS call once the DOM has loaded. Relates to #563
Just wanted to push at this stage as:
bing_search
because it seems like the images sources aren't always passed into the template