Source code for darc.sites.magnet

# -*- coding: utf-8 -*-
# pylint: disable=ungrouped-imports
"""Magnet Links

The :mod:`darc.sites.magnet` module is customised to
handle magnet links.


from typing import TYPE_CHECKING

from darc.error import LinkNoReturn
from darc.proxy.magnet import save_magnet
from darc.sites._abc import BaseSite

    from typing import NoReturn

    from requests import Session
    from selenium.webdriver import Chrome as Driver

    import as darc_link  # Link
    from darc._compat import datetime

[docs]class Magnet(BaseSite): """Magnet links."""
[docs] @staticmethod def crawler(timestamp: 'datetime', session: 'Session', link: 'darc_link.Link') -> 'NoReturn': # pylint: disable=unused-argument """Crawler hook for magnet links. Args: timestamp: Timestamp of the worker node reference. session (:class:`requests.Session`): Session object with proxy settings. link: Link object to be crawled. Raises: LinkNoReturn: This link has no return response. """ save_magnet(link) raise LinkNoReturn(link)
[docs] @staticmethod def loader(timestamp: 'datetime', driver: 'Driver', link: 'darc_link.Link') -> 'NoReturn': # pylint: disable=unused-argument """Not implemented. Raises: LinkNoReturn: This hook is not implemented. """ raise LinkNoReturn(link)