nyaascraper


Namenyaascraper JSON
Version 1.0.5 PyPI version JSON
download
home_pageNone
Summarynyaascraper is an asynchronous Python library for scraping nyaa.si and sukebei.nyaa.si.
upload_time2024-09-08 18:31:32
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseNone
keywords asynchronous nyaa sukebei torrent web scraping
VCS
bugtrack_url
requirements beautifulsoup4 feedparser httpx
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # nyaascraper

`nyaascraper` 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 nyaascraper
```

# Usage

## Initializing Client with Site

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

```py
from nyaascraper import NyaaClient, SITE

# Work-safe site. (Default)
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="...")
print(result)

for torrent in result.torrents:
    print(torrent)
```

### Search by Username

```py
result = await client.search(username="...")
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. (Default)
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.models import NyaaRSSFeed

feed: NyaaRSSFeed = await client.get_feed()

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

for torrent in feed.torrents:
    print(torrent)
```

### Get RSS Feed with Magnet Links Only
```
feed = await client.get_feed(use_magnets=True)
```

# License

© 2023-2024 Zrekryu. Licensed under MIT License. See the LICENSE file for details.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "nyaascraper",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "asynchronous, nyaa, sukebei, torrent, web scraping",
    "author": null,
    "author_email": "Zrekryu <zrekryu@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/bc/83/cc91a26255412ab280168b92ffcc8b358cf5ae524f98f7a3afc6decbdeda/nyaascraper-1.0.5.tar.gz",
    "platform": null,
    "description": "# nyaascraper\n\n`nyaascraper` 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 nyaascraper\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. (Default)\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=\"...\")\nprint(result)\n\nfor torrent in result.torrents:\n    print(torrent)\n```\n\n### Search by Username\n\n```py\nresult = await client.search(username=\"...\")\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. (Default)\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.models import NyaaRSSFeed\n\nfeed: NyaaRSSFeed = await client.get_feed()\n\nprint(\"Title:\", feed.title)\nprint(\"Description:\", feed.description)\n\nfor torrent in feed.torrents:\n    print(torrent)\n```\n\n### Get RSS Feed with Magnet Links Only\n```\nfeed = await client.get_feed(use_magnets=True)\n```\n\n# License\n\n\u00a9 2023-2024 Zrekryu. Licensed under MIT License. See the LICENSE file for details.",
    "bugtrack_url": null,
    "license": null,
    "summary": "nyaascraper is an asynchronous Python library for scraping nyaa.si and sukebei.nyaa.si.",
    "version": "1.0.5",
    "project_urls": {
        "Issues": "https://github.com/zrekryu/nyaascraper/issues",
        "Repository": "https://github.com/zrekryu/nyaascraper"
    },
    "split_keywords": [
        "asynchronous",
        " nyaa",
        " sukebei",
        " torrent",
        " web scraping"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "af1a786dab7890a08aff271680f240f4103b598b9b998f401eb0b8a8738d75aa",
                "md5": "97c13dcfd12ea248080c3ff54e57de18",
                "sha256": "8c650c2e61a96d03f016d87f640a2c019437cee3cfeecaa81e47828f9baadf17"
            },
            "downloads": -1,
            "filename": "nyaascraper-1.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "97c13dcfd12ea248080c3ff54e57de18",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 14966,
            "upload_time": "2024-09-08T18:31:30",
            "upload_time_iso_8601": "2024-09-08T18:31:30.975513Z",
            "url": "https://files.pythonhosted.org/packages/af/1a/786dab7890a08aff271680f240f4103b598b9b998f401eb0b8a8738d75aa/nyaascraper-1.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bc83cc91a26255412ab280168b92ffcc8b358cf5ae524f98f7a3afc6decbdeda",
                "md5": "9ce693c9acc768cdd49c45f1f79c4445",
                "sha256": "f2e40d6391c4c3ba3ed32f972ab6d27c483699f362a6bc78b4485b108b3e0810"
            },
            "downloads": -1,
            "filename": "nyaascraper-1.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "9ce693c9acc768cdd49c45f1f79c4445",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 10113,
            "upload_time": "2024-09-08T18:31:32",
            "upload_time_iso_8601": "2024-09-08T18:31:32.761234Z",
            "url": "https://files.pythonhosted.org/packages/bc/83/cc91a26255412ab280168b92ffcc8b358cf5ae524f98f7a3afc6decbdeda/nyaascraper-1.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-08 18:31:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zrekryu",
    "github_project": "nyaascraper",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "beautifulsoup4",
            "specs": []
        },
        {
            "name": "feedparser",
            "specs": []
        },
        {
            "name": "httpx",
            "specs": []
        }
    ],
    "lcname": "nyaascraper"
}
        
Elapsed time: 0.30568s