All keywords

pthpth working on itPosts: 49Registered Users Big grins
I think I know the answer to this question, but I want to be wrong :-)

Is there an API method to collect all keywords (better yet with their usage count)? There is a tag cloud on the homepage, so this data is available, but shy of collecting all albums and their photos, I do not see how I could gather this information with the API.

Thanks
pth

Comments

  • lildudelildude Big grins Posts: 70Registered Users Big grins
    edited June 11, 2008
    pth wrote:
    I think I know the answer to this question, but I want to be wrong :-)

    Is there an API method to collect all keywords (better yet with their usage count)? There is a tag cloud on the homepage, so this data is available, but shy of collecting all albums and their photos, I do not see how I could gather this information with the API.

    Thanks
    pth

    Unfortunately not. You'd have to create your own function that effectively trawled through all the images/albums and grab the keywords. This would be very painful and time consuming so I wouldn't recommend it.
    Colin Seymour
    Personal Blog | Tech Blog | phpSmug
  • bziclixbziclix Big grins Posts: 20Registered Users Big grins
    edited June 12, 2008
    pysmug implementation of tagcloud()
    lildude wrote:
    Unfortunately not. You'd have to create your own function that effectively trawled through all the images/albums and grab the keywords. This would be very painful and time consuming so I wouldn't recommend it.

    I decided to write such a function for pysmug and it turned out to be both easy and fast if you use batchables. I can build a dictionary of {keyword:count} for over 80 galleries and 3200+ photos in less than 30 seconds -- depends on your definition of fast of course. The function takes an optional keyword parsing function since keywords appear to be variable in format.

    I added this for the 0.5 release of pysmug, but it will work perfectly well with version 0.4 (code here, look for "tagcloud").

    Use it like this:
    >>> import pysmug
    >>> m = pysmug.login(klass=pysmug.SmugTool)
    >>> print m.tagcloud()
    
    thanks, brian

    --
    Brian Zimmer / bzimmer.ziclix.com
    Brian Zimmer / bzimmer.ziclix.com
  • bziclixbziclix Big grins Posts: 20Registered Users Big grins
    edited June 12, 2008
    I added a slightly longer write-up here detailing the performance of pysmug for generating the tag cloud.

    thanks, brian
    Brian Zimmer / bzimmer.ziclix.com
  • darryldarryl Major grins Posts: 1,000Registered Users Major grins
    edited June 20, 2008
    Wouldn't it be faster to just scrape your Keywords page?

    http://yoursite.smugmug.com/keyword/

    --Darryl
  • bziclixbziclix Big grins Posts: 20Registered Users Big grins
    edited June 20, 2008
    darryl wrote:
    Wouldn't it be faster to just scrape your Keywords page?

    http://yoursite.smugmug.com/keyword/

    --Darryl

    Why scrape when you can get reliable structured content from the API?
    Brian Zimmer / bzimmer.ziclix.com
Sign In or Register to comment.