Changeset 366 for artig/artig.py
- Timestamp:
- 02/28/10 01:39:26 (6 months ago)
- File:
-
- 1 edited
-
artig/artig.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
artig/artig.py
r347 r366 1 1 #!/usr/bin/env python 2 #import os3 2 import sys 4 #import fakeua5 #UserAgent = fakeua.UserAgent()6 #UserAgent.new()7 3 4 ## import base plugin class 8 5 from plugins import base 6 ## import all plugins from ./plugins .. see ./plugins/__init__.py for a wierd hack. 9 7 from plugins import * 10 11 #class Config:12 # import string13 # import ConfigParser14 #15 # def __init__(self):16 # self.load()17 #18 # def load(self):19 # self.config = self.ConfigParser.ConfigParser()20 # self.config.read('handlers.conf')21 #22 # def handler(self,handler):23 # return self.string.Template(self.config.get('handlers',handler))24 #25 # def sites(self,site):26 # return self.string.Template(self.config.get('sites',site))27 #28 #class Download(Config):29 # import os30 # import string31 #32 # def get(self, handler, url, file='dump'):33 # self.os.system(self.handler(handler).substitute(ua = UserAgent.ua(), f=file, u=url))34 #35 #class Web:36 # import urllib237 #38 # def getpage(url):39 # request = self.urllib2.Request(url)40 # request.add_header('user-agent',UserAgent.ua())41 #42 # file = self.urllib2.build_opener()43 #44 # content = file.open(request)45 #46 # return content47 8 48 9 class Fetcher(): … … 58 19 yay = plugin() 59 20 yay.fetch(url) 60 21 22 def help(self): 23 for plugin in base.Plugin.__subclasses__(): 24 print '%s:\n%s\n' % (plugin.domain, plugin.help) 61 25 62 26 if __name__ == "__main__": 63 27 test = Fetcher() 64 test.fetch(sys.argv[1]) 28 if sys.argv[1] in ['-h','-?']: 29 test.help() 30 else: 31 test.fetch(sys.argv[1]) 65 32
Note: See TracChangeset
for help on using the changeset viewer.

