Friday, September 17, 2004

Yet Another DailyDelicious hack for WordPress

I wanted a nice simple way to mirror my daily bookmarks that I've added to [del.icio.us](http://del.icio.us) into [WordPress](http://www.wordpress.org)

Stephen Eyre's [dailydelicious](http://www.dot-totally.co.uk/dailydelicious.txt) was close, but
not exactly they way I wanted it. He used the RSS feed, but that doesn't give a good daily cutoff.

So, I present Yet Another Daily Delicious php script: [yadd.php](http://www.nozell.com/marc/blog/data/yadd-1.0.TXT).

It asks for just today's bookmarks using the published api, parses the XML, generates nicely formatted HTML and creates a WordPress entry.

Here is the writeup from the code:
- - -


This is yadd.php V1.0 by Marc Nozell (marc@nozell.com) based on
Stephen Eyre's dailydelicious
(http://www.dot-totally.co.uk/dailydelicious.txt)

See http://www.nozell.com/blog/ for the latest version of
'yet another daily delicious' (yadd.php)

USAGE:

1) Edit the section below. At the very least use your del.icio.us
username and password ($del_user/$del_password)

2) Put there file somewhere on the server where you run WordPress.

3) Arrange for this page to be hit once a day, say 11:30ish your
local time. del.icio.us seems to track UTC so depending on which
timezone you live in, some bookmarks from your yesterday may show
up. Consider using a simple cronjob that looks like this:

30 23 * * * $HOME/bin/yadd.sh

where yadd.sh looks like this:

#!/bin/bash
curl http://www.yoursite.com/yadd.php

4) In the morning edit the entry if you wish. I've tried to generate
pretty HTML so it will be simple to edit the entry.

THINGS TO KEEP IN MIND

Anyone that hits the URL for this script will cause your current
bookmarks to be dumped into WordPress. Clearly this is not
desirable.

You have some options. The easiest is to keep this URL 'secret'.
Name it something unusual and put it in a non-obvious place.
Remember that if you display your web hit stats, the url will be
exposed. A better solution to use .htaccess to limit access. If
you do that remember to update the url wget uses to include the
username/password, something like this:
curl http://someuser:somepassword@www.yoursite.com/yadd.php

Enjoy,

-marc

59 comments:

  1. Could this be modified to make the posts on a weekly basis rather than daily?

    ReplyDelete
  2. that is a great script. got it up and running fine. i want my daily bookmarks to display underneath any posts i make for a specific day, so if i set my cron to hit at, say, 12.01 am, can i make the yadd.php file fetch my links from the previous day? any help appreciated.

    ReplyDelete
  3. [...] he other solutions don’t rely on. Luckily, I stumbled across Marc Nozell’s DailyDelicious Hack that relies on [...]

    ReplyDelete
  4. [...] (plugin, posts all links once per day…could you set the script to run more often?) YADD (does the same thing, goes thru api inste [...]

    ReplyDelete
  5. Phrsnant , I think it can be modified that way ... but... I would also like to know HOW

    ReplyDelete
  6. Yet Another DailyDelicious Patch
    I recently setup up Yet Another DailyDelicious hack (yadd) on stratified. Among all of the daily del.icio.us grabbers, it seemed the easiest to configure and use, and indeed it is. The only problem is that for those of us (all eyes on Zach) who don'...

    ReplyDelete
  7. Yet Another DailyDelicious Patch
    I recently setup Yet Another DailyDelicious hack (yadd) on stratified. Among all of the daily del.icio.us grabbers, it seemed the easiest to configure and use, and indeed it is. The only problem is that for those of us (all eyes on Zach) who don't b...

    ReplyDelete
  8. Extremely useful little script.

    I wrote a patch that prevents yadd.php from posting if there are no links for that day. It is available here.

    ReplyDelete
  9. Nice plugin, if you get a chance to develop it, I would really like to see the following:
    Make no post at all in the case that there are no daily links - at the moment the plugin makes an empty entry that must be deleted.
    If there are a large number of posts (e.g, over a fixed threshold), could the plugin use the more tag, so that we dont get an excessivly long posting on the home page.

    ReplyDelete
  10. Enhanced Daily Del.icio.us plugin
    Working with PHP can be a bowel-churning experience; It is one of the most rubbish computer languages ever devised, because it encourages virtually every bad habit a developer could adopt. Its only saving grace is almost ubiquitous integration with Apa...

    ReplyDelete
  11. Daily Delicious and POP3Gateway

    I have created a module to grab the last week's del.icio.us and automatically post them as a blog entry. The idea, and much of the code came from Marc Nozell's WordPress plugin. I cleaned up the code for Xaraya to handle it just a bit better, and...

    ReplyDelete
  12. [...] s heb je enorme bezwaren stel me dan op de hoogte Het update script is voor de liefhebber hier te vinden.




    Comments
    »

    [...]

    ReplyDelete
  13. [...] Plugins Database (nice xhtml/javascript interface) (tags: wordpress plugins plugin) Marc Nozell’s mini-blog » Blog Archive » Yet Another Da [...]

    ReplyDelete
  14. [...] that this made for an ideal “remaindered links” wordflow. This script, called Yet Another Daily Delicious (YADD), is quite robust in [...]

    ReplyDelete
  15. [...] daily bookmarks that I've added to del.icio.us into WordPress" // posted by t.a.l. @ 11:53 PM    Comments: Post a Comment <<Home [...]

    ReplyDelete
  16. it seem like the script is broken due to delicious api issue ?

    ReplyDelete
  17. I get the following errors:

    Warning: fopen(): URL file-access is disabled in the server configuration in /home/.jargon/lazopolis/yet.anotherblog.net/yadd.php on line 106

    Warning: fopen(http://...@del.icio.us/api/posts/get?dt=2005-08-29): failed to open stream: no suitable wrapper could be found in /home/.jargon/lazopolis/yet.anotherblog.net/yadd.php on line 106

    Warning: fread(): supplied argument is not a valid stream resource in /home/.jargon/lazopolis/yet.anotherblog.net/yadd.php on line 113

    Any idea on what's wrong?

    ReplyDelete
  18. lazopolis,

    It looks like from the writeup in the manual page for fopen (http://us2.php.net/fopen) that is could be a configuration issue.

    -marc

    ReplyDelete
  19. [...] Along the way, I stumbled over a link to Yet Another DailyDelicious hack for WordPress at Marc Nozell’s blog. It’s been a long time since I talked with Marc, back when he was active at RootsWeb. It was extremely nice to run across him again. [...]

    ReplyDelete
  20. [...] Aquest script s’encarrega de copiar al wordpress totes les entrades que s’hagi fet durant el dia a del.icio.us! L’he modificat de manera que ho faci com a mi m’interessa (en català, eliminant informació no necessària i adaptant-lo al servidor) i ja està rulant! [...]

    ReplyDelete
  21. I just modified the script to use the CURL libraries instead of fopen and fread. It seems to work fine. My host (Dreamhost) doesn't allow the fopen() libraries any longer. This is what I came up with after a couple of hours hacking at it.

    I'll probably take another look at it tonight and see if I can make it skip days it detects no entries. I believe this can be done by pulling a die() if the XML string does not contain a </posts> in it.

    For example, I created my del.icio.us account today. If I look at yesterday's date for the string, I get the following returned:

    <posts dt="20051017" tag="" user="chiieddy"/>

    Nothing else.

    BTW, for those who are asking about changing the date, for yesterday just change this line:

    $date = mktime(0,0,0,$today['mon'], $today['mday'], $today['year']);

    New line should read:

    $date = mktime(0,0,0,$today['mon'], $today['mday']-1, $today['year']);


    For those wanting a whole week, you'd have to create a recursive function to do so, the del.icio.us API only recognizes a single date at time. You'd have to set your cronjob to run weekly and then cycle through all the days of the week.

    ReplyDelete
  22. Marc -

    Does the line:

    $del_showlink = true;

    (whether or not to show the link to your del.icio.us account) actually work? I can't find any subsequent code in the php file using this variable.

    ReplyDelete
  23. [...] Here is my small contribution to the wonderful world of Wordpress : WP-cron YADD is an integration of YADD into WP-cron architecture. By this mean, no more hassle writing shell scripts and using system cron table. Instead … well, instead, nothing to do ! To install, put it in your plugins directory, provided YADD and WP-cron are installed, it will simply work. [...]

    ReplyDelete
  24. [...] (YADD) hack for WordPress and a Cron job every night. Don’t get me started… Listen to this article| [...]

    ReplyDelete
  25. I get the following error message:

    Fatal error: Call to undefined function: current_time() in /var/www/mikkelwinther.dk/public_html/dagenslinks/yadd.php on line 91

    Any idea what's wrong?

    ReplyDelete
  26. I'm using Elana's modified version, by the way. But I get the same error message using the original version, only with a different line number for obvious reasons.

    ReplyDelete
  27. Never mind, I got it working. It seems I had a typo in the location of my Wordpress location.

    Thanks for a great hack!

    ReplyDelete
  28. [...] FeedBurner already gives some of these services. You can easily “mix” your blog news, with your Flickr photostream and your del.icio.us bookmarks. You can even mix them in different ways, say gather all your weekly del.icio.us bookmarks in one single post in the new feed generated. Or you could create your own “video channel” of videos indexed by Yahoo! and tagged with a certain keyword, like “funny”, or “football”. Or automatically post your del.icio.us bookmarks as a single post in your blog on a daily basis using yadd. Or combine a GeoRSS blog feed with geo-tagged Flickr images. Or upcoming.org events with rsswether.com… [...]

    ReplyDelete
  29. [...] Nozell, rhymes with Oh Hell » Blog Archive » Yet Another DailyDelicious hack for WordPress (tags: webtips) [...]

    ReplyDelete
  30. [...] Nozell, rhymes with Oh Hell » Blog Archive » Yet Another DailyDelicious hack for WordPress (tags: wordpress del.icio.us delicious plugin php plugins blog) [...]

    ReplyDelete
  31. [...] Yet Another DailyDelicious hack for WordPress This is another way to get daily del.icio.us links into Wordpress. It asks for just today’s bookmarks using the published api, parses the XML, generates nicely formatted HTML and creates a WordPress entry. (tags: wordpress del.icio.us plugins hacks) [...]

    ReplyDelete
  32. [...] Here’s how I do it Sorry to disappoint you Steve, it’s 50% automatic and 50% human labor. If you’re wondering why my link posts look different, it’s because I’m using a more complex way of doing this instead of the Daily Del.icio.us posts technique I mentioned last month. My method isn’t for the faint-hearted as it involves the Yet Another Daily Delicious (YADD) hack (secured) for WordPress and a unix cron job every night. I didn’t explain beyond this previously, but this is the link posting workflow: [...]

    ReplyDelete
  33. Thanks.
    WFM (Works For Me) WordPress on a remote server

    ReplyDelete
  34. [...] Yet Another DailyDelicious hack for WordPress a nice simple way to mirror my daily bookmarks that I’ve added to del.icio.us into WordPress (tags: wordpress 2Do plugin del.icio.us) [...]

    ReplyDelete
  35. [...] Nozell, rhymes with Oh Hell » Blog Archive » Yet Another DailyDelicious hack for WordPress I’m toying around with pulling in a “daily del.icio.us” feature into my blogging. We’ll see where that goes. (tags: del.icio.us) [...]

    ReplyDelete
  36. [...] As with previous Wordpress upgrades this one was also painless.  My ‘Yet Another Daily Delicious‘ and ‘Yet Another Weekly Delicious‘ continue to work also. I’ve not yet restored the style sheet header (this one) or added back some of the other doodads. [...]

    ReplyDelete
  37. [...] Yet Another DailyDelicious hack for WordPress (tags: blog wordpress tools) [...]

    ReplyDelete
  38. [...] Nozell, rhymes with Oh Hell » Blog Archive » Yet Another DailyDelicious hack for WordPress – Tagged as: del.icio.us delicious [...]

    ReplyDelete
  39. I'm having trouble setting up a chronjob to do this... I've googled for instructions on chronjobs, but I'm having trouble finding anything relevant. Am I understanding this right:

    Put the script in the same directory as WP on my server
    Also create a file called yadd.sh and put it there as well
    Set a chron job to yadd.sh

    I tried this and it didn't seem to do anything.

    Any help would be appreciated.

    If it helps, my host is 1and1.com

    ReplyDelete
  40. Chronjob help?...

    Another plea for help from my readership:
    I’m trying to use this WordPress hack to import my del.icio.us bookmarks in WP: YADD.
    I’m having trouble figuring out how to setup the chronjob right. If anyone could help me out, or at least point...

    ReplyDelete
  41. Try searching for 'cron' (not 'chron') or 'crontab'. Wikipedia's Crontab page does a good
    job of describing it. Also check your man pages (eg: man -k cron)

    ReplyDelete
  42. OK thanks... just to make sure, I am supposed to create a text file called yadd.sh on my server, correct? All told, I should have yadd.php, yadd.sh, and a crontab file?

    ReplyDelete
  43. [...] Yet Another DailyDelicious hack for WordPress A complex hack for Delicious to create a daily post for WordPress (tags: blogging hack) [...]

    ReplyDelete
  44. [...] Cannot Access Web Address – Tagged as: restricted unfiled Nozell, rhymes with Oh Hell » Yet Another DailyDelicious hack for WordPress – Tagged as: del.icio.us plugin wordpress The Several Habits of Wildly Successful del.icio.us Users » Slacker Manager – Tagged as: del.icio.us howto tips Spinning the Election – Tagged as: spintactics EasyBib: Free Automatic Bibliography Composer - MLA and APA formatting – Tagged as: tools writing Google Calendar – Tagged as: google del.icio.us tag cloud v1.0 » nickbouton.com – Tagged as: del.icio.us plugin wordpress WordPress › Error – Tagged as: dugg Wired News: The Man Behind Scrambled Hackz – Tagged as: music [...]

    ReplyDelete
  45. [...] این طوری فقط لازم است من زنده باشم و هر روز در اینترنت چرخ بخورم و علامت بزنم! بعد ساعت بیست و سه و پنجاه و نه دقیقه یکی می‌آید اینجا و تولید محتوی می‌کند! قابل توجه کسانی که به کفگیرشان به ته دیگ خورده.  [...]

    ReplyDelete
  46. Please take a look at http://blog.del.icio.us/blog/2006/05/feel_secure.html in del.icio.us blog.

    ReplyDelete
  47. Great post and I've introduced into my teamblog.

    ReplyDelete
  48. [...] You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your ownsite. [...]

    ReplyDelete
  49. [...] Yet Another DailyDelicious hack for WordPress (tags: wordpress Tools plugin del.icio.us blogging) [...]

    ReplyDelete
  50. [...] Nozell, rhymes with Oh Hell » Yet Another DailyDelicious hack for WordPress (tags: delicious wordpress blogging) [...]

    ReplyDelete
  51. [...] Nozell, rhymes with Oh Hell » Yet Another DailyDelicious hack for WordPress (tags: delicious wordpress blogging) [...]

    ReplyDelete
  52. [...] Nozell, rhymes with Oh Hell » Yet Another DailyDelicious hack for WordPress Not tried yet (tags: blog Del.icio.us hacks php tech wordpress) [...]

    ReplyDelete
  53. [...] DailyDelicious hack Yet Another DailyDelicious hack for WordPress [...]

    ReplyDelete
  54. [...] Nozell, rhymes with Oh Hell » Blog Archive » Yet Another DailyDelicious hack for WordPress (tags: wordpress plugin del.icio.us blogging) Posted in del.icio.us | [...]

    ReplyDelete
  55. [...] Nozell, rhymes with Oh Hell » Blog Archive » Yet Another DailyDelicious hack for WordPress (tags: wordpress del.icio.us plugin) [...]

    ReplyDelete
  56. [...] Nozell, rhymes with Oh Hell » Blog Archive » Yet Another DailyDelicious hack for WordPress (tags: Wordpress Delicious) [...]

    ReplyDelete
  57. [...] Yet Another DailyDelicious hack for WordPress « Nozell, rhymes with Oh Hell (tags: wordpress blogging delicious plugin del.icio.us) [...]

    ReplyDelete
  58. [...] Yet Another DailyDelicious hack for WordPress « Nozell, rhymes with Oh Hell 979 none [...]

    ReplyDelete