[![Build Status](https://github.com/medialab/minet/workflows/Tests/badge.svg)](https://github.com/medialab/minet/actions) [![DOI](https://zenodo.org/badge/169059797.svg)](https://zenodo.org/badge/latestdoi/169059797) [![download number](https://static.pepy.tech/badge/minet)](https://pepy.tech/project/minet)
![Minet](docs/img/minet.png)
**minet** is a webmining command line tool & library for python (>= 3.7) that can be used to collect and extract data from a large variety of web sources such as raw webpages, Facebook, CrowdTangle, YouTube, Twitter, Media Cloud etc.
It adopts a very simple approach to various webmining problems by letting you perform a wide array of tasks from the comfort of the command line. No database needed: raw CSV files should be sufficient to do most of the work.
In addition, **minet** also exposes its high-level programmatic interface as a python library so you remain free to use its utilities to suit your use-cases better.
**minet** is developed by [médialab SciencesPo](https://github.com/medialab/) research engineers and is the consolidation of more than a decade of webmining practices targeted at social sciences.
As such, it has been designed to be:
1. **low-tech**, as it requires minimal resources such as memory, CPUs or hard drive space and should be able to work on any low-cost PC.
2. **fault-tolerant**, as it is able to recover when network is bad and retry HTTP calls when suitable. What's more, most of minet commands can be resumed if aborted and are designed to run for a long time (think days or months) without leaking memory.
3. **unix-compliant**, as it can be piped easily and know how to work with the usual streams.
**Shortcuts**: [Command line documentation](./docs/cli.md), [Python library documentation](./docs/lib.md).
![fetch](./docs/img/fetch.gif)
_How to cite?_
**minet** is published on [Zenodo](https://zenodo.org/) as [10.5281/zenodo.4564399](http://doi.org/10.5281/zenodo.4564399).
You can cite it thusly:
> Guillaume Plique, Pauline Breteau, Jules Farjas, Héloïse Théro, Jean Descamps, Amélie Pellé, Laura Miguel, César Pichon, & Kelly Christensen. (2019, October 14). Minet, a webmining CLI tool & library for python. Zenodo. http://doi.org/10.5281/zenodo.4564399
## Whirlwind tour
```bash
# Downloading large amount of urls as fast as possible
minet fetch url -i urls.csv > report.csv
# Extracting raw text from the downloaded HTML files
minet extract -i report.csv -I downloaded > extracted.csv
# Scraping the urls found in the downloaded HTML files
minet scrape urls -i report.csv -I downloaded > scraped_urls.csv
# Parsing & normalizing the scraped urls
minet url-parse scraped_url -i scraped_urls.csv > parsed_urls.csv
# Scraping data from Twitter
minet twitter scrape tweets "from:medialab_ScPo" > tweets.csv
# Printing a command's help
minet twitter scrape -h
# Searching videos on YouTube
minet youtube search -k "MY-YT-API-KEY" "médialab" > videos.csv
```
## Summary
- [What it does](#what-it-does)
- [Documented use cases](#documented-use-cases)
- [Features (from a technical standpoint)](#features-from-a-technical-standpoint)
- [Installation](#installation)
- [Upgrading](#upgrading)
- [Uninstallation](#uninstallation)
- [Documentation](#documentation)
- [Contributing](#contributing)
## What it does
Minet can single-handedly:
- Extract URLs from a text file (or a table)
- Parse URLs (get useful information, with Facebook- and Youtube-specific stuff)
- Join two CSV files by matching the columns containing URLs
- From a list of URLs, resolve their redirections
- ...and check their HTTP status
- ...and download the HTML
- ...and extract hyperlinks
- ...and extract the text content and other metadata (title...)
- ...and scrape structured data (using a declarative language to define your heuristics)
- Crawl (using a declarative language to define a browsing behavior, and what to harvest)
- Mine or search:
- _[Buzzsumo](https://buzzsumo.com/)_ (requires API access)
- _[Crowdtangle](https://www.crowdtangle.com/)_ (requires API access)
- _[Mediacloud](https://mediacloud.org/)_ (requires free API access)
- _[Twitter](https://twitter.com)_ (requires free API access)
- _[Wikipedia](https://ww.wikipedia.org)_
- _[Youtube](https://www.youtube.com/)_ (requires free API access)
- Scrape (without requiring special access, often just a user account):
- _[Facebook](https://www.facebook.com/)_
- _[Instagram](https://www.instagram.com/)_
- _[Telegram](https://telegram.org/)_
- _[TikTok](https://www.tiktok.com)_
- _[Twitter](https://twitter.com)_
- _[Google Drive](https://drive.google.com)_ (spreadsheets etc.)
- Grab & dump cookies from your browser
- Dump _[Hyphe](https://hyphe.medialab.sciences-po.fr/)_ data
## Documented use cases
- [Fetching a large amount of urls](./docs/cookbook/fetch.md)
- [Joining 2 CSV files by urls](./docs/cookbook/url_join.md)
- [Using minet from a Jupyter notebook](./docs/cookbook/notebooks/Minet%20in%20a%20Jupyter%20notebook.ipynb) (_very useful to experiment with the tool or teach students_)
- [Downloading images associated with a given hashtag on Twitter](./docs/cookbook/twitter_images.md)
- [Scraping DSL Tutorial](./docs/cookbook/scraping_dsl.md)
## Features (from a technical standpoint)
- Multithreaded, memory-efficient fetching from the web.
- Multithreaded, scalable crawling.
- Multiprocessed raw text content extraction from HTML pages.
- Multiprocessed scraping from HTML pages.
- URL-related heuristics utilities such as extraction, normalization and matching.
- Data collection from various APIs such as [CrowdTangle](https://www.crowdtangle.com/).
## Installation
**minet** can be installed as a standalone CLI tool (currently only on mac >= 10.14, ubuntu & similar) by running the following command in your terminal:
```shell
curl -sSL https://raw.githubusercontent.com/medialab/minet/master/scripts/install.sh | bash
```
Don't trust us enough to pipe the result of a HTTP request into `bash`? We wouldn't either, so feel free to read the installation script [here](./scripts/install.sh) and run it on your end if you prefer.
On ubuntu & similar you might need to install `curl` and `unzip` before running the installation script if you don't already have it:
```shell
sudo apt-get install curl unzip
```
Else, **minet** can be installed directly as a python CLI tool and library using pip:
```shell
pip install minet
```
Finally if you want to install the standalone binaries by yourself (even for windows) you can find them in each release [here](https://github.com/medialab/minet/releases).
## Upgrading
To upgrade the standalone version, simply run the install script once again:
```shell
curl -sSL https://raw.githubusercontent.com/medialab/minet/master/scripts/install.sh | bash
```
To upgrade the python version you can use pip thusly:
```shell
pip install -U minet
```
## Uninstallation
To uninstall the standalone version:
```shell
curl -sSL https://raw.githubusercontent.com/medialab/minet/master/scripts/uninstall.sh | bash
```
To uninstall the python version:
```shell
pip uninstall minet
```
## Documentation
- [minet as a command line tool](./docs/cli.md)
- [minet as a python library](./docs/lib.md)
## Contributing
To contribute to **minet** you can check out [this](./CONTRIBUTING.md) documentation.
Raw data
{
"_id": null,
"home_page": "http://github.com/medialab/minet",
"name": "minet",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "webmining",
"author": "Guillaume Plique, Pauline Breteau, Jules Farjas, H\u00e9lo\u00efse Th\u00e9ro, Jean Descamps, Am\u00e9lie Pell\u00e9, Laura Miguel, C\u00e9sar Pichon, Kelly Christensen",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/67/a9/d6852b4867d0cade490eddde9604e0e9cc6be1e70262bffca05b2c3dcde7/minet-1.4.1.tar.gz",
"platform": null,
"description": "[![Build Status](https://github.com/medialab/minet/workflows/Tests/badge.svg)](https://github.com/medialab/minet/actions) [![DOI](https://zenodo.org/badge/169059797.svg)](https://zenodo.org/badge/latestdoi/169059797) [![download number](https://static.pepy.tech/badge/minet)](https://pepy.tech/project/minet)\n\n![Minet](docs/img/minet.png)\n\n**minet** is a webmining command line tool & library for python (>= 3.7) that can be used to collect and extract data from a large variety of web sources such as raw webpages, Facebook, CrowdTangle, YouTube, Twitter, Media Cloud etc.\n\nIt adopts a very simple approach to various webmining problems by letting you perform a wide array of tasks from the comfort of the command line. No database needed: raw CSV files should be sufficient to do most of the work.\n\nIn addition, **minet** also exposes its high-level programmatic interface as a python library so you remain free to use its utilities to suit your use-cases better.\n\n**minet** is developed by [m\u00e9dialab SciencesPo](https://github.com/medialab/) research engineers and is the consolidation of more than a decade of webmining practices targeted at social sciences.\n\nAs such, it has been designed to be:\n\n1. **low-tech**, as it requires minimal resources such as memory, CPUs or hard drive space and should be able to work on any low-cost PC.\n2. **fault-tolerant**, as it is able to recover when network is bad and retry HTTP calls when suitable. What's more, most of minet commands can be resumed if aborted and are designed to run for a long time (think days or months) without leaking memory.\n3. **unix-compliant**, as it can be piped easily and know how to work with the usual streams.\n\n**Shortcuts**: [Command line documentation](./docs/cli.md), [Python library documentation](./docs/lib.md).\n\n![fetch](./docs/img/fetch.gif)\n\n_How to cite?_\n\n**minet** is published on [Zenodo](https://zenodo.org/) as [10.5281/zenodo.4564399](http://doi.org/10.5281/zenodo.4564399).\n\nYou can cite it thusly:\n\n> Guillaume Plique, Pauline Breteau, Jules Farjas, H\u00e9lo\u00efse Th\u00e9ro, Jean Descamps, Am\u00e9lie Pell\u00e9, Laura Miguel, C\u00e9sar Pichon, & Kelly Christensen. (2019, October 14). Minet, a webmining CLI tool & library for python. Zenodo. http://doi.org/10.5281/zenodo.4564399\n\n## Whirlwind tour\n\n```bash\n# Downloading large amount of urls as fast as possible\nminet fetch url -i urls.csv > report.csv\n\n# Extracting raw text from the downloaded HTML files\nminet extract -i report.csv -I downloaded > extracted.csv\n\n# Scraping the urls found in the downloaded HTML files\nminet scrape urls -i report.csv -I downloaded > scraped_urls.csv\n\n# Parsing & normalizing the scraped urls\nminet url-parse scraped_url -i scraped_urls.csv > parsed_urls.csv\n\n# Scraping data from Twitter\nminet twitter scrape tweets \"from:medialab_ScPo\" > tweets.csv\n\n# Printing a command's help\nminet twitter scrape -h\n\n# Searching videos on YouTube\nminet youtube search -k \"MY-YT-API-KEY\" \"m\u00e9dialab\" > videos.csv\n```\n\n## Summary\n\n- [What it does](#what-it-does)\n- [Documented use cases](#documented-use-cases)\n- [Features (from a technical standpoint)](#features-from-a-technical-standpoint)\n- [Installation](#installation)\n- [Upgrading](#upgrading)\n- [Uninstallation](#uninstallation)\n- [Documentation](#documentation)\n- [Contributing](#contributing)\n\n## What it does\n\nMinet can single-handedly:\n\n- Extract URLs from a text file (or a table)\n- Parse URLs (get useful information, with Facebook- and Youtube-specific stuff)\n- Join two CSV files by matching the columns containing URLs\n- From a list of URLs, resolve their redirections\n - ...and check their HTTP status\n - ...and download the HTML\n - ...and extract hyperlinks\n - ...and extract the text content and other metadata (title...)\n - ...and scrape structured data (using a declarative language to define your heuristics)\n- Crawl (using a declarative language to define a browsing behavior, and what to harvest)\n- Mine or search:\n - _[Buzzsumo](https://buzzsumo.com/)_ (requires API access)\n - _[Crowdtangle](https://www.crowdtangle.com/)_ (requires API access)\n - _[Mediacloud](https://mediacloud.org/)_ (requires free API access)\n - _[Twitter](https://twitter.com)_ (requires free API access)\n - _[Wikipedia](https://ww.wikipedia.org)_\n - _[Youtube](https://www.youtube.com/)_ (requires free API access)\n- Scrape (without requiring special access, often just a user account):\n - _[Facebook](https://www.facebook.com/)_\n - _[Instagram](https://www.instagram.com/)_\n - _[Telegram](https://telegram.org/)_\n - _[TikTok](https://www.tiktok.com)_\n - _[Twitter](https://twitter.com)_\n - _[Google Drive](https://drive.google.com)_ (spreadsheets etc.)\n- Grab & dump cookies from your browser\n- Dump _[Hyphe](https://hyphe.medialab.sciences-po.fr/)_ data\n\n## Documented use cases\n\n- [Fetching a large amount of urls](./docs/cookbook/fetch.md)\n- [Joining 2 CSV files by urls](./docs/cookbook/url_join.md)\n- [Using minet from a Jupyter notebook](./docs/cookbook/notebooks/Minet%20in%20a%20Jupyter%20notebook.ipynb) (_very useful to experiment with the tool or teach students_)\n- [Downloading images associated with a given hashtag on Twitter](./docs/cookbook/twitter_images.md)\n- [Scraping DSL Tutorial](./docs/cookbook/scraping_dsl.md)\n\n## Features (from a technical standpoint)\n\n- Multithreaded, memory-efficient fetching from the web.\n- Multithreaded, scalable crawling.\n- Multiprocessed raw text content extraction from HTML pages.\n- Multiprocessed scraping from HTML pages.\n- URL-related heuristics utilities such as extraction, normalization and matching.\n- Data collection from various APIs such as [CrowdTangle](https://www.crowdtangle.com/).\n\n## Installation\n\n**minet** can be installed as a standalone CLI tool (currently only on mac >= 10.14, ubuntu & similar) by running the following command in your terminal:\n\n```shell\ncurl -sSL https://raw.githubusercontent.com/medialab/minet/master/scripts/install.sh | bash\n```\n\nDon't trust us enough to pipe the result of a HTTP request into `bash`? We wouldn't either, so feel free to read the installation script [here](./scripts/install.sh) and run it on your end if you prefer.\n\nOn ubuntu & similar you might need to install `curl` and `unzip` before running the installation script if you don't already have it:\n\n```shell\nsudo apt-get install curl unzip\n```\n\nElse, **minet** can be installed directly as a python CLI tool and library using pip:\n\n```shell\npip install minet\n```\n\nFinally if you want to install the standalone binaries by yourself (even for windows) you can find them in each release [here](https://github.com/medialab/minet/releases).\n\n## Upgrading\n\nTo upgrade the standalone version, simply run the install script once again:\n\n```shell\ncurl -sSL https://raw.githubusercontent.com/medialab/minet/master/scripts/install.sh | bash\n```\n\nTo upgrade the python version you can use pip thusly:\n\n```shell\npip install -U minet\n```\n\n## Uninstallation\n\nTo uninstall the standalone version:\n\n```shell\ncurl -sSL https://raw.githubusercontent.com/medialab/minet/master/scripts/uninstall.sh | bash\n```\n\nTo uninstall the python version:\n\n```shell\npip uninstall minet\n```\n\n## Documentation\n\n- [minet as a command line tool](./docs/cli.md)\n- [minet as a python library](./docs/lib.md)\n\n## Contributing\n\nTo contribute to **minet** you can check out [this](./CONTRIBUTING.md) documentation.\n",
"bugtrack_url": null,
"license": "GPL-3.0",
"summary": "A webmining CLI tool & library for python.",
"version": "1.4.1",
"project_urls": {
"Homepage": "http://github.com/medialab/minet"
},
"split_keywords": [
"webmining"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "06ec86b64384e7f880ff53ec876e85fbc4c1b4f262350ea21a5d263f712875c1",
"md5": "8ebd2e9cc3b78bbb0a29d7df8af0b719",
"sha256": "120348497dcbf3e62a5b79ca68832c7469e0c7f8e620b9161d942716f7c2e89b"
},
"downloads": -1,
"filename": "minet-1.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8ebd2e9cc3b78bbb0a29d7df8af0b719",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 324539,
"upload_time": "2024-03-19T10:12:52",
"upload_time_iso_8601": "2024-03-19T10:12:52.527754Z",
"url": "https://files.pythonhosted.org/packages/06/ec/86b64384e7f880ff53ec876e85fbc4c1b4f262350ea21a5d263f712875c1/minet-1.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "67a9d6852b4867d0cade490eddde9604e0e9cc6be1e70262bffca05b2c3dcde7",
"md5": "2bb47e1b3f3117b9a0c8c5afa8983f38",
"sha256": "a19d7f01210be730e2b12350266a998deab5144c1f68f71b645aa8f4b8e186b7"
},
"downloads": -1,
"filename": "minet-1.4.1.tar.gz",
"has_sig": false,
"md5_digest": "2bb47e1b3f3117b9a0c8c5afa8983f38",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 242605,
"upload_time": "2024-03-19T10:12:55",
"upload_time_iso_8601": "2024-03-19T10:12:55.902383Z",
"url": "https://files.pythonhosted.org/packages/67/a9/d6852b4867d0cade490eddde9604e0e9cc6be1e70262bffca05b2c3dcde7/minet-1.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-19 10:12:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "medialab",
"github_project": "minet",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "minet"
}