2 # This file is part of gpodder.net.
4 # my.gpodder.org is free software: you can redistribute it and/or modify it
5 # under the terms of the GNU Affero General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or (at your
7 # option) any later version.
9 # my.gpodder.org is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
12 # License for more details.
14 # You should have received a copy of the GNU Affero General Public License
15 # along with my.gpodder.org. If not, see <http://www.gnu.org/licenses/>.
21 import urllib
.request
, urllib
.parse
, urllib
.error
27 queries the public API of delicious.com and retrieves a dictionary of all
28 tags that have been used for the url, with the number of users that have
32 split
= urllib
.parse
.urlsplit(url
)
34 split
= urllib
.parse
.SplitResult(split
.scheme
, split
.netloc
, '/', split
.query
, split
.fragment
)
38 m
.update(url
.encode('ascii'))
40 url_md5
= m
.hexdigest()
41 req
= 'http://feeds.delicious.com/v2/json/urlinfo/%s' % url_md5
43 resp
= urllib
.request
.urlopen(req
).read()
45 resp_obj
= json
.loads(resp
)
51 if (not 'top_tags' in o
) or (not o
['top_tags']):
53 for tag
, count
in o
['top_tags'].items():