Name: [14069] chyld
Member: 89 months
Authored: 2 videos
Description: how far down the rabbit hole would you like to go? ... + python 3 [ID:1118] (2/2)

in series: Python 3

video tutorial by chyld, added 02/09

(Showmedo is undergoing major changes. To report any problems viewing the videos please email us and include browser and OS specifics. Cheers - Kyran.)

Explaining how to integrate the delicious web services with python 3.

import xml.dom.minidom
import urllib.request
import webbrowser

def getLinksByTag(tags, count):
    delicious = []
    url = "" + tags + "?count=" + count
    response = urllib.request.urlopen(url)
    dom = xml.dom.minidom.parse(response)
    items = dom.getElementsByTagName("item")
    for item in items:
        titles = item.getElementsByTagName("title")
        title = titles[0].childNodes[0].nodeValue
        links = item.getElementsByTagName("link")
        link = links[0].childNodes[0].nodeValue
    return delicious

def start():
    tags =  input("tags (use + between tags) :: ")
    count = input("count (between 1 and 100) :: ")
    delicious = getLinksByTag(tags, count)
        index = 0
        print("\n" * 100, "-" * 80)
        for title, link in delicious:
            print("[{0:02d}] :: {1}".format(index, str(title.encode('ascii', 'ignore').decode())))
            index += 1
            choice = int(input("open (100 to quit) :: "))
        except ValueError:
            choice = -1
        if(0 <= choice < len(delicious)):
        if(choice == 100):

Got any questions?

Get answers in the ShowMeDo Learners Google Group.

Video statistics:

  • Video's rank shown in the most popular listing
  • Video plays: 1 (since July 30th)
  • Plays in last week: 0
  • Published: 90 months ago

Thank-yous, questions and comments

If this video tutorial was helpful please take some time to say thank-you to the authors for their hard work. Feel free to ask questions. Let the author know why their video tutorial was useful - what are you learning about? Did the video tutorial save you time? Would you like to see more?

You may also want to see our ShowMeDo Google Group to speak to our active users and authors.

Your email address will not be published.

Show some quick comments >>

All comments excluding tick-boxed quick-comments

9. anonymous Mon, 13 Apr 2009 16:14

Thanks for the video, it is very well explained. I'm using Python to parse an xml document from the Google Books service and you're explanations were very helpful. Python is my first programming language, and I've only been at it a little while.

Few comments:

Since an empty list evaluates to false, len isn't needed, you can do:


There's no need for counters as well, as enumerate yeilds the results. Here's how I would've written start:

def start():

tags = input("tags (use + between tags) :: ")

count = input("count (between 1 and 100) :: ")

delicious = getLinksByTag(tags, count)

choice = -1

while delicious and choice != 100:

print("\n" * 100, "-" * 80)

for index, (title, link) in enumerate(delicious):

print("[{0:02d}] :: {1}".format(index, str(title.encode('ascii', 'ignore').decode())))


choice = int(input("open (100 to quit) :: "))[choice][1], 2)

except (ValueError, IndexError) as e:


You could also store the displayed options, preventing the need to loop the list for each iterations display.

7. anonymous Mon, 16 Mar 2009 11:35

good stuff. well layed out. short example to give see how easy it is too mix and match stuff from the internet.

6. anonymous Mon, 16 Mar 2009 09:40


5. anonymous Mon, 16 Mar 2009 09:40


Good tutorial. Aside from some minor imprecisions, very good educational material. Keep them comming.

Yes, I think it's because of python's power that allowed me to write something useful with minimal amounts of code.

Brilliant demonstration of Python's power and versatility! I've got almost 5000 delicious tags so this gives me a start on some serious datamining. I think many people will be blown away by the size of that delicious module, given what it achieves. It's great to see someone demonstrating one of their own projects, and such a cool one at that. Thanks.

The ShowMeDo Robot says - this video is now published, thanks for adding to ShowMeDo.

Showmedo is a peer-produced video-tutorials and screencasts site for free and open-source software (FOSS)- with the exception of some club videos, the large majority are free to watch and download.

how to help » about » faq »

Educating the Open-source Community With Showmedo

Although as important as the software it supports, education and documentation are relatively neglected in the Open-source world. Coders love to code, and explaining how best to use or improve the software tends to be deferred or even sidelined.

At Showmedo we believe the community can play a vital role here and also say thanks for the tools and software that make our lives easier. If you have a piece of software you love or a programming langugage you are enthusiastic about, why not make a screencast showing others how to use it? All the stuff you wish you'd been told, the tips, tricks, insights that would have saved you time and frustration.

Screencasting is easier than you think, and we're happy to help you. You can emailus for advice or just use some of the how-to screencasts on the site. This screencasting learning-pathis a good place to start.

By the Same Author



Showmedo's development is fairly rapid and bugs will inevitably creep in. If you have any problems please drop us a line using the contact address below. Likewise, any suggestions for improvements to the site are gratefully received.