Un petit souci.... Je n'arrive pas à récupérer le nombre total de tags via feedparser pour tous les avoir d'un seul coup... Pour le moment je fait la bidouille suivante qui fait des analyses pour rien :
J'ai pris une petite valeur de nbMAXOfTags à titre de tests. Une valeur de 200 me parait être un bon choix.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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)







Répondre avec citation


Partager