diff --git a/src/ncmlyrics/api.py b/src/ncmlyrics/api.py index 5dda5b7..d070fb7 100644 --- a/src/ncmlyrics/api.py +++ b/src/ncmlyrics/api.py @@ -1,7 +1,5 @@ -from dataclasses import dataclass from http.cookiejar import LoadError, MozillaCookieJar from json import dumps as dumpJson -from typing import Iterable from httpx import Client as HttpXClient from httpx import Request as HttpXRequest @@ -14,6 +12,8 @@ from .error import ( ) from .object import NCMAlbum, NCMLyrics, NCMPlaylist, NCMTrack +__all__ = ["NCMApi"] + REQUEST_HEADERS = { "Accept": "application/json", "Accept-Encoding": "zstd, br, gzip, deflate", diff --git a/src/ncmlyrics/error.py b/src/ncmlyrics/error.py index 1d7788c..a5aaffb 100644 --- a/src/ncmlyrics/error.py +++ b/src/ncmlyrics/error.py @@ -1,5 +1,16 @@ from httpx import RequestError +__all__ = [ + "NCMLyricsAppError", + "NCMApiError", + "NCMApiRequestError", + "NCMApiRetryLimitExceededError", + "ObjectParseError", + "ParseLinkError", + "UnsupportedLinkError", + "UnsupportedPureMusicTrackError", +] + class NCMLyricsAppError(Exception): """NCMLyrics 错误""" diff --git a/src/ncmlyrics/lrc.py b/src/ncmlyrics/lrc.py index bda9b29..99f3f85 100644 --- a/src/ncmlyrics/lrc.py +++ b/src/ncmlyrics/lrc.py @@ -10,7 +10,7 @@ from .enum import LrcMetaType, LrcType from .error import UnsupportedPureMusicTrackError from .object import NCMLyrics -__all__ = ["LrcType", "LrcMetaType", "Lrc"] +__all__ = ["Lrc"] LRC_RE_COMMIT = reCompile(r"^\s*#") LRC_RE_META = reCompile(r"^\s*\[(?Pti|ar|al|au|length|by|offset):\s*(?P.+?)\s*\]\s*$") diff --git a/src/ncmlyrics/util.py b/src/ncmlyrics/util.py index 240a79b..09693eb 100644 --- a/src/ncmlyrics/util.py +++ b/src/ncmlyrics/util.py @@ -10,6 +10,8 @@ from .enum import LinkType from .error import ParseLinkError, UnsupportedLinkError from .object import NCMTrack +__all__ = ["Link", "parseLink", "testExistTrackSource", "pickOutput"] + RE_ANDROID_ALBUM_SHARE_LINK_PATH = reCompile(r"^/album/(?P\d*)/?$") RE_SAFE_FILENAME = reCompile(r"\*{2,}") TRANSLATER_SAFE_FILENAME = str.maketrans({i: 0x2A for i in ("<", ">", ":", '"', "/", "\\", "|", "?")}) diff --git a/tests/test_utils.py b/tests/test_utils.py index 2ca8111..6946fda 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,9 +1,10 @@ from pathlib import Path from unittest import TestCase -from ncmlyrics.api import NCMTrack -from ncmlyrics.error import ParseLinkError, UnsupportLinkError -from ncmlyrics.util import Link, LinkType, parseLink, pickOutput, testExistTrackSource +from ncmlyrics.enum import LinkType +from ncmlyrics.error import ParseLinkError, UnsupportedLinkError +from ncmlyrics.object import NCMTrack +from ncmlyrics.util import Link, parseLink, pickOutput, testExistTrackSource class TestUtils(TestCase): @@ -73,19 +74,19 @@ class TestUtils(TestCase): def test_parseLink_UnsupportShareLinkError(self): self.assertRaises( - UnsupportLinkError, + UnsupportedLinkError, parseLink, "https://www.google.com/", ) self.assertRaises( - UnsupportLinkError, + UnsupportedLinkError, parseLink, "https://music.163.com/unsupport?id=123", ) self.assertRaises( - UnsupportLinkError, + UnsupportedLinkError, parseLink, "https://music.163.com/album/123a", )