Hello,

This is a request for the same functionality requested here

http://drupal.org/node/1520008

but for the 7.x branch. This would be a really useful feature!

Jimbo

Comments

juampynr’s picture

Version: 7.x-3.0-beta4 » 7.x-3.x-dev

Changing version name. I have closed the other ticket so we can focus the work for all versions here.

xurizaemon’s picture

the patch in zipfile on #1520008: Extract actual URLs from t.co wrappers using Tweet Entities was a bit bung and contained some other code

this appears to be it if anyone wants to make a proper patch.

 		    if ($tweet_to_be_processed['entities']) {
 			   if ($tweet_to_be_processed['entities']['urls']) {
 			     foreach ($tweet_to_be_processed['entities']['urls'] as $pr_url) {
 			       if ($pr_url['expanded_url']) {
 			         $response_decoded['text'] = preg_replace('/' . preg_quote($pr_url['url'], '/') . '/', $pr_url['expanded_url'], $response_decoded['text']);
 			       }
 			       //$tweet_to_be_processed['text'] = 'Expanded URL: /' . preg_quote($pr_url['url'], '/') . '/';
 			     }
 			   }
  		    }

based on general twitter.com behaviour, stripping t.co URLs out from user content probably a violation of twitter policy :P

13rac1’s picture

This doesn't seem to be a twitter policy violation. Twitter specifies how to render (unwrap) t.co here: https://dev.twitter.com/docs/tco-link-wrapper/faq#How_do_I_render_links_...

tommyk’s picture

I would be very interested in how to achieve this also. I'm actually using 6.x-5.0, but if the latest version is updated, I think backporting will be easy.

dddave’s picture

Version: 7.x-3.x-dev » 7.x-6.x-dev
Eupeodes’s picture

Issue summary: View changes
StatusFileSize
new2.12 KB

My proposal for a fix. It also includes code to store a media url in the db, I am aware that this is not really part of the request, so if needed I am willing to create a separate request and patch for that. I just tested this and it works on my site. Please be aware that it only works on import of tweets. So please do not complain that your current tweets are not updated.

Eupeodes’s picture

Status: Active » Needs review
StatusFileSize
new2.03 KB

completed the diff, now also the view is included. Still some work needs to be done on getting the media thing working with lightbox or similar image handlers. But this should be a separate issue I think.

dgeo’s picture

Version: 7.x-6.x-dev » 7.x-5.x-dev
StatusFileSize
new2.79 KB

This makes sense for me too :)

Here is the same as "git patch" tested working for 7.x-5.x version

dgeo’s picture

StatusFileSize
new1.07 KB

finally I removed media's DB things as suggested: it may need more work and is not related with this issue.

It may be more safe to commit quickly too ;)

damienmckenna’s picture

Status: Needs review » Needs work

Triggering the testbot.

damienmckenna’s picture

Status: Needs work » Needs review

Triggering the testbot.

doitDave’s picture

Obviously the test bot has been triggered successfully. Could we have this in a soon release, please? Would really be great :-)

benjarlett’s picture

I am interested in this, but I ran the patch and "Hunk #1 FAILED at 1285."

dgeo’s picture

Tested (and approved) here, on 7.x-5.x-dev (along with date_api integration patch

damienmckenna’s picture

Status: Needs review » Needs work

The schema needs to be updated to match this - 255 chars will run out rather quickly when you start having multiple URLs in one tweet.

dgeo’s picture

How much space should we reserve for a tweet ? 140 + X URL's (according to first search engines responses, an URL may have 8192 chars…)

Shouldn't we use a TEXT field here ?

I'm not very confident with migrations… do someone know how to change field type ?

Or maybe shorten URL conditionnaly (checking the twit's length)

damienmckenna’s picture

Closed a duplicate: #2599064: t.co to bit.ly urls

annared’s picture

When i apply the patch i get "Hunk #1 FAILED at 1285."
Patching it manually doesn't work either. Any idea?

Thanks

damienmckenna’s picture

@annared: The patch needs to be rerolled and improved.

dgeo’s picture

Status: Needs work » Needs review
StatusFileSize
new1.03 KB

Field "text" field is blob now, so lenght should not be a problem anymore.

Re-rolling the patch, hope it can be commited this time…