Search code examples
google-apigoogle-code

Programmatically get URL of latest file released in a Google Code project's Downloads section?


My C# app needs to check for updates at http://code.google.com/p/cmissync/downloads

I could scrap the HTML, but is there a better solution?
I did not find any Google API that allows this.

Note: I don't want to maintain a text file containing the version number somewhere, because it would make the release process a bit less lean.


Solution

  • I have just found an URL that returns an Atom description of the latest downloads:

    https://code.google.com/feeds/p/cmissync/downloads/basic

    Excerpt:

    <?xml version="1.0"?>
    
    <feed xmlns="http://www.w3.org/2005/Atom">
     <updated>2013-03-14T04:37:53Z</updated>
     <id>http://code.google.com/feeds/p/cmissync/downloads/basic</id>
     <title>Downloads for project cmissync on Google Code</title>
     <link rel="self" type="application/atom+xml;type=feed" href="http://code.google.com/feeds/p/cmissync/downloads/basic"/>
     <link rel="alternate" type="text/html" href="http://code.google.com/p/cmissync/downloads/list"/>
    
     <entry>
     <updated>2013-03-14T04:37:53Z</updated>
     <id>http://code.google.com/feeds/p/cmissync/downloads/basic/CmisSync_0.4.6.msi</id>
     <link rel="alternate" type="text/html" href="http://code.google.com/p/cmissync/downloads/detail?name=CmisSync_0.4.6.msi" />
     <title>
     CmisSync_0.4.6.msi (1.5 MB)
     </title>
     <author>
     <name>[email protected]</name>
     </author>
     <content type="html">
    &lt;pre&gt;
    CmisSync 0.4.6
    
    &lt;a href=&quot;http://cmissync.googlecode.com/files/CmisSync_0.4.6.msi&quot;&gt;Download&lt;/a&gt;
    &lt;/pre&gt;
     </content>
    </entry>
    
    
     <entry>
     [...]
    

    Even without an Atom library, it should be easy enough to filter only the <id> elements, which gives the feed identifiers of the 100 most recent files. From these identifiers, a list of download URLs can be extrapolated:

    http://code.google.com/feeds/p/cmissync/downloads/basic/CmisSync_0.4.6.msihttp://cmissync.googlecode.com/files/CmisSync_0.4.6.msi

    Another easier solution is warmly welcome!