用于apache/nginx样式html目录列表的python解析器。
htmllistparse的Python项目详细描述
apache/nginx风格html目录列表的python解析器
importhtmllistparsecwd,listing=htmllistparse.fetch_listing(some_url,timeout=30)# or you can get the url and make a BeautifulSoup yourself, then use# cwd, listing = htmllistparse.parse(soup)
其中cwd是当前目录,listing是FileEntry命名元组的列表:
- name:文件名,str。如果它是一个目录,就有一个trailing/if。
- modified:上次修改时间,time.struct_time或None。时区未知。
- size:文件大小,int或None。可以从前缀估计,例如“k”、“m”。
- description:文件描述、文件类型或找到的任何其他内容。str作为HTML,或None。
支持:
- 香草阿帕奇/nginx/lighttpd/darkhttpd自动索引
- 大多数<pre>-样式索引
- 许多其他<table>样式的索引
- <ul>-样式
注意
请将函数包装在一般的try... except块中。它可能意外地抛出异常。
重新设置pfs
重新发明了http文件系统。
- 使用fuse装载大多数http文件列表。
- 以较少的开销获取目录树和文件统计信息。
- 支持范围请求。
- 支持保持活力。
usage: rehttpfs.py [-h] [-o OPTIONS] [-t TIMEOUT] [-u USER_AGENT] [-v] [-d] url mountpoint Mount HTML directory listings. positional arguments: url URL to mount mountpoint filesystem mount point optional arguments: -h, --help show this help message and exit -o OPTIONS comma separated FUSE options -t TIMEOUT, --timeout TIMEOUT HTTP request timeout -u USER_AGENT, --user-agent USER_AGENT HTTP User-Agent -v, --verbose enable debug logging -d, --daemon run in background