baedert / corebird

Native Gtk+ Twitter Client
https://corebird.baedert.org
GNU General Public License v3.0
795 stars 78 forks source link

3rd part image URLs removed but it might be integral to tweet #457

Open IBBoard opened 8 years ago

IBBoard commented 8 years ago

If a tweet contains a link to an image that Twitter decides to import as "media" then Corebird correctly pulls in the image and displays it, but incorrectly removes the link when it is in the middle, making the message not quite read as it did.

As an example, https://twitter.com/dsjkvf/status/675180706633510912 links to a Flickr image. The web interface shows:

Masashi Wakui @ Flickr https://www.flickr.com/photos/megane_wakui/ … / Color me Neuromancer. Like some stills from that @GreatDismal's novel. [image here]

whereas Corebird shows:

Masashi Wakui @ Flickr Color me Neuromancer. Like some stills from that @GreatDismal's novel. [image here]

Stripping the URL when it is at the end (e.g. for "uploaded to Twitter" images) works okay and is useful to remove a slightly pointless URL when you're already showing the media, but it probably shouldn't be done for external services/URLs in the middle of tweets.

baedert commented 8 years ago

That's not Twitter "importing" it, that's Corebird.

IBBoard commented 8 years ago

By "import" I meant "displays an image as additional media, even though it wasn't uploaded to Twitter".

In the case of the tweet I posted, the tweet has a Flickr URL in it. Twitter knows a bit about Flickr and "intelligently" decides to pull a preview image and do its extra "media" behaviour for that tweet. The same information is presumably in the Twitter feed that Corebird downloads.

When I posted this then I thought it had just lost a link for a single image (because I could see the image, had looked at it in Corebird, then saw the truncated URL on the main Twitter web interface and assumed it was just the image's URL).

In this case, though, Corebird has hidden a URL for a user's entire Flickr profile and instead just presented the one preview image that Twitter supplied. This loses links and extended details.

Having double-checked the tweet (search "masashi wakui neuromancer"), this only affects the list view, though, not the "view single tweet" mode, which retains the full URL.

baedert commented 8 years ago

By "import" I meant "displays an image as additional media, even though it wasn't uploaded to Twitter".

I know.

In the case of the tweet I posted, the tweet has a Flickr URL in it. Twitter knows a bit about Flickr and "intelligently" decides to pull a preview image and do its extra "media" behaviour for that tweet.

It's a so-called "Twitter Card" and has to be supported by the linked website, so it's as much Flickr's doing.

The same information is presumably in the Twitter feed that Corebird downloads.

No. Corebird gets the flickr url and shows the linked image (since #222). We'er just failing to see that it's not an image but a profile. The current code just checks for a flickr.com/photos/ prefix.

Having double-checked the tweet (search "masashi wakui neuromancer"), this only affects the list view, though, not the "view single tweet" mode, which retains the full URL.

The tweet info page never removes anything from the tweet text.

IBBoard commented 8 years ago

Ah, okay, that's a bit clearer. So Twitter only supplies the image URLs when it is an image uploaded to Twitter, even though it does the "Twitter Cards" for other sites?

Having just looked at the feed of "dsjkvf" then Flickr matching might be a bit complex, because the latest tweet now (Helsinki 1908) links to a photo set. It looks like Corebird should just be picking "/photos/[username]/[numbers]/" with an optional "in/album-[numbers]/" at the end.

baedert commented 8 years ago

Corebird should just be picking "/photos/[username]/[numbers]/" with an optional "in/album-[numbers]/" at the end.

Or I just remove the indexing of flickr images altogether.

IBBoard commented 8 years ago

I think it is useful, and the more it is like the web interface for loading media the better for me. If you don't want to fix it then I can take a look and try to supply a patch. My general plan was to submit bug reports then look in to fixing things where I could.

IBBoard commented 8 years ago

I've got a first pass fix that I think emulates the Twitter behaviour more closely.

If it is a Twitter image then the image gets loaded and the link gets removed, just as the Twitter web interface does.

If it is an external image that could be loaded then it gets loaded but the link stays in place. This means that any image posted such that we can retrieve it from the OpenGraph header tag of a web page still has the link available so that people can visit the page and rate/comment/etc as appropriate.

The only problem I've got at the moment is that a photo that is posted by a system that links to the photo and uploads it results in the media panel showing the image twice. I'm not sure that there's a reliable way around that, though. I'll give it a think.

For examples of how it works now, search "flic.kr" and "vine.co" and see more embedded media :)