Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

dfdeshom http://aida.homelinux.net/wordpress/

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

get recent tags used by any user on delicious

Still using the delicious-py module
>>>import delicious
>>> delicious.get_userposts('dfdeshom').tags[1:]
[u'gnuplot', u'math math/culture', u'python', u'music', u'creativity', u'python', u'academia/culture advice gradschool', u'academia/culture advice gradschool', u'wordpress', u'python unicode', u'advice creativity', u'delicious', u'creativity', u'code programming tags', u'delicious', u'math/culture', u'wordpress', u'linux', u'wordpress', u'python', u'python', u'python', u'python', u'computer-algebra math number-theory python', u'php', u'haiti', u'delicious', u'haiti', u'delicious', u'creativity']
>>>

Get link popularity on delicious

We are using python's delicious-py module

  
def get_popular_count(user="user"):
    import delicious
    notapi = delicious.DeliciousNOTAPI()

    #Get user's posts 
    user_posts = notapi.get_posts_by_user(user)

    data = '#tagID popularity\n' 
    
    #For each url, get how popular it is
    for i in range(len(user_posts)):
        data += str(i)+" "+str(len(notapi.get_posts_by_url(user_posts[i]["url"])))+'\n' 
    
    str1 = user + "-data" #file name
    data_file = file(str1,'w')
    data_file.write(data)
    data_file.close()


The resulting file will look like this:
$ less jemisa-data
#tagID popularity
0 6
1 744
2 928
3 120
4 1934
5 111
6 425
7 16
8 19
9 2
10 44
11 308
12 12
13 1
14 1
15 7
16 3
17 46
18 7
19 139
20 318
21 174
22 288
23 3
24 1
25 33
26 3
27 154
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS