v2.5.27: 更新网页端收藏夹的正则表达式;更新文档 (#319)

This commit is contained in:
hect0x7 2024-12-25 22:28:22 +08:00 committed by GitHub
parent 37e1d67249
commit 3d0bc8b381
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 91 additions and 9 deletions

View File

@ -40,6 +40,10 @@ plugins:
python: python:
paths: [ '../../src/' ] paths: [ '../../src/' ]
options: options:
summary:
functions: true
preload_modules:
- common
docstring_style: sphinx docstring_style: sphinx

View File

@ -2,3 +2,4 @@ mkdocs
mkdocstrings[python] mkdocstrings[python]
markdown-include markdown-include
mkdocs-material mkdocs-material
commonX

View File

@ -1,4 +1,7 @@
# client # client
::: jmcomic.jm_client_impl ::: jmcomic.jm_client_impl
options:
members:
- JmHtmlClient
- JmApiClient

View File

@ -0,0 +1,6 @@
# command-line
::: jmcomic.cl
options:
members:
- JmcomicUI

View File

@ -1,3 +1,9 @@
# config # config
::: jmcomic.jm_config.JmModuleConfig ::: jmcomic.jm_config
options:
members:
- JmMagicConstants
- JmModuleConfig
- default_jm_logging

View File

@ -1,4 +1,11 @@
# download # download
::: jmcomic.api ::: jmcomic.api
options:
members:
- download_album
- download_photo
- create_option
- create_option_by_env
- create_option_by_file
- create_option_by_str

View File

@ -1,3 +1,11 @@
# entity # entity
::: jmcomic.jm_entity ::: jmcomic.jm_entity
options:
inherited_members: true
members:
- JmAlbumDetail
- JmPhotoDetail
- JmImageDetail
- JmPageContent
- JmSearchPage

View File

@ -1,3 +1,7 @@
# option # option
::: jmcomic.jm_option.JmOption ::: jmcomic.jm_option
options:
members:
- DirRule
- JmOption

View File

@ -1,3 +1,6 @@
# plugin # plugin
::: jmcomic.jm_plugin ::: jmcomic.jm_plugin
options:
filters:
- Plugin$

View File

@ -0,0 +1,11 @@
# toolkit
::: jmcomic.jm_toolkit
options:
inherited_members: true
members:
- JmcomicText
- PatternTool
- JmPageTool
- JmImageTool
- JmCryptoTool

View File

@ -14,7 +14,7 @@
## 入门 ## 入门
- [快速上手(GitHub README)](https://github.com/hect0x7/JMComic-Crawler-Python/tree/master?tab=readme-ov-file#%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B) - [快速上手(GitHub README)](https://github.com/hect0x7/JMComic-Crawler-Python/tree/master?tab=readme-ov-file#%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B)
- [常用类和方法演示](tutorial/0_common_usage) - [常用类和方法演示](tutorial/0_common_usage.md)
- [option配置以及插件写法](./option_file_syntax.md) - [option配置以及插件写法](./option_file_syntax.md)

View File

@ -146,6 +146,35 @@ for aid, atitle, tag_list in page.iter_id_title_tag(): # 使用page的iter_id_t
download_album(aid_list, option) download_album(aid_list, option)
``` ```
## 获取收藏夹
可参考discussions: https://github.com/hect0x7/JMComic-Crawler-Python/discussions/235
```python
from jmcomic import *
option = JmOption.default()
client = option.new_jm_client()
client.login('用户名', '密码') # 也可以使用login插件/配置cookies
# 遍历全部收藏的所有页
for page in cl.favorite_folder_gen(): # 如果你只想获取特定收藏夹需要添加folder_id参数
# 遍历每页结果
for aid, atitle in page.iter_id_title():
# aid: 本子的album_id
# atitle: 本子的名称
print(aid)
# 打印当前帐号的所有收藏夹信息
for folder_id, folder_name in page.iter_folder_id_name():
print(f'收藏夹id: {folder_id}, 收藏夹名称: {folder_name}')
# 获取特定收藏夹的单页使用favorite_folder方法
page = cl.favorite_folder(page=1,
order_by=JmMagicConstants.ORDER_BY_LATEST,
folder_id='0' # 收藏夹id
)
```
## 分类 / 排行榜 ## 分类 / 排行榜
禁漫的分类是一个和搜索有些类似的功能。 禁漫的分类是一个和搜索有些类似的功能。

View File

@ -2,7 +2,7 @@
# 被依赖方 <--- 使用方 # 被依赖方 <--- 使用方
# config <--- entity <--- toolkit <--- client <--- option <--- downloader # config <--- entity <--- toolkit <--- client <--- option <--- downloader
__version__ = '2.5.26' __version__ = '2.5.27'
from .api import * from .api import *
from .jm_plugin import * from .jm_plugin import *

View File

@ -397,7 +397,7 @@ class JmPageTool:
# 收藏页面的本子结果 # 收藏页面的本子结果
pattern_html_favorite_content = compile( pattern_html_favorite_content = compile(
r'<div id="favorites_album_[^>]*?>[\s\S]*?' r'<div id="favorites_album_[^>]*?>[\s\S]*?'
r'<a href="/album/(\d+)/">[\s\S]*?' r'<a href="/album/(\d+)/[^"]*">[\s\S]*?'
r'<div class="video-title title-truncate">([^<]*?)' r'<div class="video-title title-truncate">([^<]*?)'
r'</div>' r'</div>'
) )