jmcomic 2.6.2__py3-none-any.whl → 2.6.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
jmcomic/__init__.py CHANGED
@@ -2,7 +2,7 @@
2
2
  # 被依赖方 <--- 使用方
3
3
  # config <--- entity <--- toolkit <--- client <--- option <--- downloader
4
4
 
5
- __version__ = '2.6.2'
5
+ __version__ = '2.6.4'
6
6
 
7
7
  from .api import *
8
8
  from .jm_plugin import *
jmcomic/jm_config.py CHANGED
@@ -136,7 +136,7 @@ class JmModuleConfig:
136
136
  ''')
137
137
 
138
138
  # 获取最新移动端API域名的地址
139
- API_URL_DOMAIN_SERVER = f'{PROT}jmappc01-1308024008.cos.ap-guangzhou.myqcloud.com/server-2024.txt'
139
+ API_URL_DOMAIN_SERVER = f'{PROT}jmapp03-1308024008.cos.ap-jakarta.myqcloud.com/server-2024.txt'
140
140
 
141
141
  APP_HEADERS_TEMPLATE = {
142
142
  'Accept-Encoding': 'gzip, deflate',
jmcomic/jm_entity.py CHANGED
@@ -469,11 +469,13 @@ class JmAlbumDetail(DetailEntity, Downloadable):
469
469
  authors,
470
470
  tags,
471
471
  related_list=None,
472
+ description='',
472
473
  ):
473
474
  super().__init__()
474
475
  self.album_id: str = str(album_id)
475
476
  self.scramble_id: str = str(scramble_id)
476
477
  self.name: str = str(name).strip()
478
+ self.description = str(description).strip()
477
479
  self.page_count: int = int(page_count) # 总页数
478
480
  self.pub_date: str = pub_date # 发布日期
479
481
  self.update_date: str = update_date # 更新日期
jmcomic/jm_plugin.py CHANGED
@@ -749,6 +749,7 @@ class Img2pdfPlugin(JmOptionPlugin):
749
749
  filename_rule='Pid',
750
750
  dir_rule=None,
751
751
  delete_original_file=False,
752
+ encrypt=None,
752
753
  **kwargs,
753
754
  ):
754
755
  if photo is None and album is None:
@@ -766,14 +767,14 @@ class Img2pdfPlugin(JmOptionPlugin):
766
767
  pdf_filepath = self.decide_filepath(album, photo, filename_rule, 'pdf', pdf_dir, dir_rule)
767
768
 
768
769
  # 调用 img2pdf 把 photo_dir 下的所有图片转为pdf
769
- img_path_ls, img_dir_ls = self.write_img_2_pdf(pdf_filepath, album, photo)
770
+ img_path_ls, img_dir_ls = self.write_img_2_pdf(pdf_filepath, album, photo, encrypt)
770
771
  self.log(f'Convert Successfully: JM{album or photo} → {pdf_filepath}')
771
772
 
772
773
  # 执行删除
773
774
  img_path_ls += img_dir_ls
774
775
  self.execute_deletion(img_path_ls)
775
776
 
776
- def write_img_2_pdf(self, pdf_filepath, album: JmAlbumDetail, photo: JmPhotoDetail):
777
+ def write_img_2_pdf(self, pdf_filepath, album: JmAlbumDetail, photo: JmPhotoDetail, encrypt):
777
778
  import img2pdf
778
779
 
779
780
  if album is None:
@@ -795,8 +796,22 @@ class Img2pdfPlugin(JmOptionPlugin):
795
796
  with open(pdf_filepath, 'wb') as f:
796
797
  f.write(img2pdf.convert(img_path_ls))
797
798
 
799
+ if encrypt:
800
+ self.encrypt_pdf(pdf_filepath, encrypt)
801
+
798
802
  return img_path_ls, img_dir_ls
799
803
 
804
+ def encrypt_pdf(self, pdf_filepath: str, encrypt: dict):
805
+ try:
806
+ import pikepdf
807
+ except ImportError:
808
+ self.warning_lib_not_install('pikepdf')
809
+ return
810
+
811
+ password = str(encrypt.get('password', ''))
812
+ with pikepdf.open(pdf_filepath, allow_overwriting_input=True) as pdf:
813
+ pdf.save(pdf_filepath, encryption=pikepdf.Encryption(user=password, owner=password))
814
+
800
815
 
801
816
  class LongImgPlugin(JmOptionPlugin):
802
817
  plugin_key = 'long_img'
jmcomic/jm_toolkit.py CHANGED
@@ -26,6 +26,7 @@ class JmcomicText:
26
26
  pattern_html_album_album_id = compile(r'<span class="number">.*?:JM(\d+)</span>')
27
27
  pattern_html_album_scramble_id = compile(r'var scramble_id = (\d+);')
28
28
  pattern_html_album_name = compile(r'id="book-name"[^>]*?>([\s\S]*?)<')
29
+ pattern_html_album_description = compile(r'叙述:([\s\S]*?)</h2>')
29
30
  pattern_html_album_episode_list = compile(r'data-album="(\d+)"[^>]*>[\s\S]*?第(\d+)[话話]([\s\S]*?)<[\s\S]*?>')
30
31
  pattern_html_album_page_count = compile(r'<span class="pagecount">.*?:(\d+)</span>')
31
32
  pattern_html_album_pub_date = compile(r'>上架日期 : (.*?)</span>')
@@ -651,6 +652,7 @@ class JmApiAdaptTool:
651
652
  'actors',
652
653
  'related_list',
653
654
  'name',
655
+ 'description',
654
656
  ('id', 'album_id'),
655
657
  ('author', 'authors'),
656
658
  ('total_views', 'views'),
@@ -1,12 +1,37 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jmcomic
3
- Version: 2.6.2
3
+ Version: 2.6.4
4
4
  Summary: Python API For JMComic (禁漫天堂)
5
5
  Home-page: https://github.com/hect0x7/JMComic-Crawler-Python
6
6
  Author: hect0x7
7
- Author-email: 93357912+hect0x7@users.noreply.github.com
7
+ Author-email: hect0x7 <93357912+hect0x7@users.noreply.github.com>
8
+ License: MIT License
9
+
10
+ Copyright (c) 2023 hect0x7
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+
30
+ Project-URL: Homepage, https://github.com/hect0x7/JMComic-Crawler-Python
31
+ Project-URL: Documentation, https://jmcomic.readthedocs.io
8
32
  Keywords: python,jmcomic,18comic,禁漫天堂,NSFW
9
33
  Classifier: Development Status :: 4 - Beta
34
+ Classifier: License :: OSI Approved :: MIT License
10
35
  Classifier: Intended Audience :: Developers
11
36
  Classifier: Programming Language :: Python :: 3.7
12
37
  Classifier: Programming Language :: Python :: 3.8
@@ -21,22 +46,15 @@ Classifier: Operating System :: Microsoft :: Windows
21
46
  Requires-Python: >=3.7
22
47
  Description-Content-Type: text/markdown
23
48
  License-File: LICENSE
24
- Requires-Dist: curl_cffi
25
- Requires-Dist: commonX
26
- Requires-Dist: PyYAML
27
- Requires-Dist: Pillow
49
+ Requires-Dist: commonx>=0.6.38
50
+ Requires-Dist: curl-cffi
51
+ Requires-Dist: pillow
28
52
  Requires-Dist: pycryptodome
53
+ Requires-Dist: pyyaml
29
54
  Dynamic: author
30
- Dynamic: author-email
31
- Dynamic: classifier
32
- Dynamic: description
33
- Dynamic: description-content-type
34
55
  Dynamic: home-page
35
- Dynamic: keywords
36
56
  Dynamic: license-file
37
- Dynamic: requires-dist
38
57
  Dynamic: requires-python
39
- Dynamic: summary
40
58
 
41
59
  # Python API For JMComic (禁漫天堂)
42
60
 
@@ -205,7 +223,7 @@ jmcomic 123
205
223
 
206
224
  ## 使用小说明
207
225
 
208
- * Python >= 3.7
226
+ * Python >= 3.7,建议3.9以上,因为jmcomic的依赖库可能会不支持3.9以下的版本。
209
227
  * 个人项目,文档和示例会有不及时之处,可以Issue提问
210
228
 
211
229
  ## 项目文件夹介绍
@@ -0,0 +1,18 @@
1
+ jmcomic/__init__.py,sha256=bLTPD0DrRiCYtTpHwL3G2ApUxkkeAlo4MUb-jCT4Oso,902
2
+ jmcomic/api.py,sha256=ZduhXDmh4lg1dkXHs7UTAaPpYNO7kcdPCDH5JJT9KSI,4253
3
+ jmcomic/cl.py,sha256=PBSh0JndNFZw3B7WJPj5Y8SeFdKzHE00jIwYo9An-K0,3475
4
+ jmcomic/jm_client_impl.py,sha256=huPWXkEizu8x7J4rAk_iQROnXphPoyadXyvN8n1ENqI,41624
5
+ jmcomic/jm_client_interface.py,sha256=Bld80cYwBwIqcMSJK09g5q8U_UX3IWnQJxuRJQwmIOk,19082
6
+ jmcomic/jm_config.py,sha256=gyqvsm62Cr61-CNLAC1KBiIfdEzKJhJPAkRa6ZyuXOk,17144
7
+ jmcomic/jm_downloader.py,sha256=azYkIN-1OuEivZ1TGGDaYo1FkcO5KatSb0g4GVdKSPY,11041
8
+ jmcomic/jm_entity.py,sha256=ZyXVy3mOl9qkxlw6hyshVS3RR-yKfO5BkJHtyBAoKQE,20053
9
+ jmcomic/jm_exception.py,sha256=x3KGMLlQS2zi1GX7z5G58zJN2EwLkI4mAURkxZYjEvA,5055
10
+ jmcomic/jm_option.py,sha256=kErkn9-tXYp4h4lDQvc8jDYG1vqOMLIdIb3fbHvSsbA,21247
11
+ jmcomic/jm_plugin.py,sha256=x42eqhRcnHElTif8ORXw2jZh33Xnq55-1dpC6tmr_lQ,40894
12
+ jmcomic/jm_toolkit.py,sha256=SIYCRZ6P4SPbAQA03U5z2DNiDldY7hWsAvKTdEzyK9U,29683
13
+ jmcomic-2.6.4.dist-info/licenses/LICENSE,sha256=kz4coTxZxuGxisK3W00tjK57Zh3RcMGq-EnbXrK7-xA,1064
14
+ jmcomic-2.6.4.dist-info/METADATA,sha256=y8uFHhQIpHE7EWvNcQ-QVvCPv6EV4lZkry8ZXCg7Uuo,9572
15
+ jmcomic-2.6.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
+ jmcomic-2.6.4.dist-info/entry_points.txt,sha256=tRbQltaGSBjejI0c9jYt-4SXQMd5nSDHcMvHmuTy4ow,44
17
+ jmcomic-2.6.4.dist-info/top_level.txt,sha256=puvVMFYJqIbd6NOTMEvOyugMTT8woBfSQyxEBan3zY4,8
18
+ jmcomic-2.6.4.dist-info/RECORD,,
@@ -1,18 +0,0 @@
1
- jmcomic/__init__.py,sha256=MlhEa2Xk64RfDC8-PZ-asHFihxGbrQIadAnVxppSxxY,902
2
- jmcomic/api.py,sha256=ZduhXDmh4lg1dkXHs7UTAaPpYNO7kcdPCDH5JJT9KSI,4253
3
- jmcomic/cl.py,sha256=PBSh0JndNFZw3B7WJPj5Y8SeFdKzHE00jIwYo9An-K0,3475
4
- jmcomic/jm_client_impl.py,sha256=huPWXkEizu8x7J4rAk_iQROnXphPoyadXyvN8n1ENqI,41624
5
- jmcomic/jm_client_interface.py,sha256=Bld80cYwBwIqcMSJK09g5q8U_UX3IWnQJxuRJQwmIOk,19082
6
- jmcomic/jm_config.py,sha256=2airaTXejmeSoow5cUBgHsPmmFA4m8MlqIHmT8OvWWA,17147
7
- jmcomic/jm_downloader.py,sha256=azYkIN-1OuEivZ1TGGDaYo1FkcO5KatSb0g4GVdKSPY,11041
8
- jmcomic/jm_entity.py,sha256=x-3yUvM74C_Gof20mJw2SmZq7sSSsGNg0Cp47oZ-dFg,19968
9
- jmcomic/jm_exception.py,sha256=x3KGMLlQS2zi1GX7z5G58zJN2EwLkI4mAURkxZYjEvA,5055
10
- jmcomic/jm_option.py,sha256=kErkn9-tXYp4h4lDQvc8jDYG1vqOMLIdIb3fbHvSsbA,21247
11
- jmcomic/jm_plugin.py,sha256=M-f7xty_90d3mSYmzrXSpYdua-KEBQVzGcWip1OA5gc,40345
12
- jmcomic/jm_toolkit.py,sha256=C5z7ddhacDW-WgOm-ruPshxModKwDPUczdUjUdEI9CQ,29582
13
- jmcomic-2.6.2.dist-info/licenses/LICENSE,sha256=kz4coTxZxuGxisK3W00tjK57Zh3RcMGq-EnbXrK7-xA,1064
14
- jmcomic-2.6.2.dist-info/METADATA,sha256=XIgEPt9z99CsQ7T0SRADMHE4xJ4KodtOU8gVG8F2X7E,8199
15
- jmcomic-2.6.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
- jmcomic-2.6.2.dist-info/entry_points.txt,sha256=tRbQltaGSBjejI0c9jYt-4SXQMd5nSDHcMvHmuTy4ow,44
17
- jmcomic-2.6.2.dist-info/top_level.txt,sha256=puvVMFYJqIbd6NOTMEvOyugMTT8woBfSQyxEBan3zY4,8
18
- jmcomic-2.6.2.dist-info/RECORD,,