rbreu / beeref

BeeRef Reference Image Viewer
GNU General Public License v3.0
512 stars 38 forks source link

Pinterest drag and drop problem #97

Closed Randommist closed 5 months ago

Randommist commented 6 months ago

If you try to drag an image from your Pinterest feed, you get an error. I have attached two videos, one with the original version, and the second with my rough correction https://github.com/Randommist/beeref/tree/easy_drag_and_drop

https://github.com/rbreu/beeref/assets/70176501/b6994151-0c76-4ec2-8dcc-7a199cd2d87a https://github.com/rbreu/beeref/assets/70176501/23aeea0e-a9f9-44a5-890e-d48bcb20b16e

If this problem is interesting to you, I could take it on.

sensoph1 commented 5 months ago

I ran into this issue as well, I wonder if it has to do with the way previews are stored in pinterest. if you go into the pin you can then drag the image into beeref.

rbreu commented 5 months ago

I'm sorry, somehow I missed the notification for this issue. A couple of sites try to prevent copy&pasting etc, might be because of that.

@Randommist if you are still up for it, feel free to open a pull request. Might have to make sure that the case mentioned above where it already works doesn't break. If you feel able to add unit tests as well, that would be great, otherwise it'd help if you can provide a couple of example urls and what the resulting url looks like.

Randommist commented 5 months ago

When we drag a preview image from the pinterest feed, we get a URL like https://en.pinterest.com/pin/{some_pin_id}/, but Beeref needs a URL ending in jpg or etc. example https://i.pinimg.com/564x/c5/c6/68/c5c668cd4d4777a7b0e2a9b4bf5fa8e7.jpg. Therefore, we need to handle the URL with the pinterest.com domain in a special way. This situation may arise with other similar sites, and for each case modifications will have to be made. Therefore, I would be glad if they wrote to me on what other sites there is such a problem

rbreu commented 5 months ago

Oh yeah, I see, because they are giving the link to the detail page, not the link to the actual image.

Since @sensoph1 says it works on the actual detail page, that must already give the direct image link. (I can't test it; for me it won't let me drag from there at all. I don't have an account though.) I'd suggest putting the workaround code into the except block so that all cases that already work on Pinterest won't accidentally break.

Since pinterest is pretty popular, it makes sense to have a workaround for just that.

rbreu commented 5 months ago

Thanks for the MR! It will go out with the next release.