JoeanAmier / XHS-Downloader

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

源码运行昨天开始报错 #124

Closed CHANShu0508 closed 2 months ago

CHANShu0508 commented 2 months ago
╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮
│ C:\Users\exzds\miniconda3\envs\dev\Lib\site-packages\textual\worker.py:365 in _run                                   │
│                                                                                                                      │
│   362 │   │   self.state = WorkerState.RUNNING                                                                       │
│   363 │   │   app.log.worker(self)                                                                                   │
│   364 │   │   try:                                                                                                   │
│ ❱ 365 │   │   │   self._result = await self.run()                                                                    │
│   366 │   │   except asyncio.CancelledError as error:                                                                │
│   367 │   │   │   self.state = WorkerState.CANCELLED                                                                 │
│   368 │   │   │   self._error = error                                                                                │
│                                                                                                                      │
│ ╭───────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────╮ │
│ │           app = XHSDownloader(title='XHSDownloader', classes={'-dark-mode'})                                     │ │
│ │         error = ScannerError(None, None, 'mapping values are not allowed here', <yaml.error.Mark object at       │ │
│ │                 0x0000013D66175BB0>)                                                                             │ │
│ │          self = <Worker ERROR name='deal' description='deal()'>                                                  │ │
│ │     Traceback = <class 'rich.traceback.Traceback'>                                                               │ │
│ │ worker_failed = WorkerFailed("Worker raised exception: ScannerError(None, None, 'mapping values are not allowed  │ │
│ │                 here', <yaml.error.Mark object at 0x0000013D66175BB0>)")                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                                      │
│ C:\Users\exzds\miniconda3\envs\dev\Lib\site-packages\textual\worker.py:349 in run                                    │
│                                                                                                                      │
│   346 │   │   Returns:                                                                                               │
│   347 │   │   │   Return value of the work.                                                                          │
│   348 │   │   """                                                                                                    │
│ ❱ 349 │   │   return await (                                                                                         │
│   350 │   │   │   self._run_threaded() if self._thread_worker else self._run_async()                                 │
│   351 │   │   )                                                                                                      │
│   352                                                                                                                │
│                                                                                                                      │
│ ╭──────────────────────── locals ────────────────────────╮                                                           │
│ │ self = <Worker ERROR name='deal' description='deal()'> │                                                           │
│ ╰────────────────────────────────────────────────────────╯                                                           │
│                                                                                                                      │
│ C:\Users\exzds\miniconda3\envs\dev\Lib\site-packages\textual\worker.py:334 in _run_async                             │
│                                                                                                                      │
│   331 │   │   │   or hasattr(self._work, "func")                                                                     │
│   332 │   │   │   and inspect.iscoroutinefunction(self._work.func)                                                   │
│   333 │   │   ):                                                                                                     │
│ ❱ 334 │   │   │   return await self._work()                                                                          │
│   335 │   │   elif inspect.isawaitable(self._work):                                                                  │
│   336 │   │   │   return await self._work                                                                            │
│   337 │   │   elif callable(self._work):                                                                             │
│                                                                                                                      │
│ ╭──────────────────────── locals ────────────────────────╮                                                           │
│ │ self = <Worker ERROR name='deal' description='deal()'> │                                                           │
│ ╰────────────────────────────────────────────────────────╯                                                           │
│                                                                                                                      │
│ C:\Users\exzds\free_install_softwares\XHS-Downloader\source\TUI\index.py:113 in deal                                 │
│                                                                                                                      │
│   110 │   @work()                                                                              ╭──── locals ────╮    │
│   111 │   async def deal(self):                                                                │ self = Index() │    │
│   112 │   │   await self.app.push_screen("loading")                                            ╰────────────────╯    │
│ ❱ 113 │   │   if any(await self.xhs.extract(self.url.value, True, log=self.tip, data=False, ))                       │
│   114 │   │   │   self.url.value = ""                                                                                │
│   115 │   │   else:                                                                                                  │
│   116 │   │   │   self.tip.write(Text(self.message("下载小红书作品文件失败"), style=ERROR))                          │
│                                                                                                                      │
│ C:\Users\exzds\free_install_softwares\XHS-Downloader\source\application\app.py:171 in extract                        │
│                                                                                                                      │
│   168 │   │   │   logging(                                                                                           │
│   169 │   │   │   │   log, self.message("共 {0} 个小红书作品待处理...").format(len(urls)))                           │
│   170 │   │   # return urls  # 调试代码                                                                              │
│ ❱ 171 │   │   return [await self.__deal_extract(i, download, index, log, bar, data, ) for i in                       │
│   172 │                                                                                                              │
│   173 │   async def extract_cli(self,                                                                                │
│   174 │   │   │   │   │   │     url: str,                                                                            │
│                                                                                                                      │
│ ╭───────────────────────────────────────────── locals ─────────────────────────────────────────────╮                 │
│ │      bar = None                                                                                  │                 │
│ │     data = False                                                                                 │                 │
│ │ download = True                                                                                  │                 │
│ │    index = None                                                                                  │                 │
│ │      log = RichLog()                                                                             │                 │
│ │     self = <source.application.app.XHS object at 0x0000013D658D0C20>                             │                 │
│ │      url = 'https://www.xiaohongshu.com/explore/66a2dd6a000000002701d692?xsec_token=ABvWzSRt'+58 │                 │
│ │     urls = ['https://www.xiaohongshu.com/explore/66a2dd6a000000002701d692']                      │                 │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯                 │
│                                                                                                                      │
│ C:\Users\exzds\free_install_softwares\XHS-Downloader\source\application\app.py:205 in __deal_extract                 │
│                                                                                                                      │
│   202 │   │   │   return {"message": msg}                                                                            │
│   203 │   │   logging(log, self.message("开始处理作品:{0}").format(url))                                            │
│   204 │   │   html = await self.html.request_url(url, log=log)                                                       │
│ ❱ 205 │   │   namespace = self.__generate_data_object(html)                                                          │
│   206 │   │   if not namespace:                                                                                      │
│   207 │   │   │   logging(log, self.message("{0} 获取数据失败").format(url), ERROR)                                  │
│   208 │   │   │   return {}                                                                                          │
│                                                                                                                      │
│ ╭─────────────────────────────────────────────── locals ───────────────────────────────────────────────╮             │
│ │      bar = None                                                                                      │             │
│ │     data = False                                                                                     │             │
│ │ download = True                                                                                      │             │
│ │     html = '<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="'+223253 │             │
│ │        i = '66a2dd6a000000002701d692'                                                                │             │
│ │    index = None                                                                                      │             │
│ │      log = RichLog()                                                                                 │             │
│ │     self = <source.application.app.XHS object at 0x0000013D658D0C20>                                 │             │
│ │      url = 'https://www.xiaohongshu.com/explore/66a2dd6a000000002701d692'                            │             │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯             │
│                                                                                                                      │
│ C:\Users\exzds\free_install_softwares\XHS-Downloader\source\application\app.py:231 in __generate_data_object         │
│                                                                                                                      │
│   228 │   │   return link.path.split("/")[-1]                                                                        │
│   229 │                                                                                                              │
│   230 │   def __generate_data_object(self, html: str) -> Namespace:                                                  │
│ ❱ 231 │   │   data = self.convert.run(html)                                                                          │
│   232 │   │   return Namespace(data)                                                                                 │
│   233 │                                                                                                              │
│   234 │   def __naming_rules(self, data: dict) -> str:                                                               │
│                                                                                                                      │
│ ╭───────────────────────────────────────────── locals ─────────────────────────────────────────────╮                 │
│ │ html = '<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="'+223253 │                 │
│ │ self = <source.application.app.XHS object at 0x0000013D658D0C20>                                 │                 │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯                 │
│                                                                                                                      │
│ C:\Users\exzds\free_install_softwares\XHS-Downloader\source\expansion\converter.py:20 in run                         │
│                                                                                                                      │
│   17 │                                                                                                               │
│   18 │   def run(self, content: str) -> dict:                                                                        │
│   19 │   │   return self.__filter_object(                                                                            │
│ ❱ 20 │   │   │   self.__convert_object(                                                                              │
│   21 │   │   │   │   self.__extract_object(content)))                                                                │
│   22 │                                                                                                               │
│   23 │   def __extract_object(self, html: str) -> str:                                                               │
│                                                                                                                      │
│ ╭────────────────────────────────────────────── locals ───────────────────────────────────────────────╮              │
│ │ content = '<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="'+223253 │              │
│ │    self = <source.expansion.converter.Converter object at 0x0000013D65B5AD20>                       │              │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯              │
│                                                                                                                      │
│ C:\Users\exzds\free_install_softwares\XHS-Downloader\source\expansion\converter.py:31 in __convert_object            │
│                                                                                                                      │
│   28 │                                                                                                               │
│   29 │   @staticmethod                                                                                               │
│   30 │   def __convert_object(text: str) -> dict:                                                                    │
│ ❱ 31 │   │   return safe_load(text.lstrip("window.__INITIAL_STATE__="))                                              │
│   32 │                                                                                                               │
│   33 │   @classmethod                                                                                                │
│   34 │   def __filter_object(cls, data: dict) -> dict:                                                               │
│                                                                                                                      │
│ ╭───────────────────────────────────────────── locals ─────────────────────────────────────────────╮                 │
│ │ text = "(function () {\n      try {\n        const containerEl = document.querySelector('#"+3703 │                 │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯                 │
│                                                                                                                      │
│ C:\Users\exzds\miniconda3\envs\dev\Lib\site-packages\yaml\__init__.py:125 in safe_load                               │
│                                                                                                                      │
│   122 │   Resolve only basic YAML tags. This is known                                                                │
│   123 │   to be safe for untrusted input.                                                                            │
│   124 │   """                                                                                                        │
│ ❱ 125 │   return load(stream, SafeLoader)                                                                            │
│   126                                                                                                                │
│   127 def safe_load_all(stream):                                                                                     │
│   128 │   """                                                                                                        │
│                                                                                                                      │
│ ╭────────────────────────────────────────────── locals ──────────────────────────────────────────────╮               │
│ │ stream = "(function () {\n      try {\n        const containerEl = document.querySelector('#"+3703 │               │
│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────╯               │
│                                                                                                                      │
│ C:\Users\exzds\miniconda3\envs\dev\Lib\site-packages\yaml\__init__.py:81 in load                                     │
│                                                                                                                      │
│    78 │   """                                                                                                        │
│    79 │   loader = Loader(stream)                                                                                    │
│    80 │   try:                                                                                                       │
│ ❱  81 │   │   return loader.get_single_data()                                                                        │
│    82 │   finally:                                                                                                   │
│    83 │   │   loader.dispose()                                                                                       │
│    84                                                                                                                │
│                                                                                                                      │
│ ╭────────────────────────────────────────────── locals ──────────────────────────────────────────────╮               │
│ │ Loader = <class 'yaml.loader.SafeLoader'>                                                          │               │
│ │ loader = <yaml.loader.SafeLoader object at 0x0000013D65ED4080>                                     │               │
│ │ stream = "(function () {\n      try {\n        const containerEl = document.querySelector('#"+3703 │               │
│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────╯               │
│                                                                                                                      │
│ C:\Users\exzds\miniconda3\envs\dev\Lib\site-packages\yaml\constructor.py:49 in get_single_data                       │
│                                                                                                                      │
│    46 │                                                                                                              │
│    47 │   def get_single_data(self):                                                                                 │
│    48 │   │   # Ensure that the stream contains a single document and construct it.                                  │
│ ❱  49 │   │   node = self.get_single_node()                                                                          │
│    50 │   │   if node is not None:                                                                                   │
│    51 │   │   │   return self.construct_document(node)                                                               │
│    52 │   │   return None                                                                                            │
│                                                                                                                      │
│ ╭─────────────────────────── locals ───────────────────────────╮                                                     │
│ │ self = <yaml.loader.SafeLoader object at 0x0000013D65ED4080> │                                                     │
│ ╰──────────────────────────────────────────────────────────────╯                                                     │
│                                                                                                                      │
│ C:\Users\exzds\miniconda3\envs\dev\Lib\site-packages\yaml\composer.py:36 in get_single_node                          │
│                                                                                                                      │
│    33 │   │   # Compose a document if the stream is not empty.                                                       │
│    34 │   │   document = None                                                                                        │
│    35 │   │   if not self.check_event(StreamEndEvent):                                                               │
│ ❱  36 │   │   │   document = self.compose_document()                                                                 │
│    37 │   │                                                                                                          │
│    38 │   │   # Ensure that the stream contains no more documents.                                                   │
│    39 │   │   if not self.check_event(StreamEndEvent):                                                               │
│                                                                                                                      │
│ ╭───────────────────────────── locals ─────────────────────────────╮                                                 │
│ │ document = None                                                  │                                                 │
│ │     self = <yaml.loader.SafeLoader object at 0x0000013D65ED4080> │                                                 │
│ ╰──────────────────────────────────────────────────────────────────╯                                                 │
│                                                                                                                      │
│ C:\Users\exzds\miniconda3\envs\dev\Lib\site-packages\yaml\composer.py:58 in compose_document                         │
│                                                                                                                      │
│    55 │   │   node = self.compose_node(None, None)                                                                   │
│    56 │   │                                                                                                          │
│    57 │   │   # Drop the DOCUMENT-END event.                                                                         │
│ ❱  58 │   │   self.get_event()                                                                                       │
│    59 │   │                                                                                                          │
│    60 │   │   self.anchors = {}                                                                                      │
│    61 │   │   return node                                                                                            │
│                                                                                                                      │
│ ╭───────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────╮ │
│ │ node = ScalarNode(tag='tag:yaml.org,2002:str', value="(function () { try { const containerEl =                   │ │
│ │        document.querySelector('#exploreFeeds') const loadingEl =                                                 │ │
│ │        document.querySelector('#feeds-replace-loading') if (!containerEl) { window.MF_STREAM_RENDER_EXTRA =      │ │
│ │        'no-container' return } const notes = Array.from(containerEl.querySelectorAll('.note-item')) const        │ │
│ │        notesCount = notes.length if (!notesCount) { window.MF_STREAM_RENDER_EXTRA = 'no-note-item' return } var  │ │
│ │        $$skeleton = document.getElementById('ssr-skeleton') if ($$skeleton) {                                    │ │
│ │        $$skeleton.parentNode.removeChild($$skeleton) }\nfunction getLayoutInfo() { const width =                 │ │
│ │        Math.min(window.innerWidth, 1728) if (width >= 1424) { return { columns")                                 │ │
│ │ self = <yaml.loader.SafeLoader object at 0x0000013D65ED4080>                                                     │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                                      │
│ C:\Users\exzds\miniconda3\envs\dev\Lib\site-packages\yaml\parser.py:118 in get_event                                 │
│                                                                                                                      │
│   115 │   │   # Get the next event and proceed further.                                                              │
│   116 │   │   if self.current_event is None:                                                                         │
│   117 │   │   │   if self.state:                                                                                     │
│ ❱ 118 │   │   │   │   self.current_event = self.state()                                                              │
│   119 │   │   value = self.current_event                                                                             │
│   120 │   │   self.current_event = None                                                                              │
│   121 │   │   return value                                                                                           │
│                                                                                                                      │
│ ╭─────────────────────────── locals ───────────────────────────╮                                                     │
│ │ self = <yaml.loader.SafeLoader object at 0x0000013D65ED4080> │                                                     │
│ ╰──────────────────────────────────────────────────────────────╯                                                     │
│                                                                                                                      │
│ C:\Users\exzds\miniconda3\envs\dev\Lib\site-packages\yaml\parser.py:193 in parse_document_end                        │
│                                                                                                                      │
│   190 │   def parse_document_end(self):                                                                              │
│   191 │   │                                                                                                          │
│   192 │   │   # Parse the document end.                                                                              │
│ ❱ 193 │   │   token = self.peek_token()                                                                              │
│   194 │   │   start_mark = end_mark = token.start_mark                                                               │
│   195 │   │   explicit = False                                                                                       │
│   196 │   │   if self.check_token(DocumentEndToken):                                                                 │
│                                                                                                                      │
│ ╭─────────────────────────── locals ───────────────────────────╮                                                     │
│ │ self = <yaml.loader.SafeLoader object at 0x0000013D65ED4080> │                                                     │
│ ╰──────────────────────────────────────────────────────────────╯                                                     │
│                                                                                                                      │
│ C:\Users\exzds\miniconda3\envs\dev\Lib\site-packages\yaml\scanner.py:129 in peek_token                               │
│                                                                                                                      │
│    126 │   │   # Return the next token, but do not delete if from the queue.                                         │
│    127 │   │   # Return None if no more tokens.                                                                      │
│    128 │   │   while self.need_more_tokens():                                                                        │
│ ❱  129 │   │   │   self.fetch_more_tokens()                                                                          │
│    130 │   │   if self.tokens:                                                                                       │
│    131 │   │   │   return self.tokens[0]                                                                             │
│    132 │   │   else:                                                                                                 │
│                                                                                                                      │
│ ╭─────────────────────────── locals ───────────────────────────╮                                                     │
│ │ self = <yaml.loader.SafeLoader object at 0x0000013D65ED4080> │                                                     │
│ ╰──────────────────────────────────────────────────────────────╯                                                     │
│                                                                                                                      │
│ C:\Users\exzds\miniconda3\envs\dev\Lib\site-packages\yaml\scanner.py:223 in fetch_more_tokens                        │
│                                                                                                                      │
│    220 │   │                                                                                                         │
│    221 │   │   # Is it the value indicator?                                                                          │
│    222 │   │   if ch == ':' and self.check_value():                                                                  │
│ ❱  223 │   │   │   return self.fetch_value()                                                                         │
│    224 │   │                                                                                                         │
│    225 │   │   # Is it an alias?                                                                                     │
│    226 │   │   if ch == '*':                                                                                         │
│                                                                                                                      │
│ ╭─────────────────────────── locals ───────────────────────────╮                                                     │
│ │   ch = ':'                                                   │                                                     │
│ │ self = <yaml.loader.SafeLoader object at 0x0000013D65ED4080> │                                                     │
│ ╰──────────────────────────────────────────────────────────────╯                                                     │
│                                                                                                                      │
│ C:\Users\exzds\miniconda3\envs\dev\Lib\site-packages\yaml\scanner.py:577 in fetch_value                              │
│                                                                                                                      │
│    574 │   │   │   │   # We are allowed to start a complex value if and only if                                      │
│    575 │   │   │   │   # we can start a simple key.                                                                  │
│    576 │   │   │   │   if not self.allow_simple_key:                                                                 │
│ ❱  577 │   │   │   │   │   raise ScannerError(None, None,                                                            │
│    578 │   │   │   │   │   │   │   "mapping values are not allowed here",                                            │
│    579 │   │   │   │   │   │   │   self.get_mark())                                                                  │
│    580                                                                                                               │
│                                                                                                                      │
│ ╭─────────────────────────── locals ───────────────────────────╮                                                     │
│ │ self = <yaml.loader.SafeLoader object at 0x0000013D65ED4080> │                                                     │
│ ╰──────────────────────────────────────────────────────────────╯                                                     │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
ScannerError: mapping values are not allowed here
  in "<unicode string>", line 23, column 29:
                return { columns: 5, gapV: 16, gapH: 32, columnW ...

请问这是什么情况

Alic0663 commented 2 months ago

您好大哥,请问您这个错误解决了吗,我运行源码也提示这个错误

CHANShu0508 commented 2 months ago

您好大哥,请问您这个错误解决了吗,我运行源码也提示这个错误

没有

Alic0663 commented 2 months ago

@JoeanAmier 期待作者协助处理