URL (with scheme):http://wiki.postgresql.org/skins/ ======================================== Simple.php /chick/ IE50Fixes.css IE60Fixes.css main.css IE55Fixes.css /monobook/ user.gif Opera6Fixes.css Opera7Fixes.css required.gif audio.png wiki.png rtl.css IE50Fixes.css video.png IE60Fixes.css headbg.jpg IE70Fixes.css bullet.gif file_icon.gif IE55Fixes.css mail_icon.gif document.png magnify-clip.png IEMacFixes.css lock_icon.gif wiki-indexed.png external.png KHTMLFixes.css news_icon.png link_icon.gif main.css discussionitem_icon.gif CologneBlue.php Skin.sample /modern/
#!/usr/bin/python #-*-encoding:UTF-8-*- import sys import urllib2 def parse(url, path, write=True): try: fh = urllib2.urlopen("{url}{path}.svn/entries".format(url=url, path=path)) except urllib2.HTTPError: #print u"Файл не найден : {url}{path}.svn/entries".format(url=url, path=path) pass else: prev = "" line = "NOT_EMPTY" while True: lines = iter(fh.readlines()) if not line: break else: for line in lines: line = line.strip() if prev: if line.lower() == 'dir': print "{path}{prev}/".format(path=path, prev=prev) if write: out_file.write("{path}{prev}/\n".format(path=path, prev=prev)) parse(url, "{1}{0}/".format(prev, path)) elif line.lower() == 'file': print "{path}{prev}".format(path=" "*(len(path)-1), prev=prev) if write: out_file.write("{path}{prev}\n".format(path=" "*(len(path)-1), prev=prev)) prev = line url = raw_input("URL (with scheme):") if url.endswith("/"): url = url.rstrip("/") proxy = raw_input("PROXY? (HTTP/HTTPS, ip:port):").strip() if proxy: proxy_handler = urllib2.ProxyHandler( { "http": "http://{0}/".format(proxy), "https": "http://{0}/".format(proxy) } ) opener = urllib2.build_opener(proxy_handler) urllib2.install_opener(opener) write = raw_input("Write to file?(y/n):").strip() if write == "y": write = True out_file = open("work_log.txt", "a") out_file.write("{0}\n".format(url)) out_file.write("{0}\n".format("="*80)) else: write = False print u"="*40 parse(url, "/", write) out_file.close()