duckduckgo / zeroclickinfo-spice

DuckDuckGo Instant Answers based on JavaScript (JSON) APIs
https://duckduckhack.com/
Other
548 stars 942 forks source link

XKCD: Breaks for "Dynamic" Comics #992

Closed zgrep closed 7 years ago

zgrep commented 10 years ago

The way I see it, to have interactive xkcd's work, I see two options:

For more information, what currently happens is it shows the previous xkcd. Not sure if this is xkcd's doing or built in...


IA Page: https://duck.co/ia/view/xkcd Maintainer: @sdball

jagtalon commented 10 years ago

@egrepnix Ah I think I've seen some of those. Do you have specific examples so that we can check it out?

snay2 commented 10 years ago

This is the only interactive one I've seen: http://www.xkcd.com/1350/ But there are some other dynamic ones that aren't interactive per se: http://www.explainxkcd.com/wiki/index.php/Category:Dynamic_comics

zgrep commented 10 years ago

The link @snay2 gave (http://www.explainxkcd.com/wiki/index.php/Category:Dynamic_comics) seems to have a nice list of the interactive/animated/dynamic comics.

Which I proceeded to then check:

Working: 961, 1116, 1264 Appears, but isn't dynamic (and the most/all of meaning of the comic is lost): 1331, 826, 1110, 1335 Doesn't work, so it shows the previous comic: 1350, 1037 Doesn't show the comic: 1190 Doesn't appear at all: 1193 No longer dynamic at xkcd.com, therefore optional: 880 (http://xk3d.xkcd.com)

jagtalon commented 10 years ago

Thanks for the examples, @egrepnix @snay2! The ones that work are gifs so thankfully those work. With the others such as the ones that don't appear at all and the ones that show the previous comic, it's because of the xkcd API (if you take a look at http://xkcd.com/1350/info.0.json, you'll see that there's a link to the image, but it's not the right one.)

It doesn't say if it's dynamic content either. Hmm, not sure what to do either, but I'll keep it in mind.

moollaza commented 8 years ago

I just realized that for some of these "Dynamic" Comics the Instant Answer looks is broken:

We should implement a check for these and alter the display to provide a link or something so that it doesn't look broken.

moollaza commented 8 years ago

This IA is breaking again today, showing an empty space where he comic would be.

@duckduckgo/duckduckhack-contributors anyone interested in investigating a better way to handle they interactive comics?

We should at least provide a message that explains we can't display the comic so the user understands what's going on.

rikusilvola commented 8 years ago

I gave it a quick look, and some of those issues could be solved quite easily. No image happens when the JSON returned by xkcd contains img url without actual image (commonly just "http:\/\/imgs.xkcd.com\/comics\/", simple to catch and inform the user. Unfortunately for some of the cases xkcd will return a link to an actual placeholder image, as is the case with Landing comic 1446, where the link is to http://imgs.xkcd.com/comics/%3F%3F%3F.png , a valid blank white image. Handling a case like this would be considerably more difficult.

prasadram commented 8 years ago

Hi All, I am interested

On Tue, 5 Apr 2016 18:54 Riku-Pekka Silvola notifications@github.com wrote:

I gave it a quick look, and some of those issues could be solved quite easily. No image happens when the JSON returned by xkcd contains img url without actual image (commonly just "http:\/\/imgs.xkcd.com\/comics\/", simple to catch and inform the user. Unfortunately for some of the cases xkcd will return a link to an actual placeholder image, as is the case with Landing comic 1446 https://duckduckgo.com/?q=xkcd+1446, where the link is to http:\/\/ imgs.xkcd.com\/comics\/%3F%3F%3F.png , a valid blank white image. Handling a case like this would be considerably more difficult.

— You are receiving this because you are on a team that was mentioned.

Reply to this email directly or view it on GitHub https://github.com/duckduckgo/zeroclickinfo-spice/issues/992#issuecomment-205802937

philipmiesbauer commented 8 years ago

How about framing the image of to show that the picture is there but white?

On Tue, Apr 5, 2016, 14:33 prasadram notifications@github.com wrote:

Hi All, I am interested

On Tue, 5 Apr 2016 18:54 Riku-Pekka Silvola notifications@github.com wrote:

I gave it a quick look, and some of those issues could be solved quite easily. No image happens when the JSON returned by xkcd contains img url without actual image (commonly just "http:\/\/imgs.xkcd.com\/comics\/", simple to catch and inform the user. Unfortunately for some of the cases xkcd will return a link to an actual placeholder image, as is the case with Landing comic 1446 https://duckduckgo.com/?q=xkcd+1446, where the link is to http:\/\/ imgs.xkcd.com\/comics\/%3F%3F%3F.png , a valid blank white image. Handling a case like this would be considerably more difficult.

— You are receiving this because you are on a team that was mentioned.

Reply to this email directly or view it on GitHub < https://github.com/duckduckgo/zeroclickinfo-spice/issues/992#issuecomment-205802937

— You are receiving this because you are on a team that was mentioned.

Reply to this email directly or view it on GitHub https://github.com/duckduckgo/zeroclickinfo-spice/issues/992#issuecomment-205806769

rikusilvola commented 8 years ago

@philipmiesbauer I took that approach on another project that gathers and displays images from multiple sources, but while it makes it easier to see that the image "exists", this really adds little value as the blank image is not what the artist meant to publish. In addition, adding visual frames can have a negative effect on what the artist wanted to convey with the image. Consider comics where the 4th wall is physically broken. In those cases adding the frame would break the illusion.

EpicWolverine commented 8 years ago

Just a note: 1335 is already hard-coded to be static, despite the xkcd JSON API returning the correct current comic (http://imgs.xkcd.com/comics/now.png, which always redirects to the current one).

In xkcd_display.js:

// Add exception for comic 1335. if(api_result.num === 1335) { api_result.img = 'http://imgs.xkcd.com/comics/now/12h30m.png'; }

While hard-coding placeholders (or even working versions for comics like 1335 and 1331) of all the dynamic or interactive comics is not ideal, it may be a good temporary solution. I wonder if we could even get in touch with Randall or davean the sysadmin (https://xkcd.com/about/) to see if they can add some sort of flag or other indicator to the API to tell us it is a dynamic comic so it can be handled better.

rikusilvola commented 8 years ago

I'd say a combination of these would be the best option. Naturally when the img url is obviously incorrect, such as linking just to https://imgs.xkcd.com/comics/, or missing completely, some indication could be shown to the user, as proposed in the original issue. However, the link being invalid can't be assumed to mean that the corresponding comic is interactive. Having a proper indicator for this in the JSON retrieved from xkcd would be optimal. Anyone know if davean is on GitHub?

soleo commented 8 years ago

According to https://keybase.io/davean, This is him.

sdball commented 8 years ago

Five years ago I was a front end developer and wrote the first spice PR to add xkcd comics to DDG. It was a fun project and I'd love to continue maintaining it (although it's changed quite a bit since 2011). Unfortunately I simply don't have the time to volunteer. I'm going to unplug from this.

MrChrisW commented 8 years ago

No problem @sdball, thanks for letting us know!

We're in the process of pinging the creators of various IA's to see if people would like to continue maintaining them, if not someone else will jump on board!

Thanks for your original contribution (5 years ago) - I'm sure this IA will continue to be improved by the DDG community. :+1:

MrChrisW commented 8 years ago

Ultimately this needs an upstream API change to indicate if the comic is dynamic or not, as suggested by several members. Ping @davean to humbly request this option be looked at.


As a workaround I'd suggest we check the title value matches the filename of the image returned in the url value, this will resolve issues with returning the previous comic 1350 and with displaying a placeholder 1446 :cry:

zgrep commented 8 years ago

Unfortunately, that workaround would fail for earlier comics such as 1, 2, 3, etc.

MrChrisW commented 8 years ago

@zgrep You're correct! I manged to get past the matching of comics 1,2 & 3 (with some wacky code) :stuck_out_tongue_winking_eye:

Unfortunately there's a few more (24 in total) titles that don't match the url filename at all so this isn't a solution, it also feels like an anti-pattern..

MrChrisW commented 8 years ago

After more testing I think the best way to processed as a temporary solution (in the absence of an API update) is to create a blacklist file with a list of dynamic/non-working comics, we can then avoid triggering the IA or display a message as suggested by @zgrep if a comic id is found in the blacklist.

Comics to be added to the blacklist:

Let me know if I'm missing any non-working comics

zgrep commented 8 years ago

According to @davean, the API is in the process of being rewritten, along with the website itself. Hopefully a more permanent and supposedly better solution will present itself in the future.

I also asked if it was possible to add a "dynamic" part to the current JSON API. The answer is, of course, that it's possible. But, it turns out that any comic that changes the page around it would be considered dynamic, such as 1005: SOPA, which probably isn't what's considered to be dynamic in human terms and/or DuckDuckGo-successfully-embeddable-images terms.

For now, however, until the future manages to bestow itself upon us, there aren't so many dynamic comics that it's not unthinkable of simply coding in a list of exceptions, as mentioned by @MrChrisW. Any dynamic comics that we wish to support in some way, such as 1335: Now, could simply have hard-coded exceptions, as 1335 has at the moment (even though personally I don't agree with the way in which it's handled).

Also, @MrChrisW, some of those links have an extra ] in them.

moollaza commented 7 years ago

Closing due to DDH entering Maintenance Mode. We are only accepting issues for essential bugs.

It doesn't look like the XKCD API has changed yet anyways.