JoeanAmier / XHS-Downloader

小红书链接提取/作品采集工具:提取账号发布、收藏、点赞、专辑作品链接;提取搜索结果作品、用户链接;采集小红书作品信息;提取小红书作品下载地址;下载小红书无水印作品文件!
GNU General Public License v3.0
5.19k stars 775 forks source link

macOS 无法下载 #30

Open infinitesum opened 9 months ago

infinitesum commented 9 months ago

macOS源码运行之后有一大串Traceback错误信息,最后报错 ClientConnectorCertificateError: Cannot connect to host www.xiaohongshu.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)')] Exit status: 0 谢谢大大

JoeanAmier commented 9 months ago

能提供更多报错信息吗?

infinitesum commented 9 months ago

报错信息如下:

^[[<35;39;13M╭──────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────────────
────────────╮                                                                                                                                                                                        │ /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/aiohttp/connector.py:992 in _wrap_create_connection                                                               │
│                                                                                                                                                                                                   │
│    989 │   │   │   async with ceil_timeout(                                                                                                                                                       │
│    990 │   │   │   │   timeout.sock_connect, ceil_threshold=timeout.ceil_threshold                                                                                                                │
│    991 │   │   │   ):                                                                                                                                                                             │
│ ❱  992 │   │   │   │   return await self._loop.create_connection(*args, **kwargs)                                                                                                                 │
│    993 │   │   except cert_errors as exc:                                                                                                                                                         │
│    994 │   │   │   raise ClientConnectorCertificateError(req.connection_key, exc) from exc                                                                                                        │
│    995 │   │   except ssl_errors as exc:                                                                                                                                                          │
│                                                                                                                                                                                                   │
│ ╭─────────────────────────────────────────────────────────────────────────────────── locals ───────────────────────────────────────────────────────────────────────────────────╮                  │
│ │         args = (functools.partial(<class 'aiohttp.client_proto.ResponseHandler'>, loop=<_UnixSelectorEventLoop running=True closed=False debug=False>), '198.18.6.137', 443) │                  │
│ │ client_error = <class 'aiohttp.client_exceptions.ClientConnectorError'>                                                                                                      │                  │
│ │       kwargs = {                                                                                                                                                             │                  │
│ │                │   'ssl': <ssl.SSLContext object at 0x1055167d0>,                                                                                                            │                  │
│ │                │   'family': <AddressFamily.AF_INET: 2>,                                                                                                                     │                  │
│ │                │   'proto': 6,                                                                                                                                               │                  │
│ │                │   'flags': <AddressInfo.AI_NUMERICHOST|AI_NUMERICSERV: 4100>,                                                                                               │                  │
│ │                │   'server_hostname': 'www.xiaohongshu.com',                                                                                                                 │                  │
│ │                │   'local_addr': None                                                                                                                                        │                  │
│ │                }                                                                                                                                                             │                  │
│ │          req = <aiohttp.client_reqrep.ClientRequest object at 0x10553f3e0>                                                                                                   │                  │
│ │         self = <aiohttp.connector.TCPConnector object at 0x105399af0>                                                                                                        │                  │
│ │      timeout = ClientTimeout(total=None, connect=10, sock_read=None, sock_connect=None, ceil_threshold=5)                                                                    │                  │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                  │
│                                                                                                                                                                                                   │
│ /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py:1146 in create_connection                                                                                │
│                                                                                                                                                                                                   │
│   1143 │   │   │   │   raise ValueError(                                                                                                                                                          │
│   1144 │   │   │   │   │   f'A Stream Socket was expected, got {sock!r}')                                                                                                                         │
│   1145 │   │                                                                                                                                                                                      │
│ ❱ 1146 │   │   transport, protocol = await self._create_connection_transport(                                                                                                                     │
│   1147 │   │   │   sock, protocol_factory, ssl, server_hostname,                                                                                                                                  │
│   1148 │   │   │   ssl_handshake_timeout=ssl_handshake_timeout,                                                                                                                                   │
│   1149 │   │   │   ssl_shutdown_timeout=ssl_shutdown_timeout)                                                                                                                                     │
│                                                                                                                                                                                                   │
│ ╭──────────────────────────────────────────────────────────────────────────── locals ────────────────────────────────────────────────────────────────────────────╮                                │
│ │              addrinfo = (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('198.18.6.137', 443))                                                │                                │
│ │            all_errors = False                                                                                                                                  │                                │
│ │            exceptions = [[]]                                                                                                                                   │                                │
│ │                family = <AddressFamily.AF_INET: 2>                                                                                                             │                                │
│ │                 flags = <AddressInfo.AI_NUMERICHOST|AI_NUMERICSERV: 4100>                                                                                      │                                │
│ │  happy_eyeballs_delay = None                                                                                                                                   │                                │
│ │                  host = '198.18.6.137'                                                                                                                         │                                │
│ │                 infos = [(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('198.18.6.137', 443))]                                              │                                │
│ │            interleave = None                                                                                                                                   │                                │
│ │           laddr_infos = None                                                                                                                                   │                                │
│ │            local_addr = None                                                                                                                                   │                                │
│ │                  port = 443                                                                                                                                    │                                │
│ │                 proto = 6                                                                                                                                      │                                │
│ │      protocol_factory = functools.partial(<class 'aiohttp.client_proto.ResponseHandler'>, loop=<_UnixSelectorEventLoop running=True closed=False debug=False>) │                                │
│ │                  self = <_UnixSelectorEventLoop running=True closed=False debug=False>                                                                         │                                │
│ │       server_hostname = 'www.xiaohongshu.com'                                                                                                                  │                                │
│ │                  sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>                                                                              │                                │
│ │                   ssl = <ssl.SSLContext object at 0x1055167d0>                                                                                                 │                                │
│ │ ssl_handshake_timeout = None                                                                                                                                   │                                │
│ │  ssl_shutdown_timeout = None                                                                                                                                   │                                │
│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                │
│                                                                                                                                                                                                   │
│ /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py:1179 in _create_connection_transport                                                                     │
│                                                                                                                                                                                                   │
│   1176 │   │   │   transport = self._make_socket_transport(sock, protocol, waiter)                                                                                                                │
│   1177 │   │                                                                                                                                                                                      │
│   1178 │   │   try:                                                                                                                                                                               │
│ ❱ 1179 │   │   │   await waiter                                                                                                                                                                   │
│   1180 │   │   except:                                                                                                                                                                            │
│   1181 │   │   │   transport.close()                                                                                                                                                              │
│   1182 │   │   │   raise                                                                                                                                                                          │
│                                                                                                                                                                                                   │
│ ╭─────────────────────────────────────────────────────────────────────────────────────────── locals ────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │              protocol = <aiohttp.client_proto.ResponseHandler object at 0x105485b50>                                                                                                          │ │
│ │      protocol_factory = functools.partial(<class 'aiohttp.client_proto.ResponseHandler'>, loop=<_UnixSelectorEventLoop running=True closed=False debug=False>)                                │ │
│ │                  self = <_UnixSelectorEventLoop running=True closed=False debug=False>                                                                                                        │ │
│ │       server_hostname = 'www.xiaohongshu.com'                                                                                                                                                 │ │
│ │           server_side = False                                                                                                                                                                 │ │
│ │                  sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>                                                                                                             │ │
│ │                   ssl = <ssl.SSLContext object at 0x1055167d0>                                                                                                                                │ │
│ │ ssl_handshake_timeout = None                                                                                                                                                                  │ │
│ │  ssl_shutdown_timeout = None                                                                                                                                                                  │ │
│ │            sslcontext = <ssl.SSLContext object at 0x1055167d0>                                                                                                                                │ │
│ │             transport = <asyncio.sslproto._SSLProtocolTransport object at 0x105485af0>                                                                                                        │ │
│ │                waiter = <Future finished exception=SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate            │ │
│ │                         (_ssl.c:1000)')>                                                                                                                                                      │ │
│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                                                                                                                   │
│ /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/sslproto.py:575 in _on_handshake_complete                                                                               │
│                                                                                                                                                                                                   │
│   572 │   │   │   if handshake_exc is None:                                                                                                                                                       │
│   573 │   │   │   │   self._set_state(SSLProtocolState.WRAPPED)                                                                                                                                   │
│   574 │   │   │   else:                                                                                                                                                                           │
│ ❱ 575 │   │   │   │   raise handshake_exc                                                                                                                                                         │
│   576 │   │   │                                                                                                                                                                                   │
│   577 │   │   │   peercert = sslobj.getpeercert()                                                                                                                                                 │
│   578 │   │   except Exception as exc:                                                                                                                                                            │
│                                                                                                                                                                                                   │
│ ╭──────────────────────────────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────────────────────────────╮                               │
│ │ handshake_exc = SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)') │                               │
│ │           msg = 'SSL handshake failed on verifying the certificate'                                                                                             │                               │
│ │          self = <asyncio.sslproto.SSLProtocol object at 0x1054d6f00>                                                                                            │                               │
│ │        sslobj = <ssl.SSLObject object at 0x1055a8830>                                                                                                           │                               │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                               │
│                                                                                                                                                                                                   │
│ /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/sslproto.py:557 in _do_handshake                                                                                        │
│                                                                                                                                                                                                   │
│   554 │                                                                                        ╭────────────────────────── locals ───────────────────────────╮                                    │
│   555 │   def _do_handshake(self):                                                             │ self = <asyncio.sslproto.SSLProtocol object at 0x1054d6f00> │                                    │
│   556 │   │   try:                                                                             ╰─────────────────────────────────────────────────────────────╯                                    │
│ ❱ 557 │   │   │   self._sslobj.do_handshake()                                                                                                                                                     │
│   558 │   │   except SSLAgainErrors:                                                                                                                                                              │
│   559 │   │   │   self._process_outgoing()                                                                                                                                                        │
│   560 │   │   except ssl.SSLError as exc:                                                                                                                                                         │
│                                                                                                                                                                                                   │
│ /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py:917 in do_handshake                                                                                                      │
│                                                                                                                                                                                                   │
│    914 │                                                                                        ╭─────────────────── locals ───────────────────╮                                                  │
│    915 │   def do_handshake(self):                                                              │ self = <ssl.SSLObject object at 0x1055a8830> │                                                  │
│    916 │   │   """Start the SSL/TLS handshake."""                                               ╰──────────────────────────────────────────────╯                                                  │
│ ❱  917 │   │   self._sslobj.do_handshake()                                                                                                                                                        │
│    918 │                                                                                                                                                                                          │
│    919 │   def unwrap(self):                                                                                                                                                                      │
│    920 │   │   """Start the SSL shutdown handshake."""                                                                                                                                            │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)

