Package: mozilla-devscripts
Version: 0.35
Severity: wishlist

I'd like mozilla-devscripts to include a tool that will download "Version History"[0] page of an add-on, and then generate upstream changelog from it. I've attached prototype that I used to generate upstream changelog for openinbrowser.


[0] https://addons.mozilla.org/firefox/addon/${addon}/versions/

--
Jakub Wilk
#!/usr/bin/python3

import argparse
import urllib.request
import xml.etree.cElementTree as etree

def main():
    ap = argparse.ArgumentParser()
    ap.add_argument('extension')
    options = ap.parse_args()
    url = 
'https://addons.mozilla.org/en-US/firefox/addon/{ext}/versions/format:rss'.format(ext=options.extension)
    with urllib.request.urlopen(url) as file:
        for event, element in etree.iterparse(file):
            if element.tag != 'item':
                continue
            title = element.find('title').text
            print(title)
            print('=' * len(title))
            descr = element.find('description').text
            print(descr)
            print()

if __name__ == '__main__':
    main()

# vim:ts=4 sw=4 et

Reply via email to