nyaasi-scraper


Namenyaasi-scraper JSON
Version 3.0.1 PyPI version JSON
download
home_pagehttps://github.com/zrekryu/nyaasi-scraper
Summarynyaasi-scraper is an asynchronous Python library for scraping nyaa.si and sukebei.nyaa.si.
upload_time2024-07-17 11:48:30
maintainerNone
docs_urlNone
authorZrekryuDev
requires_pythonNone
licenseNone
keywords nyaa sukebei torrent asynchronous web scraping
VCS
bugtrack_url
requirements httpx beautifulsoup4 feedparser
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # nyaasi-scraper

nyaasi-scraper is an asynchronous Python library for scraping [nyaa.si](https://nyaa.si) and [sukebei.nyaa.si](https://sukebei.nyaa.si).

# Installation

Installing through pip:

```bash
pip install nyaasi-scraper
```

# Usage

## Initializing Client with Site

By default, the site is nyaa.si (work-safe site).

```py
from nyaascraper import NyaaClient, SITE

# Work-safe site.
client = NyaaClient(SITE.FUN)

# Non-work-safe site.
client = NyaaClient(SITE.FAP)
```

## Changing Site

Changing the site of the client dynamically.

```py
from nyaascraper import SITE

client.site = SITE.FUN
```

## Searching Torrents

### Search with Term

```py
from nyaascraper.models import SearchResult

result: SearchResult = await client.search(term="Pokemon")
print(result)

# Iterate over torrents.
for torrent in result.torrents:
    print(torrent)
```

### Search by Username

```py
result = await client.search(username="Erai-raws")
print(result)
```

### Search with Quality Filter

```py
from nyaascraper import QualityFilter

# No Filter. (Default)
result = await client.search(quality_filter=QualityFilter.NO_FILTER)
print(result)

# Trusted only.
result = await client.search(quality_filter=QualityFilter.TRUSTED_ONLY)
print(result)

# No Remakes.
result = await client.search(quality_filter=QualityFilter.NO_REMAKES)
print(result)
```

### Search with Category

```py
from nyaascraper.enums import FunCategory, FapCategory

# Work-safe category.
result = await client.search(category=FunCategory.ANIME)
print(result)

# Work-safe subcategory search.
result = await client.search(category=FunCategory.ANIME__ENGLISH_TRANSLATED)
print(result)

# Non-work-safe category.
result = await client.search(category=FapCategory.ART)
print(result)

# Non-work-safe subcategory search.
result = await client.search(category=FapCategory.ART__MANGA)
print(result)
```

### Search with Sorting

```py
from nyaascraper.enums import SortBy, SortOrder

# Sort by comments.
result = await client.search(sort_by=SortBy.COMMENTS)
print(result)

# Sort by size.
result = await client.search(sort_by=SortBy.SIZE)
print(result)

# Sort by date.
result = await client.search(sort_by=SortBy.DATE)
print(result)

# Sort by seeders.
result = await client.search(sort_by=SortBy.SEEDERS)
print(result)

# Sort by leechers.
result = await client.search(sort_by=SortBy.LEECHERS)
print(result)

# Sort by downloads.
result = await client.search(sort_by=SortBy.DOWNLOADS)
print(result)

# Sort order: Ascending.
result = await client.search(sort_order=SortOrder.ASCENDING)
print(result)

# Sort order: Descending.
result = await client.search(sort_order=SortOrder.DESCENDING)
print(result)
```

### Search by Page

```py
result = await client.search(page=2)
print(result)
```

## Getting Torrent Information

```py
from nyaascraper.models import TorrentInfo

result = await client.search()

# Select View-ID of the first torrent from the search result.
view_id: int = result.torrents[0].view_id

torrent_info: TorrentInfo = await client.get_torrent_info(view_id)
print(torrent_info)
```

## RSS Feed

### Initializing Client with Site

By default, the site is nyaa.si (work-safe site).

```py
from nyaascraper import NyaaRSSClient, SITE

# Work-safe site.
client = NyaaRSSClient(SITE.FUN)

# Non-work-safe site.
client = NyaaRSSClient(SITE.FAP)
```

### Changing Site

Changing the site of the client dynamically.

```py
from nyaascraper import SITE

client.site = SITE.FUN
```

### Get RSS feed

```py
from nyaascraper.enums import Filter, FunCategory
from nyaascraper.models import NyaaRSSFeed

# All parameters passed are optional.
feed: NyaaRSSFeed = await client.get_feed(
    query="Pokemon",
    username="Erai-raws",
    filter_=Filter.TRUSTED_ONLY,
    category=FunCategory.ANIME__ENGLISH_TRANSLATED,
    use_magnet=True
    )

print("Title:", feed.title)
print("Description:", feed.description)

# Iterate over torrents.
for torrent in feed.torrents:
    print(torrent)
```

# License

Licensed under MIT License. See the LICENSE file for details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zrekryu/nyaasi-scraper",
    "name": "nyaasi-scraper",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "nyaa, sukebei, torrent, asynchronous, web scraping",
    "author": "ZrekryuDev",
    "author_email": "zrekryudev@gmail.com",
    "download_url": null,
    "platform": null,
    "description": "# nyaasi-scraper\n\nnyaasi-scraper is an asynchronous Python library for scraping [nyaa.si](https://nyaa.si) and [sukebei.nyaa.si](https://sukebei.nyaa.si).\n\n# Installation\n\nInstalling through pip:\n\n```bash\npip install nyaasi-scraper\n```\n\n# Usage\n\n## Initializing Client with Site\n\nBy default, the site is nyaa.si (work-safe site).\n\n```py\nfrom nyaascraper import NyaaClient, SITE\n\n# Work-safe site.\nclient = NyaaClient(SITE.FUN)\n\n# Non-work-safe site.\nclient = NyaaClient(SITE.FAP)\n```\n\n## Changing Site\n\nChanging the site of the client dynamically.\n\n```py\nfrom nyaascraper import SITE\n\nclient.site = SITE.FUN\n```\n\n## Searching Torrents\n\n### Search with Term\n\n```py\nfrom nyaascraper.models import SearchResult\n\nresult: SearchResult = await client.search(term=\"Pokemon\")\nprint(result)\n\n# Iterate over torrents.\nfor torrent in result.torrents:\n    print(torrent)\n```\n\n### Search by Username\n\n```py\nresult = await client.search(username=\"Erai-raws\")\nprint(result)\n```\n\n### Search with Quality Filter\n\n```py\nfrom nyaascraper import QualityFilter\n\n# No Filter. (Default)\nresult = await client.search(quality_filter=QualityFilter.NO_FILTER)\nprint(result)\n\n# Trusted only.\nresult = await client.search(quality_filter=QualityFilter.TRUSTED_ONLY)\nprint(result)\n\n# No Remakes.\nresult = await client.search(quality_filter=QualityFilter.NO_REMAKES)\nprint(result)\n```\n\n### Search with Category\n\n```py\nfrom nyaascraper.enums import FunCategory, FapCategory\n\n# Work-safe category.\nresult = await client.search(category=FunCategory.ANIME)\nprint(result)\n\n# Work-safe subcategory search.\nresult = await client.search(category=FunCategory.ANIME__ENGLISH_TRANSLATED)\nprint(result)\n\n# Non-work-safe category.\nresult = await client.search(category=FapCategory.ART)\nprint(result)\n\n# Non-work-safe subcategory search.\nresult = await client.search(category=FapCategory.ART__MANGA)\nprint(result)\n```\n\n### Search with Sorting\n\n```py\nfrom nyaascraper.enums import SortBy, SortOrder\n\n# Sort by comments.\nresult = await client.search(sort_by=SortBy.COMMENTS)\nprint(result)\n\n# Sort by size.\nresult = await client.search(sort_by=SortBy.SIZE)\nprint(result)\n\n# Sort by date.\nresult = await client.search(sort_by=SortBy.DATE)\nprint(result)\n\n# Sort by seeders.\nresult = await client.search(sort_by=SortBy.SEEDERS)\nprint(result)\n\n# Sort by leechers.\nresult = await client.search(sort_by=SortBy.LEECHERS)\nprint(result)\n\n# Sort by downloads.\nresult = await client.search(sort_by=SortBy.DOWNLOADS)\nprint(result)\n\n# Sort order: Ascending.\nresult = await client.search(sort_order=SortOrder.ASCENDING)\nprint(result)\n\n# Sort order: Descending.\nresult = await client.search(sort_order=SortOrder.DESCENDING)\nprint(result)\n```\n\n### Search by Page\n\n```py\nresult = await client.search(page=2)\nprint(result)\n```\n\n## Getting Torrent Information\n\n```py\nfrom nyaascraper.models import TorrentInfo\n\nresult = await client.search()\n\n# Select View-ID of the first torrent from the search result.\nview_id: int = result.torrents[0].view_id\n\ntorrent_info: TorrentInfo = await client.get_torrent_info(view_id)\nprint(torrent_info)\n```\n\n## RSS Feed\n\n### Initializing Client with Site\n\nBy default, the site is nyaa.si (work-safe site).\n\n```py\nfrom nyaascraper import NyaaRSSClient, SITE\n\n# Work-safe site.\nclient = NyaaRSSClient(SITE.FUN)\n\n# Non-work-safe site.\nclient = NyaaRSSClient(SITE.FAP)\n```\n\n### Changing Site\n\nChanging the site of the client dynamically.\n\n```py\nfrom nyaascraper import SITE\n\nclient.site = SITE.FUN\n```\n\n### Get RSS feed\n\n```py\nfrom nyaascraper.enums import Filter, FunCategory\nfrom nyaascraper.models import NyaaRSSFeed\n\n# All parameters passed are optional.\nfeed: NyaaRSSFeed = await client.get_feed(\n    query=\"Pokemon\",\n    username=\"Erai-raws\",\n    filter_=Filter.TRUSTED_ONLY,\n    category=FunCategory.ANIME__ENGLISH_TRANSLATED,\n    use_magnet=True\n    )\n\nprint(\"Title:\", feed.title)\nprint(\"Description:\", feed.description)\n\n# Iterate over torrents.\nfor torrent in feed.torrents:\n    print(torrent)\n```\n\n# License\n\nLicensed under MIT License. See the LICENSE file for details.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "nyaasi-scraper is an asynchronous Python library for scraping nyaa.si and sukebei.nyaa.si.",
    "version": "3.0.1",
    "project_urls": {
        "Homepage": "https://github.com/zrekryu/nyaasi-scraper"
    },
    "split_keywords": [
        "nyaa",
        " sukebei",
        " torrent",
        " asynchronous",
        " web scraping"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d66e21538db38e6b4d314bc87150a0cdb82a9ff35e09d1a69b41c1acd72ced27",
                "md5": "3a6ec4328bccea7d3e7ed7c7d6f39199",
                "sha256": "02e7c5ab142767585e5b7af6a9fd1461db01aa838ce541a85ad87433e7cfb82d"
            },
            "downloads": -1,
            "filename": "nyaasi_scraper-3.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3a6ec4328bccea7d3e7ed7c7d6f39199",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 13938,
            "upload_time": "2024-07-17T11:48:30",
            "upload_time_iso_8601": "2024-07-17T11:48:30.088224Z",
            "url": "https://files.pythonhosted.org/packages/d6/6e/21538db38e6b4d314bc87150a0cdb82a9ff35e09d1a69b41c1acd72ced27/nyaasi_scraper-3.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-17 11:48:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zrekryu",
    "github_project": "nyaasi-scraper",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "httpx",
            "specs": []
        },
        {
            "name": "beautifulsoup4",
            "specs": []
        },
        {
            "name": "feedparser",
            "specs": []
        }
    ],
    "lcname": "nyaasi-scraper"
}
        
Elapsed time: 3.86867s