Tweetbacks not working

Creating and modifying plugins.
Post Reply
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Tweetbacks not working

Post by danst0 »

Hi,

I think I got something wrong in the tweetback settings: Once again I just stumbled upon a tweet where one of my articles is linked (using a different short urler), but I do not get any tweetbacks. The attachment shows my settings do I do anything wrong, or how could I correct that?

Or may be the backtweet api is not working?

Daniel
Attachments
Tweetback Configuration
Tweetback Configuration
Configure Plugins - Serendipity Administration Suite (20110421).jpg (238.01 KiB) Viewed 6291 times
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Tweetbacks not working

Post by garvinhicking »

Hi!

Detecting tweetbacks is not really easy, due to the many different linkshorteners. And backtweet is also quite unstable and often hit by API limits...

Which linkshortener was used exactly, which missing tweeback are you referring to?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Tweetbacks not working

Post by danst0 »

Basically, since about January I did not receive any Tweetback anymore. And at least there are some.

Why not make the Tweetback-checking using plain twitter search:
If I search for my domain "scrmblog.com" I get all tweets referring to me even those which are using short urls and do not mention my blog directly.

Daniel
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Tweetbacks not working

Post by garvinhicking »

Hi!
danst0 wrote:Why not make the Tweetback-checking using plain twitter search:
If I search for my domain "scrmblog.com" I get all tweets referring to me even those which are using short urls and do not mention my blog directly.
How would you do that? :-)

When they use short urls, you do not know for which string to search. You must always search every link shortening service for your own URL and see if they have it in their database, and THEN you can use the twittersearch to search for that string. But this is already how the plugin does it.

The backtype api is only optionally used to bypass the need to query every link shortening services...

If you are missing specific tweetbacks, we can try to analyze why this is happening, but for that I would need the actual tweetids, and they may not be too old because if they are, the twitter serach API no longer finds them...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Tweetbacks not working

Post by danst0 »

Hi,

ok, for using the search function in twitter: Twitter seams to resolve and search the full url internally. Have a look at these search results: https://twitter.com/#!/search/scrmblog.com. There is not a single one with the full url...
If you are missing specific tweetbacks, we can try to analyze why this is happening, but for that I would need the actual tweetids, and they may not be too old because if they are, the twitter serach API no longer finds them...
I don't know how to find the tweet ids. But you can have a look at any of the search results above, none has any tweetbacks.

Daniel
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Tweetbacks not working

Post by garvinhicking »

Hi!

Yes, but the plugin matches the results of the twitter search to your local entries; and if the URL in there does not correspond to a created one, it cannot be associated to your blog entry.

Sadly I didn't code the tweetback/backtweet thing, and it is quite complex, so I can't really offer much more input...

How's your setup, did you use backtype API or not? Using backtype fully shortcircuits the logic and does not perform lookups to bit.ly etc., so you might want to disable backtype API to see if that creates tweetbacks for you in the future...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Tweetbacks not working

Post by danst0 »

Yes, but the plugin matches the results of the twitter search to your local entries; and if the URL in there does not correspond to a created one, it cannot be associated to your blog entry.
Thats the cool thing: You can also search for the full url and get the associated tweets back (including short urled)! As far as I understand the code right now it is done similarly, every time an article is called its url is checked at tweetback or the other services, so instead of doing this it could just check the twitter search using the full article url.

I just disabled tweetback, so let's see if that works.

Daniel
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Tweetbacks not working

Post by danst0 »

Ok, I enabled logging in the twitter plugin to trace the error.

Code: Select all

// writes a debug log into templates_c
@define('PLUGIN_TWITTER_DEBUG', True);
First obstacle: No log file is being generated, I click the link under the articles to check for a trackback and beside the negative result nothing is logged, but as far as I understand the code it should be...

Daniel
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Tweetbacks not working

Post by garvinhicking »

Hi!

When that var is enabled, the $this->log() should create a logfile. Did you check templates_c/serendipity_event_twitter.log? That's what it should default to...

I haven'T checked if the $this->log() method is called anywhere when a trackback is checked, but I see multiple occurrences...

For starters you could patch $this->log() to not only write the output, but simply echo it back to your HTML output.

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Tweetbacks not working

Post by danst0 »

garvinhicking wrote: When that var is enabled, the $this->log() should create a logfile. Did you check templates_c/serendipity_event_twitter.log? That's what it should default to...
Up to now I haven't found the log file anywhere on the server.
I haven'T checked if the $this->log() method is called anywhere when a trackback is checked, but I see multiple occurrences...
All functions within the serendipity_event_twitter.php which start with "function check_tweetbacks" contain (I added it to the one that did not).
For starters you could patch $this->log() to not only write the output, but simply echo it back to your HTML output.
I extended the log function by

Code: Select all

echo "Logging";
in the first line. But I have not found any occurrence in the html source, neither on the main page nor in article mode.

Daniel

ps: to be sure that I am editing the correct file I just put an echo into

Code: Select all

function introspect(&$propbag)
, and it produced output.
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Tweetbacks not working

Post by danst0 »

Ok, now I finally found a tweet on one of my articles. It is detected, when I press the "check for tweetback" buttons, but: it is not added as a trackback???

It is also not from my twitter account which is excluded and not in the recycler.

Daniel

ps. there is no entry in the log as well.
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Tweetbacks not working

Post by danst0 »

Hi Garvin,

I now found at least the reason why the tweetback plugin does not return all search results from twitter, when I type in a full url:

If you have a full_url (=domain.com/path/to/article) and enter it into the twitter search, you get all tweets that refer to this url, no matter if short or long, so basically perfect.

Now all the twitter plugin had to do was to search for full_url and use the results, but instead the plugin checks if the searched string is contained in the tweet (in Twitter.php 126-136):

Code: Select all

$checkfound = false;
foreach ($checkresultfor as $check) {
    if (strpos($item->text,$check)) {
        $checkfound =true;
        break;
    }
}
// if short url was not found *exactly* continue to next entry:
if (!$checkfound) {
    continue;
}
But this does not make sense since now we remove perfectly valid results which contain a short_url which points towards the full_url from the results.

I commented this part, and now at least all tweets for an entry are found, when I hit "check for tweetbacks".

I would suggest to remove this code from classes/Twitter.php, what do you say?

Daniel

ps. for this to work fully you have to include "uncompressed" in the "Tweetback Check Services" in the configuration. Better yet, the short url options there could be removed.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Tweetbacks not working

Post by garvinhicking »

Hi!

Wow! Great work! Thanks so much. I've committed your change, and I make sure that 'raw' is always included in the search.

Let's see how this works out :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply