<p align="center">
<img src="https://github.com/Simatwa/y2mate-api/blob/main/assets/logo.png?raw=true" height="70px" width="70px">
</p>
<h1 align="center">y2mate-api</h1>
<p align="center">
<a href="#"><img alt="Python version" src="https://img.shields.io/pypi/pyversions/y2mate-api"/></a>
<a href="https://github.com/Simatwa/y2mate-api/actions/workflows/python-test.yml"><img src="https://github.com/Simatwa/y2mate-api/actions/workflows/python-test.yml/badge.svg" alt="Python Test"/></a>
<a href="LICENSE"><img alt="License" src="https://img.shields.io/static/v1?logo=GPL&color=Blue&message=MIT&label=License"/></a>
<a href="https://pypi.org/project/y2mate-api"><img alt="PyPi" src="https://img.shields.io/pypi/v/y2mate-api"></a>
<a href="https://github.com/Simatwa/y2mate-api/releases"><img src="https://img.shields.io/github/v/release/Simatwa/y2mate-api?label=Release&logo=github" alt="Latest release"></img></a>
<a href="https://github.com/Simatwa/y2mate-api/releases"><img src="https://img.shields.io/github/release-date/Simatwa/y2mate-api?label=Release date&logo=github" alt="release date"></img></a>
<a href="https://github.com/psf/black"><img alt="Black" src="https://img.shields.io/static/v1?logo=Black&label=Code-style&message=Black"/></a>
<a href="#"><img alt="coverage" src="https://img.shields.io/static/v1?logo=Coverage&label=Coverage&message=90%&color=yellowgreen"/></a>
<a href="#" alt="progress"><img alt="Progress" src="https://img.shields.io/static/v1?logo=Progress&label=Progress&message=95%&color=green"/></a>
<a href="https://github.com/Simatwa/y2mate-api/actions/workflows/python-publish.yml"><img src="https://github.com/Simatwa/y2mate-api/actions/workflows/python-publish.yml/badge.svg" alt="Python-publish"/></a>
<a href="https://pepy.tech/project/livescore-api"><img src="https://static.pepy.tech/personalized-badge/y2mate-api?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads" alt="Downloads"></a>
<a href="https://github.com/Simatwa/y2mate-api/releases/latest"><img src="https://img.shields.io/github/downloads/Simatwa/y2mate-api/total?label=Asset%20Downloads&color=success" alt="Downloads"></img></a>
<a href="https://hits.seeyoufarm.com"><img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com/Simatwa/y2mate-api"/></a>
</p>
> Download youtube videos and audios by **title/id/url**
## Features
- ⬇️ Download audio/video by title/id/url
- ⬇️ Download `n` amount of audio/video based on keyword
- ⬇️ Download `n` amount of audio/video related to a particular video id/url
- ↩️ Resume incomplete downloads
- ⚙️ Download audio/video in a specific quality
# Installation
- Either of the following ways will get you ready.
Download binaries for your system from [here](https://github.com/Simatwa/y2mate-api/releases/latest).
**OR**
1. Pip
a. From source
```sh
pip install git+https://github.com/Simatwa/y2mate-api.git
```
b. From pypi
```sh
pip install y2mate-api
```
2. Locally
```sh
git clone https://github.com/Simatwa/y2mate-api.git
cd y2mate-api
pip install .
```
# Usage
`$ y2mate -f <mp3/mp4> <youtube-link or video id or keyword>`
Following the introduction of Cloudflare protection on the host, y2mate.com, you have to authenticate you're a human right from your **Chrome Browser** and then proceed to extract `cf_clearance` cookie value, which will in turn be passed over to the script.
### `cf_clearance` extraction process.
1. Install **Http Tracker** Chrome extension using [this link](https://chromewebstore.google.com/detail/http-tracker/fklakbbaaknbgcedidhblbnhclijnhbi).
2. Using **Chrome Browswer**, navigate to y2mate.com and pass the bot verification stage.
3. Start the *Http Tracker* extension.
4. On the search section of y2mate.com, key-in anything and press <kbd>enter</kbd>
5. Return to the Http Tracker window and look for any of the recent urls containing `*y2mate.com*` and click it.
6. Navigate down to the coookies section and copy the value of key `cf_clearance`. In the proceeding guides I will be referring to this value as **CF-CLEARANCE**
![CF-CLEARANCE highlighted](https://github.com/Simatwa/y2mate-api/blob/main/assets/cf_clearance_highlighted.png?raw=true)
> [!IMPORTANT]
> Since the script impersonates only one browser, you will have to use **Chrome Browser** for *CF-CLEARANCE* extraction process.
The uncompromised usage will be:
`$ y2mate -f <mp3/mp4> -cf <CF-CLEARANCE> <youtube-link or video id or keyword>`
To developers:
```python
from y2mate_api import session
session.cookies.update(
{
"cf_clearance": cf_clearance_value
}
)
```
As a workaround to explicitly declaring the CF-CLEARANCE along with other commands, export it to the environment as `Y2MATE_CF_CLEARANCE`.
By doing that, something like this will still get the work done:
`$ y2mate -f <mp3/mp4> <youtube-link or video id or keyword>`
> [!WARNING]
> The CF-CLEARANCE expires after a short while, consider updating it more frequently.
<details>
<summary>
Developer docs
</summary>
1.Generate download links and other metadata
- Video
```py
from y2mate_api import Handler
api = Handler("Quantum computing in details")
for video_metadata in api.run():
print(video_metadata)
"""Output
{
"size": "13.9 MB",
"f": "mp4",
"q": "720p",
"q_text": "720p (.mp4) <span class=\"label label-primary\"><small>m-HD</small></span>",
"k": "joQdX4S3z8ShOJWn6qaA9sL4Al7j4vBwhNgqkwx0U/tQ99R4mbX1dYceffBBnNn7",
"status": "ok",
"mess": "",
"c_status": "CONVERTED",
"vid": "X8MZWCGgIb8",
"title": "Quantum Computing In 5 Minutes | Quantum Computing Explained | Quantum Computer |Simplilearn",
"ftype": "mp4",
"fquality": "720",
"dlink": "https://rr2---sn-gjo-w43s.googlevideo.com/videoplayback?expire=1686946638&ei=7m6MZK-2NdKQgAepgJGIBg&ip=212.119.40.85&id=o-ADe3hAAtGl6fkEeUD9HKkFNoeQBSwEuttoN5vFPyzLdQ&itag=22&source=youtube&requiressl=yes&mh=Zy&mm=31%2C29&mn=sn-gjo-w43s%2Csn-ab5l6nr6&ms=au%2Crdu&mv=m&mvi=2&pl=23&initcwndbps=1013750&spc=qEK7B_bA4LnIWnJEJPO8Lp__Gz-ysFYRbF7IYj1J5g&vprv=1&svpuc=1&mime=video%2Fmp4&ns=L1NG4wpa6rJJmunA_QDUTswN&cnr=14&ratebypass=yes&dur=298.608&lmt=1682850029743273&mt=1686924560&fvip=1&fexp=24007246&c=WEB&txp=5311224&n=XD35AJLYPy2nng&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cns%2Ccnr%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRQIhAJdMdpsMBBByQZCOIglT_EvluXBK2wQ7mH32Ob95WAWJAiAP9PfGRwJKeJcZJXc5ZuVaZMImCAXCnbPcHyoSmRhH4A%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgAMVlWxHYtKeZEzbpKQ9Huqrk-5CQ0kTpSFgAmTIGaE4CIQDR0NJHxHO_TtRbn-HmDOgVD6H3ZUntvgcD1V5yfkngAA%3D%3D&title=Quantum+Computing+In+5+Minutes+%7C+Quantum+Computing+Explained+%7C+Quantum+Computer+%7C+Simplilearn"
}
"""
```
- Audio
```py
from y2mate_api import Handler
api = Handler("Quantum computing in details")
for audio_metadata in api.run(format="mp3"):
print(audio_metadata)
"""Output
{
"size": "4.6 MB",
"f": "mp3",
"q": "128kbps",
"q_text": "MP3 - 128kbps",
"k": "joQdX4S3z8ShOJWn6qaA9sL4Al7j4vBwhNgqlAxyU/NQ99R4mbX1dYceffBBnNn7",
"status": "ok",
"mess": "",
"c_status": "CONVERTED",
"vid": "X8MZWCGgIb8",
"title": "Quantum Computing In 5 Minutes | Quantum Computing Explained | Quantum Computer |Simplilearn",
"ftype": "mp3",
"fquality": "128",
"dlink": "https://dl201.dlmate53.xyz/?file=M3R4SUNiN3JsOHJ6WWQ2a3NQS1Y5ZGlxVlZIOCtyZ1ZqZFEwMHdVdVNvaERxNTA2dysydUpJSm1JT3hhaHFlckg4dEE4QzJUT3VHZU1RR2RvNVZ0WVh5TTU4TXBzREhJdUtzNFNjVndYeGo5bjYzb3B5UjNoeFBnYzVQdUdyVkdlR04rc1F0UTJpdUR3UGpZdkJUcXZUT2d0eDdGYWkwR3R3UWJQT0hZck5vYTgzREVldVB4MFpWQS93Q1M4c2tNaU5hWThWUFErK29UZ3V0V2VVTmRjY2dUMUlxbW1mZkpxaG95cGQ4WndsMnR1K2V5RDVNd1FmVElJV0VwYkhwUXVieXBUaDRZOENZVy9XKzFxLzVqL1drVGRQMGhzREhucXFDNElDeU9JOGIwSHNBPQ%3D%3D"
}
"""
```
- **Note** : To download the media returned, pass the response to `api.save()`
2. Auto-download media
```py
from y2mate_api import Handler
api = Handler("Quantum computing in details")
api.auto_save()
```
This will proceed to download the first video found and save it in the `current directory`
You can as well specify total videos to be downloaded by using `limit` argument.
For instance:
```py
from y2mate_api import Handler
api = Handler("https://youtu.be/POPoAjWFkGg")
api.auto_save(limit=10)
# This will download the video in path and 9 other videos related to the query specified
```
**Note** : You can still use **video id** such as `POPoAjWFkGg` as query parameter.
## Other parameters
- `Handler`
* author : Video author i.e Youtube Channel
* timeout : http requests timeout
* confirm : Confirm before downloading media
* unique : Auto-ignore previously downloaded media
* thread : Download (x) value of file at a time.
- `Handler.run`
* format : Media format mp4/mp3
* quality : Media quality such as 720p/128kbps
* resolver : Additional format info : [m4a,3gp,mp4,mp3]
* limit : Total videos to be retrieved
* keyword : Phrase(s) that must be in media title
* author : Video author i.e Youtube Channel
- `Handler.auto_save`
* dir : Path to Directory for saving the media files
* iterator : Function that yields third_query object - `Handler.run`
* progress_bar : Stdout media-name & Display progress bar
- `Handler.save`
* third_dict : Response of `third_query.run()`
* dir : Directory for saving the contents
* progress_bar : Display download progress bar
* quiet : Not to stdout anything
* naming_format : Format for generating media filename using the `third_query` response keys
* chunk_size : Size of chunks in KB for downloads
* play : Auto-play media after downloading
* resume : Resume incomplete download
</details>
## Telegram bot
If you're a Telegram user then purpose to checkout [y2mate-bot](https://github.com/Simatwa/y2mate-bot).
<details>
<summary>
For more info run `$ y2mate -h`
</summary>
```
usage: y2mate [-h] [-v] [-f mp3|mp4]
[-q 4k|1080p|720p|480p|360p|240p|144p|auto|best|worst|mp3|m4a|.m4a|128kbps|192kbps|328kbps]
[-r m4a|3gp|mp4|mp3] [-k [KEYWORD ...]] [-a [AUTHOR ...]] [-l LIMIT]
[-d PATH] [-t TIMEOUT] [-c CHUNK] [-i PATH] [-o FORMAT] [-cf COOKIE]
[-thr THREAD] [--disable-bar] [--confirm] [--unique] [--quiet] [--history]
[--clear] [--resume] [--play]
[query ...]
Download youtube videos and audios by title or link
positional arguments:
query Youtube video title, link or id - None
options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-f mp3|mp4, --format mp3|mp4
Specify media type - audio/video
-q 4k|1080p|720p|480p|360p|240p|144p|auto|best|worst|mp3|m4a|.m4a|128kbps|192kbps|328kbps, --quality 4k|1080p|720p|480p|360p|240p|144p|auto|best|worst|mp3|m4a|.m4a|128kbps|192kbps|328kbps
Media quality - auto
-r m4a|3gp|mp4|mp3, --resolver m4a|3gp|mp4|mp3
Other media formats incase of multiple options - mp4/mp3
-k [KEYWORD ...], --keyword [KEYWORD ...]
Media should contain this keywords - None
-a [AUTHOR ...], --author [AUTHOR ...]
Media author i.e YouTube channel name - None
-l LIMIT, --limit LIMIT
Total videos to be downloaded - 1
-d PATH, --dir PATH Directory for saving the contents -
/home/smartwa/git/smartwa/y2mate-api
-t TIMEOUT, --timeout TIMEOUT
Http request timeout in seconds - 30
-c CHUNK, --chunk CHUNK
Chunk-size for downloading files in KB - 256
-i PATH, --input PATH
Path to text file containing query per line - None
-o FORMAT, --output FORMAT
Format for generating filename %(key)s :
[title,vid,fquality,ftype] or 'pretty' - None
-cf COOKIE, --cf-clearance COOKIE
cf_clearance cookie value for y2mate.com
-thr THREAD, --thread THREAD
Download [x] amount of videos/audios at once - 1
--disable-bar Disable download progress bar - False
--confirm Confirm before downloading file - False
--unique Auto-skip any media that you once dowloaded - False
--quiet Not to stdout anything other than logs - False
--history Stdout all media metadata ever downloaded - False
--clear Clear all download histories - False
--resume Resume downloading incomplete downloads
--play Play media after download - False
This script has no official relation with y2mate.com
```
</details>
- Review [CHANGELOG](https://github.com/Simatwa/y2mate-api/blob/main/Docs/CHANGELOG.md) for latest updates.
## Disclaimer
This repository is intended for educational and personal use only. The use of this repository for any commercial or illegal purposes is strictly prohibited. The repository owner does not endorse or encourage the downloading or sharing of copyrighted material without permission. The repository owner is not responsible for any misuse of the software or any legal consequences that may arise from such misuse.
Raw data
{
"_id": null,
"home_page": "https://github.com/Simatwa/y2mate-api",
"name": "y2mate-api",
"maintainer": "Smartwa",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "y2mate, videos, video-api, youtube, youtube-api, youtube-dl, y2mate-api",
"author": "Smartwa",
"author_email": "smartwacaleb@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/85/43/85df38f81ad07c17190eedf6f16cc74dd9cea49444c5930e7f134eef7614/y2mate_api-1.2.2.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n <img src=\"https://github.com/Simatwa/y2mate-api/blob/main/assets/logo.png?raw=true\" height=\"70px\" width=\"70px\">\n</p>\n\n<h1 align=\"center\">y2mate-api</h1>\n\n<p align=\"center\">\n<a href=\"#\"><img alt=\"Python version\" src=\"https://img.shields.io/pypi/pyversions/y2mate-api\"/></a>\n<a href=\"https://github.com/Simatwa/y2mate-api/actions/workflows/python-test.yml\"><img src=\"https://github.com/Simatwa/y2mate-api/actions/workflows/python-test.yml/badge.svg\" alt=\"Python Test\"/></a>\n<a href=\"LICENSE\"><img alt=\"License\" src=\"https://img.shields.io/static/v1?logo=GPL&color=Blue&message=MIT&label=License\"/></a>\n<a href=\"https://pypi.org/project/y2mate-api\"><img alt=\"PyPi\" src=\"https://img.shields.io/pypi/v/y2mate-api\"></a>\n<a href=\"https://github.com/Simatwa/y2mate-api/releases\"><img src=\"https://img.shields.io/github/v/release/Simatwa/y2mate-api?label=Release&logo=github\" alt=\"Latest release\"></img></a>\n<a href=\"https://github.com/Simatwa/y2mate-api/releases\"><img src=\"https://img.shields.io/github/release-date/Simatwa/y2mate-api?label=Release date&logo=github\" alt=\"release date\"></img></a>\n<a href=\"https://github.com/psf/black\"><img alt=\"Black\" src=\"https://img.shields.io/static/v1?logo=Black&label=Code-style&message=Black\"/></a>\n<a href=\"#\"><img alt=\"coverage\" src=\"https://img.shields.io/static/v1?logo=Coverage&label=Coverage&message=90%&color=yellowgreen\"/></a>\n<a href=\"#\" alt=\"progress\"><img alt=\"Progress\" src=\"https://img.shields.io/static/v1?logo=Progress&label=Progress&message=95%&color=green\"/></a>\n<a href=\"https://github.com/Simatwa/y2mate-api/actions/workflows/python-publish.yml\"><img src=\"https://github.com/Simatwa/y2mate-api/actions/workflows/python-publish.yml/badge.svg\" alt=\"Python-publish\"/></a>\n<a href=\"https://pepy.tech/project/livescore-api\"><img src=\"https://static.pepy.tech/personalized-badge/y2mate-api?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads\" alt=\"Downloads\"></a>\n<a href=\"https://github.com/Simatwa/y2mate-api/releases/latest\"><img src=\"https://img.shields.io/github/downloads/Simatwa/y2mate-api/total?label=Asset%20Downloads&color=success\" alt=\"Downloads\"></img></a>\n<a href=\"https://hits.seeyoufarm.com\"><img src=\"https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com/Simatwa/y2mate-api\"/></a>\n</p>\n\n> Download youtube videos and audios by **title/id/url**\n\n\n## Features\n\n- \u2b07\ufe0f Download audio/video by title/id/url\n- \u2b07\ufe0f Download `n` amount of audio/video based on keyword\n- \u2b07\ufe0f Download `n` amount of audio/video related to a particular video id/url\n- \u21a9\ufe0f Resume incomplete downloads\n- \u2699\ufe0f Download audio/video in a specific quality\n\n\n# Installation\n\n- Either of the following ways will get you ready.\n\nDownload binaries for your system from [here](https://github.com/Simatwa/y2mate-api/releases/latest).\n\n**OR**\n\n1. Pip\n\n a. From source\n\n```sh\npip install git+https://github.com/Simatwa/y2mate-api.git\n```\n\n b. From pypi\n\n```sh\npip install y2mate-api\n```\n\n2. Locally\n\n```sh\ngit clone https://github.com/Simatwa/y2mate-api.git\ncd y2mate-api\npip install .\n```\n\n# Usage \n\n`$ y2mate -f <mp3/mp4> <youtube-link or video id or keyword>`\n\nFollowing the introduction of Cloudflare protection on the host, y2mate.com, you have to authenticate you're a human right from your **Chrome Browser** and then proceed to extract `cf_clearance` cookie value, which will in turn be passed over to the script.\n\n### `cf_clearance` extraction process.\n\n1. Install **Http Tracker** Chrome extension using [this link](https://chromewebstore.google.com/detail/http-tracker/fklakbbaaknbgcedidhblbnhclijnhbi).\n2. Using **Chrome Browswer**, navigate to y2mate.com and pass the bot verification stage.\n3. Start the *Http Tracker* extension.\n4. On the search section of y2mate.com, key-in anything and press <kbd>enter</kbd>\n5. Return to the Http Tracker window and look for any of the recent urls containing `*y2mate.com*` and click it.\n6. Navigate down to the coookies section and copy the value of key `cf_clearance`. In the proceeding guides I will be referring to this value as **CF-CLEARANCE**\n\n![CF-CLEARANCE highlighted](https://github.com/Simatwa/y2mate-api/blob/main/assets/cf_clearance_highlighted.png?raw=true)\n\n> [!IMPORTANT]\n> Since the script impersonates only one browser, you will have to use **Chrome Browser** for *CF-CLEARANCE* extraction process.\n\nThe uncompromised usage will be:\n\n`$ y2mate -f <mp3/mp4> -cf <CF-CLEARANCE> <youtube-link or video id or keyword>`\n\n\nTo developers:\n\n```python\nfrom y2mate_api import session\n\nsession.cookies.update(\n {\n \"cf_clearance\": cf_clearance_value\n }\n)\n```\n\nAs a workaround to explicitly declaring the CF-CLEARANCE along with other commands, export it to the environment as `Y2MATE_CF_CLEARANCE`.\n\nBy doing that, something like this will still get the work done:\n\n`$ y2mate -f <mp3/mp4> <youtube-link or video id or keyword>`\n\n> [!WARNING]\n> The CF-CLEARANCE expires after a short while, consider updating it more frequently.\n\n\n\n<details>\n\n<summary>\n\nDeveloper docs\n\n</summary>\n\n1.Generate download links and other metadata\n\n- Video\n\n```py\nfrom y2mate_api import Handler\napi = Handler(\"Quantum computing in details\")\nfor video_metadata in api.run():\n\tprint(video_metadata)\n\"\"\"Output\n{\n \"size\": \"13.9 MB\",\n \"f\": \"mp4\",\n \"q\": \"720p\",\n \"q_text\": \"720p (.mp4) <span class=\\\"label label-primary\\\"><small>m-HD</small></span>\",\n \"k\": \"joQdX4S3z8ShOJWn6qaA9sL4Al7j4vBwhNgqkwx0U/tQ99R4mbX1dYceffBBnNn7\",\n \"status\": \"ok\",\n \"mess\": \"\",\n \"c_status\": \"CONVERTED\",\n \"vid\": \"X8MZWCGgIb8\",\n \"title\": \"Quantum Computing In 5 Minutes | Quantum Computing Explained | Quantum Computer |Simplilearn\",\n \"ftype\": \"mp4\",\n \"fquality\": \"720\",\n \"dlink\": \"https://rr2---sn-gjo-w43s.googlevideo.com/videoplayback?expire=1686946638&ei=7m6MZK-2NdKQgAepgJGIBg&ip=212.119.40.85&id=o-ADe3hAAtGl6fkEeUD9HKkFNoeQBSwEuttoN5vFPyzLdQ&itag=22&source=youtube&requiressl=yes&mh=Zy&mm=31%2C29&mn=sn-gjo-w43s%2Csn-ab5l6nr6&ms=au%2Crdu&mv=m&mvi=2&pl=23&initcwndbps=1013750&spc=qEK7B_bA4LnIWnJEJPO8Lp__Gz-ysFYRbF7IYj1J5g&vprv=1&svpuc=1&mime=video%2Fmp4&ns=L1NG4wpa6rJJmunA_QDUTswN&cnr=14&ratebypass=yes&dur=298.608&lmt=1682850029743273&mt=1686924560&fvip=1&fexp=24007246&c=WEB&txp=5311224&n=XD35AJLYPy2nng&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cns%2Ccnr%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRQIhAJdMdpsMBBByQZCOIglT_EvluXBK2wQ7mH32Ob95WAWJAiAP9PfGRwJKeJcZJXc5ZuVaZMImCAXCnbPcHyoSmRhH4A%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgAMVlWxHYtKeZEzbpKQ9Huqrk-5CQ0kTpSFgAmTIGaE4CIQDR0NJHxHO_TtRbn-HmDOgVD6H3ZUntvgcD1V5yfkngAA%3D%3D&title=Quantum+Computing+In+5+Minutes+%7C+Quantum+Computing+Explained+%7C+Quantum+Computer+%7C+Simplilearn\"\n}\n\"\"\"\n```\n\n- Audio\n\n```py\nfrom y2mate_api import Handler\napi = Handler(\"Quantum computing in details\")\nfor audio_metadata in api.run(format=\"mp3\"):\n\tprint(audio_metadata)\n\n\"\"\"Output\n\n{\n \"size\": \"4.6 MB\",\n \"f\": \"mp3\",\n \"q\": \"128kbps\",\n \"q_text\": \"MP3 - 128kbps\",\n \"k\": \"joQdX4S3z8ShOJWn6qaA9sL4Al7j4vBwhNgqlAxyU/NQ99R4mbX1dYceffBBnNn7\",\n \"status\": \"ok\",\n \"mess\": \"\",\n \"c_status\": \"CONVERTED\",\n \"vid\": \"X8MZWCGgIb8\",\n \"title\": \"Quantum Computing In 5 Minutes | Quantum Computing Explained | Quantum Computer |Simplilearn\",\n \"ftype\": \"mp3\",\n \"fquality\": \"128\",\n \"dlink\": \"https://dl201.dlmate53.xyz/?file=M3R4SUNiN3JsOHJ6WWQ2a3NQS1Y5ZGlxVlZIOCtyZ1ZqZFEwMHdVdVNvaERxNTA2dysydUpJSm1JT3hhaHFlckg4dEE4QzJUT3VHZU1RR2RvNVZ0WVh5TTU4TXBzREhJdUtzNFNjVndYeGo5bjYzb3B5UjNoeFBnYzVQdUdyVkdlR04rc1F0UTJpdUR3UGpZdkJUcXZUT2d0eDdGYWkwR3R3UWJQT0hZck5vYTgzREVldVB4MFpWQS93Q1M4c2tNaU5hWThWUFErK29UZ3V0V2VVTmRjY2dUMUlxbW1mZkpxaG95cGQ4WndsMnR1K2V5RDVNd1FmVElJV0VwYkhwUXVieXBUaDRZOENZVy9XKzFxLzVqL1drVGRQMGhzREhucXFDNElDeU9JOGIwSHNBPQ%3D%3D\"\n}\n\"\"\"\n```\n\n- **Note** : To download the media returned, pass the response to `api.save()`\n\n2. Auto-download media\n\n```py\nfrom y2mate_api import Handler\napi = Handler(\"Quantum computing in details\")\napi.auto_save()\n```\n\nThis will proceed to download the first video found and save it in the `current directory`\n\nYou can as well specify total videos to be downloaded by using `limit` argument.\nFor instance:\n\n```py\nfrom y2mate_api import Handler\napi = Handler(\"https://youtu.be/POPoAjWFkGg\")\napi.auto_save(limit=10)\n# This will download the video in path and 9 other videos related to the query specified\n```\n\n**Note** : You can still use **video id** such as `POPoAjWFkGg` as query parameter.\n\n## Other parameters\n\n- `Handler`\n * author : Video author i.e Youtube Channel\n * timeout : http requests timeout\n * confirm : Confirm before downloading media\n * unique : Auto-ignore previously downloaded media\n * thread : Download (x) value of file at a time.\n\n- `Handler.run`\n * format : Media format mp4/mp3\n * quality : Media quality such as 720p/128kbps\n * resolver : Additional format info : [m4a,3gp,mp4,mp3]\n * limit : Total videos to be retrieved\n * keyword : Phrase(s) that must be in media title\n * author : Video author i.e Youtube Channel\n\n- `Handler.auto_save`\n * dir : Path to Directory for saving the media files\n * iterator : Function that yields third_query object - `Handler.run`\n * progress_bar : Stdout media-name & Display progress bar\n \n- `Handler.save`\n * third_dict : Response of `third_query.run()`\n * dir : Directory for saving the contents\n * progress_bar : Display download progress bar\n * quiet : Not to stdout anything\n * naming_format : Format for generating media filename using the `third_query` response keys\n * chunk_size : Size of chunks in KB for downloads\n * play : Auto-play media after downloading \n * resume : Resume incomplete download\n\n</details>\n \n## Telegram bot\n\nIf you're a Telegram user then purpose to checkout [y2mate-bot](https://github.com/Simatwa/y2mate-bot).\n\n<details>\n\n<summary>\n\t\nFor more info run `$ y2mate -h`\n\n</summary>\n\n```\nusage: y2mate [-h] [-v] [-f mp3|mp4]\n [-q 4k|1080p|720p|480p|360p|240p|144p|auto|best|worst|mp3|m4a|.m4a|128kbps|192kbps|328kbps]\n [-r m4a|3gp|mp4|mp3] [-k [KEYWORD ...]] [-a [AUTHOR ...]] [-l LIMIT]\n [-d PATH] [-t TIMEOUT] [-c CHUNK] [-i PATH] [-o FORMAT] [-cf COOKIE]\n [-thr THREAD] [--disable-bar] [--confirm] [--unique] [--quiet] [--history]\n [--clear] [--resume] [--play]\n [query ...]\n\nDownload youtube videos and audios by title or link\n\npositional arguments:\n query Youtube video title, link or id - None\n\noptions:\n -h, --help show this help message and exit\n -v, --version show program's version number and exit\n -f mp3|mp4, --format mp3|mp4\n Specify media type - audio/video\n -q 4k|1080p|720p|480p|360p|240p|144p|auto|best|worst|mp3|m4a|.m4a|128kbps|192kbps|328kbps, --quality 4k|1080p|720p|480p|360p|240p|144p|auto|best|worst|mp3|m4a|.m4a|128kbps|192kbps|328kbps\n Media quality - auto\n -r m4a|3gp|mp4|mp3, --resolver m4a|3gp|mp4|mp3\n Other media formats incase of multiple options - mp4/mp3\n -k [KEYWORD ...], --keyword [KEYWORD ...]\n Media should contain this keywords - None\n -a [AUTHOR ...], --author [AUTHOR ...]\n Media author i.e YouTube channel name - None\n -l LIMIT, --limit LIMIT\n Total videos to be downloaded - 1\n -d PATH, --dir PATH Directory for saving the contents -\n /home/smartwa/git/smartwa/y2mate-api\n -t TIMEOUT, --timeout TIMEOUT\n Http request timeout in seconds - 30\n -c CHUNK, --chunk CHUNK\n Chunk-size for downloading files in KB - 256\n -i PATH, --input PATH\n Path to text file containing query per line - None\n -o FORMAT, --output FORMAT\n Format for generating filename %(key)s :\n [title,vid,fquality,ftype] or 'pretty' - None\n -cf COOKIE, --cf-clearance COOKIE\n cf_clearance cookie value for y2mate.com\n -thr THREAD, --thread THREAD\n Download [x] amount of videos/audios at once - 1\n --disable-bar Disable download progress bar - False\n --confirm Confirm before downloading file - False\n --unique Auto-skip any media that you once dowloaded - False\n --quiet Not to stdout anything other than logs - False\n --history Stdout all media metadata ever downloaded - False\n --clear Clear all download histories - False\n --resume Resume downloading incomplete downloads\n --play Play media after download - False\n\nThis script has no official relation with y2mate.com\n\n```\n\n</details>\n\n- Review [CHANGELOG](https://github.com/Simatwa/y2mate-api/blob/main/Docs/CHANGELOG.md) for latest updates.\n\n## Disclaimer\n\nThis repository is intended for educational and personal use only. The use of this repository for any commercial or illegal purposes is strictly prohibited. The repository owner does not endorse or encourage the downloading or sharing of copyrighted material without permission. The repository owner is not responsible for any misuse of the software or any legal consequences that may arise from such misuse.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Download youtube videos and audios by title or link",
"version": "1.2.2",
"project_urls": {
"Bug Report": "https://github.com/Simatwa/y2mate-api/issues/new",
"Homepage": "https://github.com/Simatwa/y2mate-api"
},
"split_keywords": [
"y2mate",
" videos",
" video-api",
" youtube",
" youtube-api",
" youtube-dl",
" y2mate-api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9496717d750bec666b781baaede4eb35677959b932e2e825f8688f336f373f46",
"md5": "1e54a6c3df6b0b6ca59bad5f0d780e55",
"sha256": "70c725bfc630059016be248baa6d13a672815059e8f7ab6f1e55228d39668e58"
},
"downloads": -1,
"filename": "y2mate_api-1.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1e54a6c3df6b0b6ca59bad5f0d780e55",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 19178,
"upload_time": "2024-10-01T23:06:02",
"upload_time_iso_8601": "2024-10-01T23:06:02.219840Z",
"url": "https://files.pythonhosted.org/packages/94/96/717d750bec666b781baaede4eb35677959b932e2e825f8688f336f373f46/y2mate_api-1.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "854385df38f81ad07c17190eedf6f16cc74dd9cea49444c5930e7f134eef7614",
"md5": "ef4ef200c24cbdb5cc89c071b5c71d08",
"sha256": "f980a8318ef1cdfbf09b5333a341e6cf856e17321e07bf7db6c3f7a5275fa67d"
},
"downloads": -1,
"filename": "y2mate_api-1.2.2.tar.gz",
"has_sig": false,
"md5_digest": "ef4ef200c24cbdb5cc89c071b5c71d08",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 24330,
"upload_time": "2024-10-01T23:06:03",
"upload_time_iso_8601": "2024-10-01T23:06:03.476584Z",
"url": "https://files.pythonhosted.org/packages/85/43/85df38f81ad07c17190eedf6f16cc74dd9cea49444c5930e7f134eef7614/y2mate_api-1.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-01 23:06:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Simatwa",
"github_project": "y2mate-api",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "y2mate-api"
}