1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| #!/usr/bin/env python
#coding=utf-8
# WARNING ! This script does not work with Python 3.
# Hint done in the following page :
import feedparser
from pprint import PrettyPrinter
myLogin = 'projetmbc'
nbMAXOfTags = 5
nbOfTagsFound = nbMAXOfTags
while nbOfTagsFound == nbMAXOfTags:
myDeliciousTag = {}
nbMAXOfTags *= 2
rssLink = 'http://feeds.delicious.com/v2/rss/' + myLogin + '?count=' + str(nbMAXOfTags)
feed = feedparser.parse(rssLink)
for entrie in feed.entries:
name = entrie["title"].encode('utf-8')
adress = entrie["link"]
myDeliciousTag[name] = adress
nbOfTagsFound = len(myDeliciousTag)
print str(len(myDeliciousTag)) + 'tags'
print
PrettyPrinter(indent = 2).pprint(myDeliciousTag) |