Contrally retrieve metadata from archive.org items.
iamine的Python项目详细描述
Internet存档数据挖掘工具。
什么是我的?
ia mine是用于数据挖掘的命令行工具和python 3库 互联网档案。
如何开始?
命令行界面
ia mine命令行工具应该可以在任何类似unix的操作系统上运行 安装了Python3的系统。开始使用ia-mine, 只需从下载最新的二进制文件 https://archive.org/details/iamine-pex。
# Download ia-mine and make it executable.
$ curl -LO https://archive.org/download/iamine-pex/ia-mine
$ chmod +x ia-mine
$ ./ia-mine --help
...
用法:
$ ia-mine --help Concurrently retrieve metadata from Archive.org items. usage: ia-mine (<itemlist> | -) [--debug] [--workers WORKERS] [--cache] [--retries RETRIES] [--secure] [--hosts HOSTS] ia-mine [--all | --search QUERY] [[--info | --info --field FIELD...] |--num-found | --mine-ids | --field FIELD... | --itemlist] [--debug] [--rows ROWS] [--workers WORKERS] [--cache] [--retries RETRIES] [--secure] [--hosts HOSTS] ia-mine [-h | --version | --configure] positional arguments: itemlist A file containing Archive.org identifiers, one per line, for which to retrieve metadata from. If no itemlist is provided, identifiers will be read from stdin. optional arguments: -h, --help Show this help message and exit. -v, --version Show program's version number and exit. --configure Configure ia-mine to use your Archive.org credentials. -d, --debug Turn on verbose logging [default: False] -a, --all Mine all indexed items. -s, --search QUERY Mine search results. For help formatting your query, see: https://archive.org/advancedsearch.php -m, --mine-ids Mine items returned from search results. [default: False] -i, --info Print search result response header to stdout and exit. -f, --field FIELD Fields to include in search results. -i, --itemlist Print identifiers only to stdout. [default: False] -n, --num-found Print the number of items found for the given search query. --rows ROWS The number of rows to return for each request made to the Archive.org Advancedsearch API. On slower networks, it may be useful to use a lower value, and on faster networks, a higher value. [default: 50] -w, --workers WORKERS The maximum number of tasks to run at once. [default: 100] -c, --cache Cache item metadata on Archive.org. Items are not cached are not cached by default. -r, --retries RETRIES The maximum number of retries for each item. [default: 10] --secure Use HTTPS. HTTP is used by default. -H, --hosts HOSTS A file containing a list of hosts to shuffle through.
python库
ia mine python库可以与pip一起安装:
# Create a Python 3 virtualenv, and install iamine. $ virtualenv --python=python3 venv $ . venv/bin/activate $ pip install iamine
这也将把ia-minecomand行工具安装到您的virtualenv:
$ which ia-mine /home/user/venv/bin/ia-mine
利用ia mine和jq进行数据挖掘
ia-mine只需同时检索元数据和搜索结果 并将返回的json转储到stdout和任何错误 发送给stderr的消息。挖掘转储到stdout的json可以使用 例如,像jq这样的工具。JQ 二进制文件可以在http://stedolan.github.io/jq/download/下载。
ia-mine可以挖掘archive.org搜索结果,从 搜索结果,或通过项目列表或stdin提供的项目。
开发人员
请报告github上的任何错误或问题: https://github.com/jjjake/iamine
发布历史
0.3.5(2016-05-24)
错误修复
- IA Mine的所有输出都应该是JSONL。 元数据api的一些响应包含未转换的换行符。 当使用jq逐行解析json时,这会导致很多问题。 为了解决这个问题,从服务器返回的json响应现在被解析并在打印到stdout之前转储回json。
0.3.5(2016-05-24)
功能和改进
- 修正了Exception ignored in:错误。
- 添加了对自定义配置文件的支持。
0.3.3(2015-08-04)
错误修复
- 将history.rst添加到manifest.in以修复pip install iamine。
0.3.2(2015-08-03)
错误修复
- asyncio.JoinableQueue在python 3.4.4中被弃用。 iamine.core.Miner现在对python 3.4.4和 较新版本和较旧版本的asyncio.JoinableQueue。 (asyncio.Queue不能用于所有版本,因为 asyncio.Queue.join()仅在版本3.4.4中添加。
- SearchMiner.get_search_info()不再是协同程序(现在使用 urllib)。修复了iamine.api.search中仍然存在的错误 被称为协同活动。