The above exception was the direct cause of the following exception:

╭──────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────────────────────────╮
│ /Users/summer/Downloads/XHS-Downloader-1.6/source/__init__.py:190 in on_button_pressed                                                                                                            │
│                                                                                                                                                                                                   │
│   187 │                                                                                        ╭────────────────────────────────── locals ──────────────────────────────────╮                     │
│   188 │   async def on_button_pressed(self, event: Button.Pressed) -> None:                    │ event = Pressed()                                                          │                     │
│   189 │   │   if event.button.id == "deal":                                                    │  self = XHSDownloader(title='XHS-Downloader V1.6', classes={'-dark-mode'}) │                     │
│ ❱ 190 │   │   │   await self.deal()                                                            ╰────────────────────────────────────────────────────────────────────────────╯                     │
│   191 │   │   elif event.button.id == "reset":                                                                                                                                                    │
│   192 │   │   │   self.query_one(Input).value = ""                                                                                                                                                │
│   193 │   │   elif event.button.id == "paste":                                                                                                                                                    │
│                                                                                                                                                                                                   │
│ /Users/summer/Downloads/XHS-Downloader-1.6/source/__init__.py:201 in deal                                                                                                                         │
│                                                                                                                                                                                                   │
│   198 │   │   if not self.url.value:                                                           ╭───────────────────────────────── locals ──────────────────────────────────╮                      │
│   199 │   │   │   self.log_.write(Text("未输入任何小红书作品链接", style="b bright_yellow"))   │ self = XHSDownloader(title='XHS-Downloader V1.6', classes={'-dark-mode'}) │                      │
│   200 │   │   │   return                                                                       ╰───────────────────────────────────────────────────────────────────────────╯                      │
│ ❱ 201 │   │   if any(await self.APP.extract(self.url.value, True, log=self.log_, bar=self.bar)                                                                                                    │
│   202 │   │   │   self.url.value = ""                                                                                                                                                             │
│   203 │   │   else:                                                                                                                                                                               │
│   204 │   │   │   self.log_.write(Text("下载小红书作品文件失败", style="b bright_red"))                                                                                                           │
│                                                                                                                                                                                                   │
│ /Users/summer/Downloads/XHS-Downloader-1.6/source/__init__.py:100 in extract                                                                                                                      │
│                                                                                                                                                                                                   │
│    97 │   │   else:                                                                                                                                                                               │
│    98 │   │   │   self.rich_log(log, f"共 {len(urls)} 个小红书作品待处理")                                                                                                                        │
│    99 │   │   # return urls  # 调试代码                                                                                                                                                           │
│ ❱ 100 │   │   return [await self.__deal_extract(i, download, log, bar) for i in urls]                                                                                                             │
│   101 │                                                                                                                                                                                           │
│   102 │   async def __deal_links(self, url: str) -> list:                                                                                                                                         │
│   103 │   │   urls = []                                                                                                                                                                           │
│                                                                                                                                                                                                   │
│ ╭───────────────────────────────────────────── locals ──────────────────────────────────────────────╮                                                                                             │
│ │      bar = ProgressBar()                                                                          │                                                                                             │
│ │ download = True                                                                                   │                                                                                             │
│ │      log = RichLog()                                                                              │                                                                                             │
│ │     self = <source.XHS object at 0x1051d9940>                                                     │                                                                                             │
│ │      url = 'https://www.xiaohongshu.com/explore/65744e880000000005038ba8?app_platform=ios&ap'+137 │                                                                                             │
│ │     urls = ['https://www.xiaohongshu.com/explore/65744e880000000005038ba8']                       │                                                                                             │
│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────╯                                                                                             │
│                                                                                                                                                                                                   │
│ /Users/summer/Downloads/XHS-Downloader-1.6/source/__init__.py:116 in __deal_extract                                                                                                               │
│                                                                                                                                                                                                   │
│   113 │                                                                                        ╭───────────────────────────────── locals ──────────────────────────────────╮                      │
│   114 │   async def __deal_extract(self, url: str, download: bool, log, bar):                  │      bar = ProgressBar()                                                  │                      │
│   115 │   │   self.rich_log(log, f"开始处理:{url}")                                           │ download = True                                                           │                      │
│ ❱ 116 │   │   html = await self.html.request_url(url)                                          │      log = RichLog()                                                      │                      │
│   117 │   │   # self.rich_log(log, html)  # 调试代码                                           │     self = <source.XHS object at 0x1051d9940>                             │                      │
│   118 │   │   if not html:                                                                     │      url = 'https://www.xiaohongshu.com/explore/65744e880000000005038ba8' │                      │
│   119 │   │   │   self.rich_log(log, f"{url} 获取数据失败", "bright_red")                      ╰───────────────────────────────────────────────────────────────────────────╯                      │
│                                                                                                                                                                                                   │
│ /Users/summer/Downloads/XHS-Downloader-1.6/source/Html.py:11 in inner                                                                                                                             │
│                                                                                                                                                                                                   │
│    8                                                                                          ╭─────────────────────────────────── locals ───────────────────────────────────╮                    │
│    9 def retry(function):                                                                     │     args = ('https://www.xiaohongshu.com/explore/65744e880000000005038ba8',) │                    │
│   10 │   async def inner(self, *args, **kwargs):                                              │ function = <function Html.request_url at 0x10537cfe0>                        │                    │
│ ❱ 11 │   │   if result := await function(self, *args, **kwargs):                              │   kwargs = {}                                                                │                    │
│   12 │   │   │   return result                                                                │     self = <source.Html.Html object at 0x105399b20>                          │                    │
│   13 │   │   for _ in range(self.retry):                                                      ╰──────────────────────────────────────────────────────────────────────────────╯                    │
│   14 │   │   │   if result := await function(self, *args, **kwargs):                                                                                                                              │
│                                                                                                                                                                                                   │
│ /Users/summer/Downloads/XHS-Downloader-1.6/source/Html.py:43 in request_url                                                                                                                       │
│                                                                                                                                                                                                   │
│   40 │   │   │   url: str,                                                                    ╭─────────────────────────────── locals ────────────────────────────────╮                           │
│   41 │   │   │   text=True, ) -> str:                                                         │ self = <source.Html.Html object at 0x105399b20>                       │                           │
│   42 │   │   try:                                                                             │ text = True                                                           │                           │
│ ❱ 43 │   │   │   async with self.session.get(                                                 │  url = 'https://www.xiaohongshu.com/explore/65744e880000000005038ba8' │                           │
│   44 │   │   │   │   │   url,                                                                 ╰───────────────────────────────────────────────────────────────────────╯                           │
│   45 │   │   │   │   │   proxy=self.proxy,                                                                                                                                                        │
│   46 │   │   │   ) as response:                                                                                                                                                                   │
│                                                                                                                                                                                                   │
│ /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/aiohttp/client.py:1187 in __aenter__                                                                              │
│                                                                                                                                                                                                   │
│   1184 │   │   return self.__await__()                                                          ╭─────────────────────────────── locals ───────────────────────────────╮                          │
│   1185 │                                                                                        │ self = <aiohttp.client._RequestContextManager object at 0x105457970> │                          │
│   1186 │   async def __aenter__(self) -> _RetType:                                              ╰──────────────────────────────────────────────────────────────────────╯                          │
│ ❱ 1187 │   │   self._resp = await self._coro                                                                                                                                                      │
│   1188 │   │   return self._resp                                                                                                                                                                  │
│   1189                                                                                                                                                                                            │
│   1190                                                                                                                                                                                            │
│                                                                                                                                                                                                   │
│ /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/aiohttp/client.py:574 in _request                                                                                 │
│                                                                                                                                                                                                   │
│    571 │   │   │   │   │   │   │   ceil_threshold=real_timeout.ceil_threshold,                                                                                                                    │
│    572 │   │   │   │   │   │   ):                                                                                                                                                                 │
│    573 │   │   │   │   │   │   │   assert self._connector is not None                                                                                                                             │
│ ❱  574 │   │   │   │   │   │   │   conn = await self._connector.connect(                                                                                                                          │
│    575 │   │   │   │   │   │   │   │   req, traces=traces, timeout=real_timeout                                                                                                                   │
│    576 │   │   │   │   │   │   │   )                                                                                                                                                              │
│    577 │   │   │   │   │   except asyncio.TimeoutError as exc:                                                                                                                                    │
│                                                                                                                                                                                                   │
│ ╭─────────────────────────────────────────────────────────────────────────────────────────── locals ────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │       all_cookies = <SimpleCookie: >                                                                                                                                                          │ │
│ │   allow_redirects = True                                                                                                                                                                      │ │
│ │              auth = None                                                                                                                                                                      │ │
│ │     auth_from_url = None                                                                                                                                                                      │ │
│ │   auto_decompress = True                                                                                                                                                                      │ │
│ │           chunked = None                                                                                                                                                                      │ │
│ │          compress = None                                                                                                                                                                      │ │
│ │           cookies = None                                                                                                                                                                      │ │
│ │              data = None                                                                                                                                                                      │ │
│ │         expect100 = False                                                                                                                                                                     │ │
│ │       fingerprint = None                                                                                                                                                                      │ │
│ │            handle = None                                                                                                                                                                      │ │
│ │           headers = <CIMultiDict('User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0', 'Referer':    │ │
│ │                     'https://www.xiaohongshu.com/')>                                                                                                                                          │ │
│ │           history = []                                                                                                                                                                        │ │
│ │              json = None                                                                                                                                                                      │ │
│ │    max_field_size = 8190                                                                                                                                                                      │ │
│ │     max_line_size = 8190                                                                                                                                                                      │ │
│ │     max_redirects = 10                                                                                                                                                                        │ │
│ │            method = 'GET'                                                                                                                                                                     │ │
│ │            params = {}                                                                                                                                                                        │ │
│ │             proxy = URL('')                                                                                                                                                                   │ │
│ │        proxy_auth = None                                                                                                                                                                      │ │
│ │     proxy_headers = <CIMultiDict('User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0', 'Referer':    │ │
│ │                     'https://www.xiaohongshu.com/')>                                                                                                                                          │ │
│ │  raise_for_status = None                                                                                                                                                                      │ │
│ │      read_bufsize = 65536                                                                                                                                                                     │ │
│ │    read_until_eof = True                                                                                                                                                                      │ │
│ │      real_timeout = ClientTimeout(total=None, connect=10, sock_read=None, sock_connect=None, ceil_threshold=5)                                                                                │ │
│ │         redirects = 0                                                                                                                                                                         │ │
│ │               req = <aiohttp.client_reqrep.ClientRequest object at 0x10553f3e0>                                                                                                               │ │
│ │              self = <aiohttp.client.ClientSession object at 0x105399ac0>                                                                                                                      │ │
│ │   server_hostname = None                                                                                                                                                                      │ │
│ │ skip_auto_headers = None                                                                                                                                                                      │ │
│ │      skip_headers = set()                                                                                                                                                                     │ │
│ │               ssl = None                                                                                                                                                                      │ │
│ │       ssl_context = None                                                                                                                                                                      │ │
│ │        str_or_url = 'https://www.xiaohongshu.com/explore/65744e880000000005038ba8'                                                                                                            │ │
│ │           timeout = <_SENTINEL.sentinel: 1>                                                                                                                                                   │ │
│ │             timer = <aiohttp.helpers.TimerNoop object at 0x10553e8d0>                                                                                                                         │ │
│ │                tm = <aiohttp.helpers.TimeoutHandle object at 0x10553fe00>                                                                                                                     │ │
│ │ trace_request_ctx = None                                                                                                                                                                      │ │
│ │            traces = []                                                                                                                                                                        │ │
│ │               url = URL('https://www.xiaohongshu.com/explore/65744e880000000005038ba8')                                                                                                       │ │
│ │        verify_ssl = None                                                                                                                                                                      │ │
│ │           version = HttpVersion(major=1, minor=1)                                                                                                                                             │ │
│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                                                                                                                   │
│ /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/aiohttp/connector.py:544 in connect                                                                               │
│                                                                                                                                                                                                   │
│    541 │   │   │   │   │   await trace.send_connection_create_start()                                                                                                                             │
│    542 │   │   │                                                                                                                                                                                  │
│    543 │   │   │   try:                                                                                                                                                                           │
│ ❱  544 │   │   │   │   proto = await self._create_connection(req, traces, timeout)                                                                                                                │
│    545 │   │   │   │   if self._closed:                                                                                                                                                           │
│    546 │   │   │   │   │   proto.close()                                                                                                                                                          │
│    547 │   │   │   │   │   raise ClientConnectionError("Connector is closed.")                                                                                                                    │
│                                                                                                                                                                                                   │
│ ╭───────────────────────────────────────────────────────────────────────────── locals ──────────────────────────────────────────────────────────────────────────────╮                             │
│ │   available = 100                                                                                                                                                 │                             │
│ │         key = ConnectionKey(host='www.xiaohongshu.com', port=443, is_ssl=True, ssl=None, proxy=URL(''), proxy_auth=None, proxy_headers_hash=-8919886210872933346) │                             │
│ │ placeholder = <aiohttp.connector._TransportPlaceholder object at 0x10553f860>                                                                                     │                             │
│ │       proto = None                                                                                                                                                │                             │
│ │         req = <aiohttp.client_reqrep.ClientRequest object at 0x10553f3e0>                                                                                         │                             │
│ │        self = <aiohttp.connector.TCPConnector object at 0x105399af0>                                                                                              │                             │
│ │     timeout = ClientTimeout(total=None, connect=10, sock_read=None, sock_connect=None, ceil_threshold=5)                                                          │                             │
│ │      traces = []                                                                                                                                                  │                             │
│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                             │
│                                                                                                                                                                                                   │
│ /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/aiohttp/connector.py:911 in _create_connection                                                                    │
│                                                                                                                                                                                                   │
│    908 │   │   if req.proxy:                                                                                                                                                                      │
│    909 │   │   │   _, proto = await self._create_proxy_connection(req, traces, timeout)                                                                                                           │
│    910 │   │   else:                                                                                                                                                                              │
│ ❱  911 │   │   │   _, proto = await self._create_direct_connection(req, traces, timeout)                                                                                                          │
│    912 │   │                                                                                                                                                                                      │
│    913 │   │   return proto                                                                                                                                                                       │
│    914                                                                                                                                                                                            │
│                                                                                                                                                                                                   │
│ ╭─────────────────────────────────────────────── locals ───────────────────────────────────────────────╮                                                                                          │
│ │     req = <aiohttp.client_reqrep.ClientRequest object at 0x10553f3e0>                                │                                                                                          │
│ │    self = <aiohttp.connector.TCPConnector object at 0x105399af0>                                     │                                                                                          │
│ │ timeout = ClientTimeout(total=None, connect=10, sock_read=None, sock_connect=None, ceil_threshold=5) │                                                                                          │
│ │  traces = []                                                                                         │                                                                                          │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯                                                                                          │
│                                                                                                                                                                                                   │
│ /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/aiohttp/connector.py:1235 in _create_direct_connection                                                            │
│                                                                                                                                                                                                   │
│   1232 │   │   │   return transp, proto                                                                                                                                                           │
│   1233 │   │   else:                                                                                                                                                                              │
│   1234 │   │   │   assert last_exc is not None                                                                                                                                                    │
│ ❱ 1235 │   │   │   raise last_exc                                                                                                                                                                 │
│   1236 │                                                                                                                                                                                          │
│   1237 │   async def _create_proxy_connection(                                                                                                                                                    │
│   1238 │   │   self, req: ClientRequest, traces: List["Trace"], timeout: "ClientTimeout"                                                                                                          │
│                                                                                                                                                                                                   │
│ ╭─────────────────────────────────────────────────────────────────────────────────────────── locals ────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │    client_error = <class 'aiohttp.client_exceptions.ClientConnectorError'>                                                                                                                    │ │
│ │     fingerprint = None                                                                                                                                                                        │ │
│ │           hinfo = {                                                                                                                                                                           │ │
│ │                   │   'hostname': 'www.xiaohongshu.com',                                                                                                                                      │ │
│ │                   │   'host': '198.18.6.137',                                                                                                                                                 │ │
│ │                   │   'port': 443,                                                                                                                                                            │ │
│ │                   │   'family': <AddressFamily.AF_INET: 2>,                                                                                                                                   │ │
│ │                   │   'proto': 6,                                                                                                                                                             │ │
│ │                   │   'flags': <AddressInfo.AI_NUMERICHOST|AI_NUMERICSERV: 4100>                                                                                                              │ │
│ │                   }                                                                                                                                                                           │ │
│ │            host = '198.18.6.137'                                                                                                                                                              │ │
│ │   host_resolved = <Task finished name='Task-548' coro=<TCPConnector._resolve_host() done, defined at                                                                                          │ │
│ │                   /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/aiohttp/connector.py:825> result=[{'family': <AddressFamily.AF_INET: 2>, 'flags':           │ │
│ │                   <AddressInfo....RICSERV: 4100>, 'host': '198.18.6.137', 'hostname': 'www.xiaohongshu.com', ...}]>                                                                           │ │
│ │           hosts = [                                                                                                                                                                           │ │
│ │                   │   {                                                                                                                                                                       │ │
│ │                   │   │   'hostname': 'www.xiaohongshu.com',                                                                                                                                  │ │
│ │                   │   │   'host': '198.18.6.137',                                                                                                                                             │ │
│ │                   │   │   'port': 443,                                                                                                                                                        │ │
│ │                   │   │   'family': <AddressFamily.AF_INET: 2>,                                                                                                                               │ │
│ │                   │   │   'proto': 6,                                                                                                                                                         │ │
│ │                   │   │   'flags': <AddressInfo.AI_NUMERICHOST|AI_NUMERICSERV: 4100>                                                                                                          │ │
│ │                   │   }                                                                                                                                                                       │ │
│ │                   ]                                                                                                                                                                           │ │
│ │        last_exc = ClientConnectorCertificateError(ConnectionKey(host='www.xiaohongshu.com', port=443, is_ssl=True, ssl=None, proxy=URL(''), proxy_auth=None,                                  │ │
│ │                   proxy_headers_hash=-8919886210872933346), SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate   │ │
│ │                   (_ssl.c:1000)'))                                                                                                                                                            │ │
│ │            port = 443                                                                                                                                                                         │ │
│ │             req = <aiohttp.client_reqrep.ClientRequest object at 0x10553f3e0>                                                                                                                 │ │
│ │            self = <aiohttp.connector.TCPConnector object at 0x105399af0>                                                                                                                      │ │
│ │ server_hostname = 'www.xiaohongshu.com'                                                                                                                                                       │ │
│ │      sslcontext = <ssl.SSLContext object at 0x1055167d0>                                                                                                                                      │ │
│ │         timeout = ClientTimeout(total=None, connect=10, sock_read=None, sock_connect=None, ceil_threshold=5)                                                                                  │ │
│ │          traces = []                                                                                                                                                                          │ │
│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                                                                                                                   │
│ /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/aiohttp/connector.py:1204 in _create_direct_connection                                                            │
│                                                                                                                                                                                                   │
│   1201 │   │   │   )                                                                                                                                                                              │
│   1202 │   │   │                                                                                                                                                                                  │
│   1203 │   │   │   try:                                                                                                                                                                           │
│ ❱ 1204 │   │   │   │   transp, proto = await self._wrap_create_connection(                                                                                                                        │
│   1205 │   │   │   │   │   self._factory,                                                                                                                                                         │
│   1206 │   │   │   │   │   host,                                                                                                                                                                  │
│   1207 │   │   │   │   │   port,                                                                                                                                                                  │
│                                                                                                                                                                                                   │
│ ╭─────────────────────────────────────────────────────────────────────────────────────────── locals ────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │    client_error = <class 'aiohttp.client_exceptions.ClientConnectorError'>                                                                                                                    │ │
│ │     fingerprint = None                                                                                                                                                                        │ │
│ │           hinfo = {                                                                                                                                                                           │ │
│ │                   │   'hostname': 'www.xiaohongshu.com',                                                                                                                                      │ │
│ │                   │   'host': '198.18.6.137',                                                                                                                                                 │ │
│ │                   │   'port': 443,                                                                                                                                                            │ │
│ │                   │   'family': <AddressFamily.AF_INET: 2>,                                                                                                                                   │ │
│ │                   │   'proto': 6,                                                                                                                                                             │ │
│ │                   │   'flags': <AddressInfo.AI_NUMERICHOST|AI_NUMERICSERV: 4100>                                                                                                              │ │
│ │                   }                                                                                                                                                                           │ │
│ │            host = '198.18.6.137'                                                                                                                                                              │ │
│ │   host_resolved = <Task finished name='Task-548' coro=<TCPConnector._resolve_host() done, defined at                                                                                          │ │
│ │                   /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/aiohttp/connector.py:825> result=[{'family': <AddressFamily.AF_INET: 2>, 'flags':           │ │
│ │                   <AddressInfo....RICSERV: 4100>, 'host': '198.18.6.137', 'hostname': 'www.xiaohongshu.com', ...}]>                                                                           │ │
│ │           hosts = [                                                                                                                                                                           │ │
│ │                   │   {                                                                                                                                                                       │ │
│ │                   │   │   'hostname': 'www.xiaohongshu.com',                                                                                                                                  │ │
│ │                   │   │   'host': '198.18.6.137',                                                                                                                                             │ │
│ │                   │   │   'port': 443,                                                                                                                                                        │ │
│ │                   │   │   'family': <AddressFamily.AF_INET: 2>,                                                                                                                               │ │
│ │                   │   │   'proto': 6,                                                                                                                                                         │ │
│ │                   │   │   'flags': <AddressInfo.AI_NUMERICHOST|AI_NUMERICSERV: 4100>                                                                                                          │ │
│ │                   │   }                                                                                                                                                                       │ │
│ │                   ]                                                                                                                                                                           │ │
│ │        last_exc = ClientConnectorCertificateError(ConnectionKey(host='www.xiaohongshu.com', port=443, is_ssl=True, ssl=None, proxy=URL(''), proxy_auth=None,                                  │ │
│ │                   proxy_headers_hash=-8919886210872933346), SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate   │ │
│ │                   (_ssl.c:1000)'))                                                                                                                                                            │ │
│ │            port = 443                                                                                                                                                                         │ │
│ │             req = <aiohttp.client_reqrep.ClientRequest object at 0x10553f3e0>                                                                                                                 │ │
│ │            self = <aiohttp.connector.TCPConnector object at 0x105399af0>                                                                                                                      │ │
│ │ server_hostname = 'www.xiaohongshu.com'                                                                                                                                                       │ │
│ │      sslcontext = <ssl.SSLContext object at 0x1055167d0>                                                                                                                                      │ │
│ │         timeout = ClientTimeout(total=None, connect=10, sock_read=None, sock_connect=None, ceil_threshold=5)                                                                                  │ │
│ │          traces = []                                                                                                                                                                          │ │
│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                                                                                                                   │
│ /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/aiohttp/connector.py:994 in _wrap_create_connection                                                               │
│                                                                                                                                                                                                   │
│    991 │   │   │   ):                                                                                                                                                                             │
│    992 │   │   │   │   return await self._loop.create_connection(*args, **kwargs)                                                                                                                 │
│    993 │   │   except cert_errors as exc:                                                                                                                                                         │
│ ❱  994 │   │   │   raise ClientConnectorCertificateError(req.connection_key, exc) from exc                                                                                                        │
│    995 │   │   except ssl_errors as exc:                                                                                                                                                          │
│    996 │   │   │   raise ClientConnectorSSLError(req.connection_key, exc) from exc                                                                                                                │
│    997 │   │   except OSError as exc:                                                                                                                                                             │
│                                                                                                                                                                                                   │
│ ╭─────────────────────────────────────────────────────────────────────────────────── locals ───────────────────────────────────────────────────────────────────────────────────╮                  │
│ │         args = (functools.partial(<class 'aiohttp.client_proto.ResponseHandler'>, loop=<_UnixSelectorEventLoop running=True closed=False debug=False>), '198.18.6.137', 443) │                  │
│ │ client_error = <class 'aiohttp.client_exceptions.ClientConnectorError'>                                                                                                      │                  │
│ │       kwargs = {                                                                                                                                                             │                  │
│ │                │   'ssl': <ssl.SSLContext object at 0x1055167d0>,                                                                                                            │                  │
│ │                │   'family': <AddressFamily.AF_INET: 2>,                                                                                                                     │                  │
│ │                │   'proto': 6,                                                                                                                                               │                  │
│ │                │   'flags': <AddressInfo.AI_NUMERICHOST|AI_NUMERICSERV: 4100>,                                                                                               │                  │
│ │                │   'server_hostname': 'www.xiaohongshu.com',                                                                                                                 │                  │
│ │                │   'local_addr': None                                                                                                                                        │                  │
│ │                }                                                                                                                                                             │                  │
│ │          req = <aiohttp.client_reqrep.ClientRequest object at 0x10553f3e0>                                                                                                   │                  │
│ │         self = <aiohttp.connector.TCPConnector object at 0x105399af0>                                                                                                        │                  │
│ │      timeout = ClientTimeout(total=None, connect=10, sock_read=None, sock_connect=None, ceil_threshold=5)                                                                    │                  │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                  │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
ClientConnectorCertificateError: Cannot connect to host www.xiaohongshu.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get 
local issuer certificate (_ssl.c:1000)')]
JoeanAmier commented 9 months ago

更换网络试试。

infinitesum commented 9 months ago

更换网络后还是一样的报错信息,关掉代理也不行

JoeanAmier commented 9 months ago

我没有 Mac OS 设备,无法测试,未来将会发布油猴脚本,可以尝试一下。

JoeanAmier commented 9 months ago

40