source: artig/plugins/archive.py @ 349

Revision 349, 871 bytes checked in by shiml, 7 months ago (diff)

added plugin for archive.org. also cleaned a bit up.

Line 
1import base
2
3class PluginArchive(base.Plugin):
4    import re
5
6    domain = 'www.archive.org'
7
8    def __init__(self):
9        pass
10
11    def fetch(self,url):
12        web = base.Web()
13        page = web.getpage(url)
14
15        if page.find('Play / Download') != -1:
16            print "This set is also avaiable as a zipped download!"
17            exit()
18
19        plurl = self.re.findall('<a href="(http://www\.archive\.org/download/.*\.m3u)">VBR M3U</a>',page)[0]
20        settitle = self.re.findall('<title>Internet Archive: Free Download: (.*)</title>',page)[0]
21        titles = self.re.findall('IAD\.names = \["(.*)"\];',page)[0].split('","')
22       
23        playlist = web.getpage(plurl).splitlines()
24
25        catlist = []
26        dl = base.Download()
27        for nr in range(len(playlist)):
28            dl.get('wget', playlist[nr],'%s - %s.mp3' % (settitle, titles[nr]))
Note: See TracBrowser for help on using the repository browser.