Support Yahoo! Buzz
hectorplus - June 1, 2008 - 22:22
| Project: | Service links |
| Version: | 6.x-2.x-dev |
| Component: | User interface |
| Category: | feature request |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Description
Just a feature request for buzz (buzz.yahoo.com) and mixx (mixx.com).

#1
Yahoo Buzz is now open to all so would be good to see this feature added ASAP.
See http://buzz.yahoo.com/buttons
#2
BuzzUp would be a big plus. Subscribing
#3
+ 1 for Buzz
#4
Add buzz please :)
#5
A vote for both.
#6
Looking at this.
#7
If someone cares about Mixx, let's deal with that in a separate ticket. There seems to be reasonable demand for this service, and not worth bogging down this issue with something unrelated.
#8
Hm. This is a pain. :P
So the code to display the links looks like this:
<?phpif (variable_get('service_links_show_SERVICE', 0)) { $links['service_links_SERVICE'] = theme('service_links_build_link', t('SERVICE_NAME'), "URL_TO_SERVICE?u=$url&t=$title", t('Bookmark this post on SERVICE_NAME.'), 'images/SERVICE.png', $nodelink);
}
?>
Problem is, Yahoo! Buzz doesn't give one of those nice URL_TO_SERVICE URLs. Instead, it has JavaScript like so:
<script type="text/javascript"src="http://d.yimg.com/ds/badge2.js"
badgetype="logo">
$url
</script>
badge2.js is of course one long line of obfuscated JS, deliberately written to make it difficult to discern what the "root" URL is. I ran it through http://www.prettyprinter.de/, which helped some, but it's still going to take some time and effort to reverse-engineer it properly.
An alternative is to make a special theme function just for Yahoo! Buzz that starts as basically a copy/paste of theme_service_links_build_link but outputting Yahoo!'s JS rather than the default stuff. It wouldn't be as powerful, since you can't do things like open it in a new window and such, and it introduces something unstandard from everything else in the module.
#9
Ok, here's an initial stab at this using the same URL type construct as the rest around it.
I think this /should/ work, but I'm having a hard time getting the widget on its own, regardless of Drupal, to actually do anything. It alternates between "Hm. For some reason that's not in our system. We'll get to the bottom of it soon." and "There was an error processing your vote."
#10
Let's try this...
#11
Ok. I think I see. Yahoo! must have some security-checking code that prevents you from submitting a vote on a URL from anywhere but the URL. When I copy/paste that same widget above, it fails for me on localhost.
I guess I'm installing this module on webchick.net then. :P
It'd be really awesome if I'm having trouble getting the Yahoo! Buzz botton [sic] to work on my site. Why? was far less useless.
#12
Nate/quicksketch did some digging with Firebug and Tamper Data... turns out that JS is submitting a POST request, and must be checking server-side for the protocol, thus making it impossible to vote without JS. So... we're into special casing this. Bleh.
#13
Okay, here's some more information that I've been able to dig up:
- Buzz actually uses POST request when submitting articles, so a simple link is not possible as far as their API reveals
- Using the TamperData Firefox plugin, we can emulate the POST request by building a similar form
Here's code that almost makes this work, for this particular issue:
<form action="http://buzz.yahoo.com/vote/" method="POST"><input type="hidden" name="votetype" value="1" />
<input type="hidden" name="loc" value="drupal.org" />
<input type="hidden" name=".done" value="/article/pub/http%253A%252F%252Fdrupal.org%252Fnode%252F265391" />
<input type="hidden" name="headline" value="Your mom" />
<input type="hidden" name="guid" value="http://drupal.org/node/265391" />
<input type="hidden" name="publisherurn" value="pub" />
<input type="hidden" name="assettype" value="article" />
<input type="hidden" name="from" value="pub" />
<input type="submit" value="Submit" />
</form>
Or rendered out:
We potentially make this an image button, then put a text link next to it that submits the form (this is essentially what that Yahoo JS file does).
#14
Trying the fancy widget that lets you pass in parameters...
#15
Ok, sounds like the way to fix this is add a new theme function specifically for Yahoo! Buzz, and base it off of what Fivestar does to show pretty stars instead of ugly radio buttons. Will probably need to duplicate a ton of logic from theme_service_links_build_link(). Meh. But, at least we could make this icon behave consistently with the others (for example, none of Yahoo! Buzz's widgets are "Text only" or "Icon with 'Yahoo! Buzz' next to it").
#16
Note: I actually submitted this issue as a Buzz article so that we can test our makeshift implementation against existing stories.
#17
Sorry I keep crossposting :P
Here's a patch that should work fully. Unfortunately Buzz just has an unbelievably crappy API and everything has to be submitted via a POST request. This patch makes a few necessary changes to add a class to Buzz links and adds a buzz.js file that handles the submission of Buzz links.
#18
This looks good. The only thing I'd recommend is naming the JS something more generic like "service_links.js" because chances are this isn't the first service that's going to need this kind of goofy workaround.
#19
Here we go.
#20
What about for version 5.x-1.0?
#21
#22
I do not know how much useful this page is, but I found one page that talks about Yahoo Buzz related to Drupal, so I am posting it here:
http://drupal.org/files/issues/service_links-yahoo-buzz-265391-19.patch
They say a form is needed in the service_links module.
----
Your resource for finance and IT!
Central European Center for Finance and Management
#23
That is the same patch listed in comment #19.. When I apply the patch to Drupal 5 it #2 (at line 329) and #3(at line 343).. I'm assuming this is because its new code since introduced for drupal 6. Is there any way I can get this working with version 5?
#24
Subscribing so I can try out the patch when I get home!
#25
patch in #19 worked for me on 6.x-1.0, Thanks!
#26
I'd rather not use the JavaScript and just instead use the straight link tag. Here's the patch for both Drupal 5 and 6 branches, and the required images/buzz.png.
#27
Rob patch added in 5.x and 6.x dev. version,
thank you alls for this interesting issue!
#28
Automatically closed -- issue fixed for 2 weeks with no activity.
#29
Hi, I just got a note from the folks at Yahoo Buzz! noting that the correct way to implement the non-JS version of the Buzz button is as follows:
http://buzz.yahoo.com/buzz?publisherurn=PUBLISHER_URN&targetUrl=TARGET_U...
PUBLISHER_URN is for those who have a publisher relationship with Yahoo Buzz
TARGET_URL, HEADLINE and SUMMARY are self-explanatory
I'd recommend this generic change to the current service_links module, starting line 391:
if (variable_get('service_links_show_buzz', 0)) {$links['service_links_buzz'] = theme('service_links_build_link', t('Buzz Up!'), "http://buzz.yahoo.com/buzz?targetUrl=$url&headline=$title&summary=$summary", t('Buzz up this post on Yahoo! Buzz.'), 'buzz.png', $nodelink);
}
To be more complete (and this is what I have implemented on fastcompany.com, for now) perhaps the Yahoo Buzz! publisherurn could be added as an admin setting too, starting line 137:
$form['what_links_to_show']['service_links_show_buzz'] = array('#type' => 'checkbox',
'#title' => t('Show Buzz link'),
'#return_value' => 1,
'#default_value' => variable_get('service_links_show_buzz', 0),
);
$form['what_links_to_show']['service_links_buzz_publisherurn'] = array(
'#type' => 'textfield',
'#title' => t('Yahoo Buzz publisherurn (optional)'),
'#default_value' => variable_get('service_links_buzz_publisherurn', ''),
'#size' => 14,
);
and then:
if (variable_get('service_links_show_buzz', 0)) {$publisherurn = variable_get('service_links_buzz_publisherurn', '');
$links['service_links_buzz'] = theme('service_links_build_link', t('Buzz Up!'), "http://buzz.yahoo.com/buzz?publisherurn=". $publisherurn. "&targetUrl=$url&headline=$title&summary=$summary", t('Buzz up this post on Yahoo! Buzz.'), 'buzz.png', $nodelink);
}
Or is this 'overkill' ? Perhaps better addressed in the v2 release ? I'll create a patch if there's interest in this approach.
#30
Hello kiwinyc, i guess this publisherurn must be a nickname... what about if someone doesn't have it? The param must be passed empty or is better leave it?
For 1.x branch it can be added soon, in 2.x at this point i'm thinking to provide some more hook for expand the tags
Thank you! :))
#31
Here it is for the 6.x-2.x-dev version. This doesn't include publisherrun because I think we should add service-specific settings in the hook itself.... Maybe something like:
<?php
$links['buzz'] = array(
'name' => 'Buzz',
'link' => 'http://buzz.yahoo.com/submit/?submitUrl=<encoded-url>&submitHeadline=<encoded-title>&submitSummary=<summary>&publisher-run=<buzz-publisherrun>',
'description' => t('Buzz up this post on Yahoo! Buzz.'),
'icon' => 'buzz.png',
'settings' => array('general_services_buzz_settings'), // Array of hook callbacks for service settings?
'preprocess' => array('general_services_buzz_preprocess'), // Array of preprocessing hooks?
);
function general_services_buzz_settings() {
$form['general_services_buzz_publisherrun'] = array(
'#type' => 'textfield',
'#title' => t('Publisher Run'),
'#default_value' => variable_get('general_services_buzz_publisherrun', ''),
);
return $form;
}
function general_services_buzz_preprocess() {
return array(
'<buzz-publisherrun>' => variable_get('general_services_buzz_publisherrun', ''),
);
}
?>
Out of scope for this issue though. We should open a new issue for service-specific settings and then stick publisherrun in there. Thanks for noticing that, Jason!
#32
Whoops, it's targetUrl.
#33
It's already in there, but it's broken. This patch fixes it.
#34
http://drupal.org/cvs?commit=247994
#35
Automatically closed -- issue fixed for 2 weeks with no activity.