zimscraperlib 3.3.1__tar.gz → 5.0.0__tar.gz

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.
Files changed (158) hide show
  1. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/.gitignore +13 -0
  2. zimscraperlib-5.0.0/.pre-commit-config.yaml +35 -0
  3. zimscraperlib-5.0.0/.readthedocs.yaml +17 -0
  4. zimscraperlib-5.0.0/CHANGELOG.md +619 -0
  5. zimscraperlib-5.0.0/PKG-INFO +154 -0
  6. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/README.md +31 -27
  7. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/contrib/encode_video.py +0 -3
  8. zimscraperlib-5.0.0/docs/assets/openzim.png +0 -0
  9. zimscraperlib-5.0.0/docs/functional_architecture.md +92 -0
  10. zimscraperlib-5.0.0/docs/index.md +7 -0
  11. zimscraperlib-5.0.0/docs/license.md +7 -0
  12. zimscraperlib-5.0.0/docs/scripts/generate_api_nav.py +43 -0
  13. zimscraperlib-5.0.0/docs/software_architecture.md +27 -0
  14. zimscraperlib-5.0.0/docs/technical_architecture.md +56 -0
  15. zimscraperlib-5.0.0/javascript/.prettierignore +3 -0
  16. zimscraperlib-5.0.0/javascript/.prettierrc.json +3 -0
  17. zimscraperlib-5.0.0/javascript/eslint.config.js +7 -0
  18. zimscraperlib-5.0.0/javascript/package.json +49 -0
  19. zimscraperlib-5.0.0/javascript/rollup.config.js +39 -0
  20. zimscraperlib-5.0.0/javascript/src/wombatSetup.js +310 -0
  21. zimscraperlib-5.0.0/javascript/test/wombatSetup.js +42 -0
  22. zimscraperlib-5.0.0/javascript/test/wombatUrlRewriting.js +1180 -0
  23. zimscraperlib-5.0.0/javascript/yarn.lock +2126 -0
  24. zimscraperlib-5.0.0/mkdocs.yml +92 -0
  25. zimscraperlib-5.0.0/openzim.toml +10 -0
  26. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/pyproject.toml +84 -27
  27. zimscraperlib-5.0.0/rules/generate_rules.py +180 -0
  28. zimscraperlib-5.0.0/rules/rules.yaml +214 -0
  29. zimscraperlib-5.0.0/src/zimscraperlib/__about__.py +1 -0
  30. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/__init__.py +4 -3
  31. zimscraperlib-5.0.0/src/zimscraperlib/constants.py +31 -0
  32. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/download.py +59 -55
  33. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/filesystem.py +22 -17
  34. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/fix_ogvjs_dist.py +1 -8
  35. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/html.py +10 -15
  36. zimscraperlib-5.0.0/src/zimscraperlib/i18n.py +194 -0
  37. zimscraperlib-5.0.0/src/zimscraperlib/image/__init__.py +6 -0
  38. zimscraperlib-5.0.0/src/zimscraperlib/image/conversion.py +93 -0
  39. zimscraperlib-5.0.0/src/zimscraperlib/image/optimization.py +401 -0
  40. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/image/presets.py +73 -73
  41. zimscraperlib-5.0.0/src/zimscraperlib/image/probing.py +111 -0
  42. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/image/transformation.py +24 -18
  43. zimscraperlib-5.0.0/src/zimscraperlib/image/utils.py +18 -0
  44. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/inputs.py +42 -15
  45. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/logging.py +28 -27
  46. zimscraperlib-5.0.0/src/zimscraperlib/misc.py +10 -0
  47. zimscraperlib-5.0.0/src/zimscraperlib/py.typed +0 -0
  48. zimscraperlib-5.0.0/src/zimscraperlib/rewriting/__init__.py +0 -0
  49. zimscraperlib-5.0.0/src/zimscraperlib/rewriting/css.py +242 -0
  50. zimscraperlib-5.0.0/src/zimscraperlib/rewriting/html.py +732 -0
  51. zimscraperlib-5.0.0/src/zimscraperlib/rewriting/js.py +316 -0
  52. zimscraperlib-5.0.0/src/zimscraperlib/rewriting/rules.py +57 -0
  53. zimscraperlib-5.0.0/src/zimscraperlib/rewriting/rx_replacer.py +146 -0
  54. zimscraperlib-5.0.0/src/zimscraperlib/rewriting/statics/README.md +9 -0
  55. zimscraperlib-5.0.0/src/zimscraperlib/rewriting/statics/__wb_module_decl.js +36 -0
  56. zimscraperlib-5.0.0/src/zimscraperlib/rewriting/statics/wombat.js +21 -0
  57. zimscraperlib-5.0.0/src/zimscraperlib/rewriting/statics/wombatSetup.js +3 -0
  58. zimscraperlib-5.0.0/src/zimscraperlib/rewriting/templates/head_insert.html +30 -0
  59. zimscraperlib-5.0.0/src/zimscraperlib/rewriting/url_rewriting.py +441 -0
  60. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/types.py +8 -19
  61. zimscraperlib-5.0.0/src/zimscraperlib/typing.py +60 -0
  62. zimscraperlib-5.0.0/src/zimscraperlib/uri.py +41 -0
  63. zimscraperlib-5.0.0/src/zimscraperlib/video/__init__.py +5 -0
  64. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/video/config.py +28 -35
  65. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/video/encoding.py +14 -20
  66. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/video/presets.py +24 -21
  67. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/video/probing.py +2 -5
  68. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/zim/__init__.py +6 -9
  69. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/zim/_libkiwix.py +13 -13
  70. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/zim/archive.py +16 -17
  71. zimscraperlib-5.0.0/src/zimscraperlib/zim/creator.py +468 -0
  72. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/zim/filesystem.py +147 -46
  73. zimscraperlib-5.0.0/src/zimscraperlib/zim/indexing.py +125 -0
  74. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/zim/items.py +111 -28
  75. zimscraperlib-5.0.0/src/zimscraperlib/zim/metadata.py +551 -0
  76. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/src/zimscraperlib/zim/providers.py +17 -24
  77. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tasks.py +17 -2
  78. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/conftest.py +67 -32
  79. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/download/test_download.py +90 -51
  80. zimscraperlib-5.0.0/tests/files/encrypted.pdf +0 -0
  81. zimscraperlib-5.0.0/tests/files/encrypted.txt +3 -0
  82. zimscraperlib-5.0.0/tests/files/milderm.pdf +15239 -37
  83. zimscraperlib-5.0.0/tests/files/milderm.txt +47481 -0
  84. zimscraperlib-5.0.0/tests/files/single_wave_icon.gbr +0 -0
  85. zimscraperlib-5.0.0/tests/filesystem/test_filesystem.py +103 -0
  86. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/html/conftest.py +21 -4
  87. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/html/test_html.py +8 -5
  88. zimscraperlib-5.0.0/tests/i18n/test_i18n.py +376 -0
  89. zimscraperlib-5.0.0/tests/image/test_image.py +1054 -0
  90. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/inputs/test_inputs.py +57 -27
  91. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/logging/conftest.py +2 -5
  92. zimscraperlib-5.0.0/tests/logging/test_logging.py +162 -0
  93. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/misc/test_misc.py +1 -1
  94. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/ogvjs/conftest.py +3 -6
  95. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/ogvjs/test_ogvjs.py +12 -6
  96. zimscraperlib-5.0.0/tests/rewriting/__init__.py +0 -0
  97. zimscraperlib-5.0.0/tests/rewriting/conftest.py +95 -0
  98. zimscraperlib-5.0.0/tests/rewriting/test_css_rewriting.py +218 -0
  99. zimscraperlib-5.0.0/tests/rewriting/test_fuzzy_rules.py +686 -0
  100. zimscraperlib-5.0.0/tests/rewriting/test_html_rewriting.py +1592 -0
  101. zimscraperlib-5.0.0/tests/rewriting/test_js_rewriting.py +399 -0
  102. zimscraperlib-5.0.0/tests/rewriting/test_rx_replacer.py +107 -0
  103. zimscraperlib-5.0.0/tests/rewriting/test_url_rewriting.py +1095 -0
  104. zimscraperlib-5.0.0/tests/rewriting/utils.py +35 -0
  105. zimscraperlib-5.0.0/tests/test_constants.py +13 -0
  106. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/types/test_types.py +7 -7
  107. zimscraperlib-5.0.0/tests/typing/test_typing.py +40 -0
  108. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/uri/test_uri.py +2 -23
  109. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/video/conftest.py +1 -4
  110. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/video/test_encoding.py +5 -6
  111. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/video/test_video.py +108 -45
  112. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/zim/conftest.py +16 -6
  113. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/zim/test_archive.py +11 -12
  114. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/zim/test_fs.py +83 -13
  115. zimscraperlib-5.0.0/tests/zim/test_indexing.py +366 -0
  116. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/zim/test_libkiwix.py +8 -12
  117. zimscraperlib-5.0.0/tests/zim/test_metadata.py +604 -0
  118. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/zim/test_zim_creator.py +447 -181
  119. zimscraperlib-5.0.0/yarn.lock +248 -0
  120. zimscraperlib-3.3.1/.pre-commit-config.yaml +0 -27
  121. zimscraperlib-3.3.1/CHANGELOG.md +0 -399
  122. zimscraperlib-3.3.1/PKG-INFO +0 -132
  123. zimscraperlib-3.3.1/src/zimscraperlib/__about__.py +0 -1
  124. zimscraperlib-3.3.1/src/zimscraperlib/constants.py +0 -58
  125. zimscraperlib-3.3.1/src/zimscraperlib/i18n.py +0 -212
  126. zimscraperlib-3.3.1/src/zimscraperlib/image/__init__.py +0 -11
  127. zimscraperlib-3.3.1/src/zimscraperlib/image/convertion.py +0 -56
  128. zimscraperlib-3.3.1/src/zimscraperlib/image/optimization.py +0 -301
  129. zimscraperlib-3.3.1/src/zimscraperlib/image/probing.py +0 -89
  130. zimscraperlib-3.3.1/src/zimscraperlib/image/utils.py +0 -20
  131. zimscraperlib-3.3.1/src/zimscraperlib/misc.py +0 -8
  132. zimscraperlib-3.3.1/src/zimscraperlib/uri.py +0 -55
  133. zimscraperlib-3.3.1/src/zimscraperlib/video/__init__.py +0 -9
  134. zimscraperlib-3.3.1/src/zimscraperlib/zim/creator.py +0 -402
  135. zimscraperlib-3.3.1/src/zimscraperlib/zim/metadata.py +0 -124
  136. zimscraperlib-3.3.1/tests/filesystem/test_filesystem.py +0 -71
  137. zimscraperlib-3.3.1/tests/i18n/locale/fr/LC_MESSAGES/messages.po +0 -23
  138. zimscraperlib-3.3.1/tests/i18n/locale/pt/LC_MESSAGES/messages.po +0 -24
  139. zimscraperlib-3.3.1/tests/i18n/test_i18n.py +0 -216
  140. zimscraperlib-3.3.1/tests/image/test_image.py +0 -618
  141. zimscraperlib-3.3.1/tests/logging/test_logging.py +0 -155
  142. zimscraperlib-3.3.1/tests/zim/test_metadata.py +0 -35
  143. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/LICENSE +0 -0
  144. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/contrib/README.md +0 -0
  145. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/files/DroidSans.ttf +0 -0
  146. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/files/audio.mp3 +0 -0
  147. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/files/blue.jpg +0 -0
  148. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/files/commons.png +0 -0
  149. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/files/commons48.png +0 -0
  150. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/files/mail.gif +0 -0
  151. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/files/ninja.webp +0 -0
  152. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/files/pluto.jpg +0 -0
  153. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/files/square.jpg +0 -0
  154. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/files/square.png +0 -0
  155. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/files/star.svg +0 -0
  156. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/files/video.mkv +0 -0
  157. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/files/video.mp4 +0 -0
  158. {zimscraperlib-3.3.1 → zimscraperlib-5.0.0}/tests/files/video.webm +0 -0
@@ -252,3 +252,16 @@ $RECYCLE.BIN/
252
252
  # ignore all vscode, this is not standard configuration in this place
253
253
  .vscode
254
254
  src/libzim-stubs
255
+ javascript/node_modules
256
+
257
+ # rule files are generated by rules/generate_rules.py
258
+ src/zimscraperlib/rewriting/rules.py
259
+ tests/rewriting/test_fuzzy_rules.py
260
+ javascript/src/fuzzyRules.js
261
+ javascript/test/fuzzyRules.js
262
+
263
+ # wombatSetup.js is generated with rollup
264
+ src/zimscraperlib/rewriting/statics/wombatSetup.js
265
+
266
+ # wombat.js is installed from online source
267
+ src/zimscraperlib/rewriting/statics/wombat.js
@@ -0,0 +1,35 @@
1
+ # See https://pre-commit.com for more information
2
+ # See https://pre-commit.com/hooks.html for more hooks
3
+ exclude: ^tests/files # these are raw test files, no need to mess with them
4
+ repos:
5
+ - repo: https://github.com/pre-commit/pre-commit-hooks
6
+ rev: v5.0.0
7
+ hooks:
8
+ - id: trailing-whitespace
9
+ - id: end-of-file-fixer
10
+ - repo: https://github.com/psf/black
11
+ rev: '24.10.0'
12
+ hooks:
13
+ - id: black
14
+ - repo: https://github.com/astral-sh/ruff-pre-commit
15
+ rev: v0.7.0
16
+ hooks:
17
+ - id: ruff
18
+ - repo: https://github.com/RobertCraigie/pyright-python
19
+ rev: v1.1.391
20
+ hooks:
21
+ - id: pyright
22
+ name: pyright (system)
23
+ description: 'pyright static type checker'
24
+ entry: pyright
25
+ language: system
26
+ 'types_or': [python, pyi]
27
+ require_serial: true
28
+ minimum_pre_commit_version: '2.9.2'
29
+ - repo: https://github.com/pre-commit/mirrors-prettier
30
+ rev: v3.1.0
31
+ hooks:
32
+ - id: prettier
33
+ args:
34
+ - --config
35
+ - javascript/.prettierrc.json
@@ -0,0 +1,17 @@
1
+ # Read the Docs configuration file
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3
+
4
+ version: 2
5
+
6
+ build:
7
+ os: ubuntu-24.04
8
+ tools:
9
+ python: '3.12'
10
+
11
+ # custom commands to run mkdocs build within hatch, as suggested by maintainer in
12
+ # https://github.com/readthedocs/readthedocs.org/issues/10706
13
+ commands:
14
+ - pip install hatch
15
+ - hatch run docs:build
16
+ - mkdir --parents $READTHEDOCS_OUTPUT
17
+ - mv site $READTHEDOCS_OUTPUT/html
@@ -0,0 +1,619 @@
1
+ ## Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (as of version 1.5.0).
7
+
8
+ ## [5.0.0] - 2025-01-14
9
+
10
+ This is a major release with a lot of breaking changes but most changes are easy to fix.
11
+
12
+ **In addition to item below, see content of Release Candidates for changes since 4.x.**
13
+
14
+ ### Changed
15
+
16
+ - Add support for urllib3 2.3.x #243
17
+
18
+ ## [5.0.0rc4] - 2025-01-09
19
+
20
+ ### Changed
21
+
22
+ - Mark library as typed and fix sdist content (#241)
23
+
24
+ ## [5.0.0rc3] - 2025-01-07
25
+
26
+ ### Changed
27
+
28
+ - Upgrade wombat to 3.8.7 (#239)
29
+
30
+ ## [5.0.0rc2] - 2025-01-07
31
+
32
+ ### Fixed
33
+
34
+ - Fix wombatSetup.js location in wheel (#236)
35
+
36
+ ## [5.0.0rc1] - 2025-01-07
37
+
38
+ This is a major release with a lot of breaking changes but most changes are easy to fix.
39
+
40
+ It focuses on type safety with the introduction of runtime checks: any call to zimscraperlib API must match the type definition or an exception will be raised.
41
+
42
+ Documentation is available as docstrings and on https://python-scraperlib.readthedocs.io
43
+
44
+ Main changes includes:
45
+
46
+ - ZIM metadata handling has completely changed with new types for each kind of metadata.
47
+ - `i18n` module has been redesigned around a single main class `Language`
48
+ - New `rewriting` module for HTTML/CSS/JS (that one being done at runtime via Wombat)
49
+ - Now supporting only Python 3.12
50
+
51
+ ### Added
52
+
53
+ - Documentation using `mkdocs`, published on readthedocs.com (#92)
54
+ - `rewriting` module to rewrite URLs in content for generic scrapers
55
+ - `rewriting.css` to rewrite URLs in CSS files
56
+ - `rewriting.html` to rewrite URLs in HTML files
57
+ - `rewriting.js` to rewrite URLs in JS files (at runtime, using `wombat`)
58
+ - `wombat-setup` javascript module in `javascript/`
59
+ - `typing` module with custom types:
60
+ - `Callback` to use where we expect callbacks
61
+ - `SupportsWrite`, `SupportsRead`, `SupportsSeeking` `SupportsSeekableRead` and `SupportsSeekableWrite`: protocols for IO type annotations
62
+ - `zim.metadata` module with a type-based approach for each kind of metadata and helpers for custom ones
63
+ - [`zim.metadata`] `APPLY_RECOMMENDATIONS`: general flag to toggle openZIM-recommended constraints
64
+ - [`zim.metadata`] Type-based classes: `Metadata`, `TextBasedMetadata`, `TextListBasedMetadata`, `DateBasedMetadata`, `IllustrationBasedMetadata`
65
+ - [`zim.metadata`] Usage-based classes: `NameMetadata`, `LanguageMetadata`, `DefaultIllustrationMetadata`, etc.
66
+ - [`zim.metadata`] `StandardMetadataList` to package the standard metadata
67
+ - See details for additional API endpoints and variables
68
+ - [`constants`] `DEFAULT_WEB_REQUESTS_TIMEOUT` exposed for `download` module
69
+ - [`download`] `stream_file()` now accepts `timeout: int` param (defaults to constant timeout) (#222)
70
+ - [`filesystem`] `path_from` context manager to acquire a pathlib `Path` from `Path` or `TemporaryDirectory`
71
+ - [`i18n`] `Language`, `get_language()` and `get_language_or_none()`. See breaking changes
72
+ - [`image.optimization`] `OptimizePngOptions` dataclass to store PNG options
73
+ - [`image.optimization`] `OptimizeJpgOptions` dataclass to store JPEG options
74
+ - [`image.optimization`] `OptimizeGifOptions` dataclass to store WebP options
75
+ - [`image.optimization`] `OptimizeOptions` dataclass to store cross-formats options
76
+ - [`inputs`] `unique_values()` to deduplicate a list while preserving order
77
+ - [`logging`] `DEFAULT_FORMAT_WITH_THREADS` as many scrapers uses threads
78
+ - [`video.encoding`] `reencode()`'s `existing_tmp_path` param
79
+ - [`zim.filesystem`] `validate_folder_writable()` to ensure one can write into a folder (#200)
80
+ - [`zim.creator`] `Creator._get_first_language_metadata_value()` to retrieve first language from metadata
81
+ - [`zim.items`] `no_indexing_indexdata()` to get an IndexData that disables indexing
82
+ - [`zim.items`] `URLItem.get_mimetype()` now only returning `str`
83
+
84
+ ## Changed (Breaking)
85
+
86
+ - Entire API is now type-protected using beartype. Any call to scraperlib that doesn't satisfy the annotated types will raise an exception
87
+ - [`constants`] `MANDATORY_ZIM_METADATA_KEYS` and `DEFAULT_DEV_ZIM_METADATA` moved to `zim/metadata`
88
+ - [`download`] `YoutubeDownloader.download`'s `options` parameters now expect an `dict[str, Any]` instead of `dict`
89
+ - [`download`] `YoutubeConfig` options now limited to `str | bool | int | None`
90
+ - [`download`] `_get_retry_adapter()` now exposed as `get_retry_adapter()`
91
+ - [`download`] `stream_file`'s `byte_stream' param now more flexible, accepting `SupportsWrite[bytes] | SupportsSeekableWrite[bytes]`
92
+ - [`download`] `stream_file`'s `proxies` param now accepting `dict[str, str]` instead of `dict`
93
+ - [`filesystem`] `delete_callback()` is now a simple callback accepting an `fpath` and deleting it (doesn't chain other callback anymore).
94
+ - [`filesystem`] `delete_callback()` doesn't fail on missing file (#192)
95
+ - [`i18n`] Redesigned API around a single object:
96
+ - `Language` which is inited with any acceptable code. Raises `NotFoundError` on 639-3 matching failure
97
+ - `find_language_names()` is retained but only accepts a `query: str`
98
+ - added `get_language()` and `get_language_or_none()` as shortcuts around `Language`
99
+ - `is_valid_iso_639_3()` is retained
100
+ - [`image.conversion`] `convert_image()` now accepts `io.BytesIO` in place of `IO[bytes]` for `src` and `dst`.
101
+ - [`image.conversion`] `convert_svg2png()` now accepts `io.BytesIO` in place of `IO[bytes]` for `src` and `dst`.
102
+ - [`image.optimization`] `optimize_png()` now accepts `options: OptimizePngOptions` instead of individual params.
103
+ - [`image.optimization`] `optimize_jpeg()` now accepts `options: OptimizeJpgOptions` instead of individual params.
104
+ - [`image.optimization`] `optimize_webp()` now accepts `options: OptimizeWebpOptions` instead of individual params.
105
+ - [`image.optimization`] `optimize_gif()` now accepts `options: OptimizeGifOptions` instead of individual params.
106
+ - [`image.presets`] All presets now use the new options dataclass instead of ClassVar dict
107
+ - [`image.probing`] `format_for()` now accepts `io.BytesIO` in place of `IO[bytes]` for `src`.
108
+ - [`image.probing`] `is_valid_image()` now accepts `io.BytesIO` in place of `IO[bytes]` for `image`.
109
+ - [`image.utils`] `save_image()` now accepts `io.BytesIO` in place of `IO[bytes]` for `dst`.
110
+ - [`video.config`] `Config` was mostly not using type annotations.
111
+ - [`video.config`] `Config` options only expecting `str | None`
112
+ - [`video.presets`] All options only expecting `str | None`
113
+ - [`video.encoding`] `reencode()` now always returning a `tuple[bool, CompletedProcess]`
114
+ - [`zim._libkiwix`] `MimetypeAndCounter` now expects specific types for `mimetype: str` and `value: int`
115
+ - [`zim.filesystem`] `make_zim_file()` publisher`param now properly expects an`str`
116
+ - [`zim.filesystem`] `IncorrectZIMPathError` renamed to `IncorrectPathError`
117
+ - [`zim.filesystem`] `MissingZIMFolderError` renamed to `MissingFolderError`
118
+ - [`zim.filesystem`] `NotADirectoryZIMFolderError` renamed to `NotADirectoryFolderError`
119
+ - [`zim.filesystem`] `NotWritableZIMFolderError` renamed to `NotWritableFolderError`
120
+ - [`zim.filesystem`] `IncorrectZIMFilenameError` renamed to `IncorrectFilenameError`
121
+ - [`zim.filesystem`] `validate_zimfile_creatable()` renamed to `validate_file_creatable()`
122
+ - [`zim.items`] `Item` and `StaticItem` now expecting `hints` as `dict[libzim.writer.Hint, int]` instead of `dict`
123
+ - [`zim.items`] `Item.get_hints()` now returning `dict[libzim.writer.Hint, int]` instead of `dict`
124
+ - [`zim.items`] `URLItem.download_for_size()` now specifying type annotations and reordered params
125
+ - [`zim.providers`] `FileLikeProvider.gen_blob()` and `URLProvider.gen_blob()` now properly annotates return type (`Generator[libzim.writer.Blob, None, None]`)
126
+ - [`zim.providers`] `URLProvider.get_size_of()` param `url` now explicitly expects an `str`
127
+ - [`zim.creator`] `Creator.config_metadata()` signature changed, now mainly accepting a `StandardMetadataList`
128
+ - [`zim.creator`] `Creator.config_dev_metadata()` signature changed to accept new metadata types
129
+ - [`zim.creator`] `Creator.add_item_for()`'s `callback` renamed to `callbacks` and accepting `Callback`
130
+ - [`zim.creator`] `Creator.add_item()`'s `callback` renamed to `callbacks` and accepting `Callback`
131
+
132
+ ## Changed
133
+
134
+ - [deps] `iso639-lang` now requires at least v2.4.0
135
+ - [`download`] `stream_file()` now return `tuple[int, requests.structures.CaseInsensitiveDict[str]]` instead of `tuple[int, requests.structures.CaseInsensitiveDict]`
136
+ - [`download`] `stream_file()` now accepts both `fpath` and `byte_stream` params (writes to both)
137
+ - [`image.utils`] `save_image()` now accepts `Any` `**params`.
138
+ - [`zim.archive`] `Archive.counters` now returning `CounterMap` (compatible with previous `dict[str, int]`)
139
+
140
+ ## Fixed
141
+
142
+ - Direct dependencies now properly references: pillow, urllib3, piexif, idna (#226)
143
+ - [`download`] `YoutubeDownloader.download` now respects its return type (`bool | Future[Any]`)
144
+ - [`image.conversion`] `convert_image()` `**params` properly declared as accepting `None`.
145
+ - [`logging`] `getLogger()`'s' `console` now properly accepting `TextIO | io.StringIO | None`
146
+ - [`video.probing`] `get_media_info()` type annotation for `src_path`
147
+ - [`zim.archive`] `Archive.get_item()` return type (`libzim.reader.Item`)
148
+
149
+ ## Removed
150
+
151
+ - Support for Python 3.8/3.9/3.10/3.11. Only Python 3.12 is supported now.
152
+ - [`i18n`] `Lang` (See breaking changes)
153
+ - [`i18n`] `get_iso_lang_data()` (See breaking changes)
154
+ - [`i18n`] `update_with_macro()` (See breaking changes)
155
+ - [`i18n`] `get_language_details()` (See breaking changes)
156
+ - [`uri`] `rebuild_uri` `failsafe` param (was only handling incorrect types)
157
+ - [`video.encoding`] `reencode()`'s `with_process` param
158
+ - [`zim.creator`] `Creator.validate_metadata()`
159
+ - [`zim.creator`] `Creator.convert_and_check_metadata()`
160
+
161
+ ## [4.0.0] - 2024-08-05
162
+
163
+ ### Added
164
+
165
+ - Add utility function to compute ZIM Tags #164, including deduplication #156
166
+ - Metadata does not automatically drops control characters #159
167
+ - New `indexing.IndexData` class to hold title, content and keywords to pass to libzim to index an item
168
+ - Automatically index PDF documents content #167
169
+ - Automatically set proper title on PDF documents #168
170
+ - Expose new `optimization.get_optimization_method` to get the proper optimization method to call for a given image format
171
+ - Add `optimization.get_optimization_method` to get the proper optimization method to call for a given image format
172
+ - New `creator.Creator.convert_and_check_metadata` to convert metadata to bytes or str for known use cases and check proper type is passed to libzim
173
+ - Add svg2png image conversion function #113
174
+ - Add `conversion.convert_svg2png` image conversion function + support for SVG in `probing.format_for` #113
175
+ - Add `i18n.Lang` class used as typed result of i18n operations #151
176
+
177
+ ### Changed
178
+
179
+ - **BREAKING** Renamed `zimscraperlib.image.convertion` to `zimscraperlib.image.conversion` to fix typo
180
+ - **BREAKING** Many changes in type hints to match the real underlying code
181
+ - **BREAKING** Force all boolean arguments (and some other non-obvious parameters) to be keyword-only in function calls for clarity / disambiguation (see ruff rule FBT002)
182
+ - Prefer to use `IO[bytes]` to `io.BytesIO` when possible since it is more generic
183
+ - **BREAKING** `i18n.NotFound` renamed `i18n.NotFoundError`
184
+ - **BREAKING** `types.get_mime_for_name` now returns `str | None`
185
+ - **BREAKING** `creator.Creator.add_metadata` and `creator.Creator.validate_metadata` now only accepts `bytes | str` as value (it must have been converted before call)
186
+ - **BREAKING** second argument of `creator.Creator.add_metadata` has been renamed to `value` instead of `content` to align with other methods
187
+ - When a type issue arises in metadata checks, wrong value type is displayed in exception
188
+ - **BREAKING** `i18n.get_language_details()`, `i18n.get_iso_lang_data()`, `i18n.find_language_names()` and `i18n.update_with_macro` now process / return a new typed `Lang` class #151
189
+ - **BREAKING** Rename `i18.NotFound` to `i18n.NotFoundError`
190
+
191
+ ### Removed
192
+
193
+ - **BREAKING** Remove translation features in `i18n`: `Locale` class + `_` and `setlocale` functions #134
194
+
195
+ ### Fixed
196
+
197
+ - Metadata length validation is buggy for unicode strings #158
198
+ - Pillow 10.4.0 reveals improper type hints for image probing functions #177
199
+ - Enhance error when locale fails to setup #157
200
+
201
+ ## [3.4.0] - 2024-06-21
202
+
203
+ ### Added
204
+
205
+ - `zim.creator.Creator._log_metadata()` to log (DEBUG) all metadata set on `_metadata` (prior to start()) #155
206
+ - New utility function to confirm ZIM can be created at given location / name #163
207
+
208
+ ### Changed
209
+
210
+ - Migrate the **VideoWebmLow** and **VideoWebmHigh** presets to VP9 for smaller file size #79
211
+ - New preset versions are v3 and v2 respectively
212
+ - Simplify type annotations by replacing Union and Optional with pipe character ("|") for improved readability and clarity #150
213
+ - Calling `Creator._log_metadata()` on `Creator.start()` if running in DEBUG #155
214
+
215
+ ### Fixed
216
+
217
+ - Add back the `--runinstalled` flag for test execution to allow smooth testing on other build chains #139
218
+
219
+ ## [3.3.2] - 2024-03-25
220
+
221
+ ### Added
222
+
223
+ - Add support for `disable_metadata_checks` and `ignore_duplicates` arguments in `make_zim_file` function ("zimwritefs-mode")
224
+
225
+ ### Changed
226
+
227
+ - Relaxed constraints on Python dependencies
228
+ - Upgraded optional dependencies used for test and QA
229
+
230
+ ## [3.3.1] - 2024-02-27
231
+
232
+ ### Added
233
+
234
+ - Set a user-agent for `handle_user_provided_file` #103
235
+
236
+ ### Changed
237
+
238
+ - Migrate to generic syntax in all std collections #140
239
+
240
+ ### Fixed
241
+
242
+ - Do not modify the ffmpeg_args in reencode function #144
243
+
244
+ ## [3.3.0] - 2024-02-14
245
+
246
+ ### Added
247
+
248
+ - New `disable_metadata_checks` parameter in `zimscraperlib.zim.creator.Creator` initializer, allowing to disable metadata check at startup (assuming the user will validate them on its own) #119
249
+
250
+ ### Changed
251
+
252
+ - Rework the **VideoWebmLow** preset for faster encoding and smaller file size #122
253
+ - preset has been bumped to **version 2**
254
+ - when using an S3 cache, all videos using this preset will be reencoded and uploaded to cache again (it will replace the same file encoded with preset version 1)
255
+ - When reencoding a video, ffmpeg now uses only 1 CPU thread by default (new arg to `reencode` allows to override this default value)
256
+ - Using openZIM Python bootstrap conventions (including hatch-openzim plugin) #120
257
+ - Add support for Python 3.12, drop Python 3.7 support #118
258
+ - Replace "iso-369" by "iso639-lang" library
259
+ - Replace "file-magic" by "python-magic" library for Alpine Linux support and better maintenance
260
+
261
+ ## Fixed
262
+
263
+ - Fixed type hints of `zimscraperlib.zim.Item` and subclasses, and `zimscraperlib.image.optimization:convert_image`
264
+
265
+ ## [3.2.0] - 2023-12-16
266
+
267
+ ### Added
268
+
269
+ - Add utility function to compute/check ZIM descriptions #110
270
+
271
+ ### Changed
272
+
273
+ - Using pylibzim `3.4.0`
274
+
275
+ ### Removed
276
+
277
+ - Support for Python 3.7 (EOL)
278
+
279
+ ## [3.1.1] - 2023-07-18
280
+
281
+ ### Changed
282
+
283
+ - Fixed declared (hint) return type of `download.stream_file` #104
284
+ - Fixed declared (hint) type of `content` param for `Creator.add_item_for` #107
285
+
286
+ ## [3.1.0] - 2023-05-05
287
+
288
+ ### Changed
289
+
290
+ - Using pylibzim `3.1.0`
291
+ - ZIM metadata check now allows multiple values (comma-separated) for `Language`
292
+ - Using `yt_dlp` instead of `youtube_dl`
293
+
294
+ ### Removed
295
+
296
+ - Dropped support for Python 3.6
297
+
298
+ ## [3.0.0] - 2023-03-31
299
+
300
+ ⚠️ Warning: this release introduce several API changes to `zim.creator.Creator` and `zim.filesystem.make_zim_file`
301
+
302
+ ### Added
303
+
304
+ - `zim.creator.Creator.config_metadata` method (returning Self) exposing all mandatory Metdata, all standard ones and allowing extra text metdadata.
305
+ - `zim.creator.Creator.config_dev_metadata` method setting stub metdata for all mandatory ones (allowing overrides)
306
+ - `zim.metadata` module with a list of per-metadata validation functions
307
+ - `zim.creator.Creator.validate_metadata` (called on `start`) to verify metadata respects the spec (and its recommendations)
308
+ - `zim.filesystem.make_zim_file` accepts a new optional `long_description` param.
309
+ - `i18n.is_valid_iso_639_3` to check ISO-639-3 codes
310
+ - `image.probing.is_valid_image` to check Image format and size
311
+
312
+ ### Changed
313
+
314
+ - `zim.creator.Creator` `main_path` argument now mandatory
315
+ - `zim.creator.Creator.start` now fails on missing required or invalid metadata
316
+ - `zim.creator.Creator.add_metadata` nows enforces validation checks
317
+ - `zim.filesystem.make_zim_file` renamed its `favicon_path` param to `illustration_path`
318
+ - `zim.creator.Creator.config_indexing` `language` argument now optionnal when `indexing=False`
319
+ - `zim.creator.Creator.config_indexing` now validates `language` is ISO- 639-3 when `indexing=True`
320
+
321
+ ### Removed
322
+
323
+ - `zim.creator.Creator.update_metadata`. See `.config_metadata()` instead
324
+ - `zim.creator.Creator` `language` argument. See `.config_metadata()` instead
325
+ - `zim.creator.Creator` keyword arguments. See `.config_metadata()` instead
326
+ - `zim.creator.Creator.add_default_illustration`. See `.config_metadata()` instead
327
+ - `zim.archibe.Archive.media_counter` (deprecated in `2.0.0`)
328
+
329
+ ## [2.1.0] - 2023-03-06
330
+
331
+ ## Added
332
+
333
+ - `zim.creator.Creator(language=)` can be specified as `List[str]`. `["eng", "fra"]`, `["eng"]`, `"eng,fra"`, "eng" are all valid values.
334
+
335
+ ### Changed
336
+
337
+ - Fixed `zim.providers.URLProvider` returning incomplete streams under certain circumstances (from https://github.com/openzim/kolibri/issues/40)
338
+ - Fixed `zim.creator.Creator` not supporting multiple values in for Language metadata, as required by the spec
339
+
340
+ ## [2.0.0] - 2022-12-06
341
+
342
+ - Using pylibzim v2.1.0 (using libzim 8.1.0)
343
+
344
+ ### Added
345
+
346
+ - [libzim] `Entry.get_redirect_entry()`
347
+ - [libzim] `Item.get_indexdata()` to implement custom IndexData per entry (writer)
348
+ - [libzim] `Archive.media_count`
349
+
350
+ ### Changed
351
+
352
+ - [libzim] `Archive.article_count` updated to match scraperlib's version
353
+ - `Archive.article_counter` now deprecated. Now returns `Archive.article_count`
354
+ - `Archive.media_counter` now deprecated. Now returns `Archive.media_count`
355
+
356
+ ### Removed
357
+
358
+ - [libzim] `lzma` compression algorithm
359
+
360
+ ## [1.8.0] - 2022-08-05
361
+
362
+ ### Added
363
+
364
+ - `download.get_session()` to build a new requests Session
365
+
366
+ ### Changed
367
+
368
+ - `download.stream_file()` accepts a `session` param to use instead of creating one
369
+
370
+ ## [1.7.0] - 2022-08-02
371
+
372
+ ### Added
373
+
374
+ - `zim.Creator` now supports `ignore_duplicates: bool` parameter to
375
+ prevent duplicates from raising exceptions
376
+ - `zim.Creator.add_item`, `zim.Creator.add_redirect` and `zim.Creator.add_item_for`
377
+ now supports a `duplicate_ok: bool` parameter to prevent an exception
378
+ should this item/redirect be a duplicate
379
+
380
+ ## [1.6.3] - 2022-08-02
381
+
382
+ ### Added
383
+
384
+ - `download.stream_file()` supports passing `headers` (scrapers were already using it)
385
+
386
+ ## [1.6.2] - 2022-07-29
387
+
388
+ ### Changed
389
+
390
+ - Fixed `filesystem.get_content_mimetype()` crashing on non-guessable byte stream
391
+
392
+ ## [1.6.1] - 2022-07-26
393
+
394
+ ### Changed
395
+
396
+ - Wider range of accepted lxml dependency version as 4.9.1 fixes a security issue
397
+
398
+ ## [1.6.0] - 2022-05-23
399
+
400
+ ## Added
401
+
402
+ - `Archive.get_metadata_item()` to retrieve full item instead of just value
403
+
404
+ ### Changed
405
+
406
+ - Using pylibzim v1.1.0 (using libzim 7.2.1)
407
+ - Adding duplicate entries now raises RuntimeError
408
+ - filesize is fixed for larger ZIMs
409
+
410
+ ## [1.5.0] - 2022-05-09
411
+
412
+ ### Added
413
+
414
+ - `zim.Archive.tags` and `zim.Archive.get_tags()` to retrieve parsed Tags
415
+ with optionnal `libkiwix` param to include libkiwix's hints
416
+ - [tests] Counter tests now also uses a libzim6 file.
417
+
418
+ ### Changed
419
+
420
+ - `zim.Archive.article_counter` follows libkiwix's new bahavior of
421
+ returning libzim's `article_count` for libzim 7+ ZIMs and
422
+ returning previously returned (parsed) value for older ZIMs.
423
+
424
+ ### Removed
425
+
426
+ - Unreachable code removed in `imaging` module.
427
+ - [tests] “Sanskrit” removed from tests as output not predicatble depending on plaftform.
428
+
429
+ ## [1.4.3]
430
+
431
+ - `zim.Archive.counters` wont fail on missing `Counter` metadata
432
+
433
+ ## [1.4.2]
434
+
435
+ - Fixed leak in `zim.Archive`'s `.counters`
436
+ - New `.get_text_metadata()` method on `zim.Archive` to save UTF-8 decoding
437
+
438
+ ## [1.4.1]
439
+
440
+ - New `Counter` metadata based properties for Archive:
441
+ - `.counters`: parsed dict of the Counter metadata
442
+ - `.article_counter`: libkiwix's calculation for nb or article
443
+ - `.media_counter`: libkiwix's calculation for nb or media
444
+ - Fixed `i18n.find_language_names()` failing on some languages
445
+ - Added `uri` module with `rebuild_uri()`
446
+
447
+ ## [1.4.0]
448
+
449
+ - Using new python-libzim based on libzim v7
450
+ - New Creator API
451
+ - Removed all namespace references
452
+ - Renamed `url` mentions to `path`
453
+ - Removed all links rewriting
454
+ - Removed Article/CSS/Binary seggreation
455
+ - Kept zimwriterfs mode (except it doesn't rewrite for namespaces)
456
+ - New `html` module for HTML document manipulations
457
+ - New callback system on `add_item_for()` and `add_item()`
458
+ - New Archive API with easier search/suggestions and content access
459
+ - Changed download log level to DEBUG (was INFO)
460
+ - `filesystem.get_file_mimetype` now passes bytes to libmagic instead of filename due to release issue in libmagic
461
+ - safer `inputs.handle_user_provided_file` regarding input as str instead of Path
462
+ - `image.presets` and `video.presets` now all includes `ext` and `mimetype` properties
463
+ - Video convert log now DEBUG instead of INFO
464
+ - Fixed `image.save_image()` saving to disk even when using a bytes stream
465
+ - Fixed `image.transformation.resize_image()` when resizing a byte stream without a dst
466
+
467
+ ## [1.3.6 (internal)]
468
+
469
+ Intermediate release using unreleased libzim to support development of libzim7.
470
+ Don't use it.
471
+
472
+ - requesting newer libzim version (not released ATM)
473
+ - New ZIM API for non-namespace libzim (v7)
474
+ - updated all requirements
475
+ - Fixed download test inconsistency
476
+ - fix_ogvjs mostly useless: only allows webm types
477
+ - exposing retry_adapter for refactoring
478
+ - Changed download log level to DEBUG (was INFO)
479
+ - guess more-defined mime from filename if magic says it's text
480
+ - get_file_mimetype now passes bytes to libmagic
481
+ - safer regarding input as str instead of Path
482
+ - fixed static item for empty content
483
+ - ext and mimetype properties for all presets
484
+ - Video convert log now DEBUG instead of INFO
485
+ - Added delete_fpath to add_item_for() and fixed StaticItem's auto remove
486
+ - Updated badges for new repo name
487
+
488
+ ## [1.3.5]
489
+
490
+ - add `stream_file()` to stream content from a URL into a file or a `BytesIO` object
491
+ - deprecated `save_file()`
492
+ - fixed `add_binary` when used without an fpath (#69)
493
+ - deprecated `make_grayscale` option in image optimization
494
+ - Added support for in-memory optimization for PNG, JPEG, and WebP images
495
+ - allows enabling debug logs via ZIMSCRAPERLIB_DEBUG environ
496
+
497
+ ## [1.3.4]
498
+
499
+ - added `wait` option in `YoutubeDownloader` to allow parallelism while using context manager
500
+ - do not use extension for finding format in `ensure_matches()` in `image.optimization` module
501
+ - added `VideoWebmHigh` and `VideoMp4High` presets for high quality WebM and Mp4 convertion respectively
502
+ - updated presets `WebpHigh`, `JpegMedium`, `JpegLow` and `PngMedium` in `image.presets`
503
+ - `save_image` moved from `image` to `image.utils`
504
+ - added `convert_image` `optimize_image` `resize_image` functions to `image` module
505
+
506
+ ## [1.3.3]
507
+
508
+ - added `YoutubeDownloader` to `download` to download YT videos using a capped nb of threads
509
+
510
+ ## [1.3.2]
511
+
512
+ - fixed rewriting of links with empty target
513
+ - added support for image optimization using `zimscraperlib.image.optimization` for webp, gif, jpeg and png formats
514
+ - added `format_for()` in `zimscraperlib.image.probing` to get PIL image format from the suffix
515
+
516
+ ## [1.3.1]
517
+
518
+ - replaced BeautifoulSoup parser in rewriting (`html.parser` –> `lxml`)
519
+
520
+ ## [1.3.0]
521
+
522
+ - detect mimetypes from filenames for all text files
523
+ - fixed non-filename based StaticArticle
524
+ - enable rewriting of links in poster attribute of audio element
525
+ - added find_language_in() and find_language_in_file() to get language from HTML content and HTML file respectively
526
+ - add a mime mapping to deal with inconsistencies in mimetypes detected by magic on different platforms
527
+ - convert_image signature changed:
528
+ - `target_format` positional argument removed. Replaced with optionnal `fmt` key of keyword arguments.
529
+ - `colorspace` optionnal positional argument removed. Replaced with optionnal `colorspace` key of keyword arguments.
530
+ - prevent rewriting of links with special schemes `mailto`, 'tel', etc. in HTML links rewriting
531
+ - replaced `imaging` module with exploded `image` module (`convertion`, `probing`, `transformation`)
532
+ - changed `create_favicon()` param names (`source_image` -> `src`, `dest_ico` -> `dst`)
533
+ - changed `save_image()` param names (`image` -> `src`)
534
+ - changed `get_colors()` param names (`image_path` -> `src`)
535
+ - changed `resize_image()` param names (`fpath` -> `src`)
536
+
537
+ ## [1.2.1]
538
+
539
+ - fixed URL rewriting when running from /
540
+ - added support for link rewriting in `<object>` element
541
+ - prevent from raising error if element doesn't have the attribute with url
542
+ - use non greedy match for CSS URL links (shortest string matching `url()` format)
543
+ - fix namespace of target only if link doesn't have a netloc
544
+
545
+ ## [1.2.0]
546
+
547
+ - added UTF8 to constants
548
+ - added mime_type discovery via magic (filesystem)
549
+ - Added types: mime types guessing from file names
550
+ - Revamped zim API
551
+ - Removed ZimInfo which role was tu hold metadata for zimwriterfs call
552
+ - Removed calling zimwriterfs binary but kept function name
553
+ - Added zim.filesystem: zimwriterfs-like creation from a build folder
554
+ - Added zim.creator: create files by manually adding each article
555
+ - Added zim.rewriting: tools to rewrite links/urls in HTML/CSS
556
+ - add timeout and retries to save_file() and make it return headers
557
+
558
+ ## [1.1.2]
559
+
560
+ - fixed `convert_image()` which tried to use a closed file
561
+
562
+ ## [1.1.1]
563
+
564
+ - exposed reencode, Config and get_media_info in zimscraperlib.video
565
+ - added save_image() and convert_image() in zimscraperlib.imaging
566
+ - added support for upscaling in resize_image() via allow_upscaling
567
+ - resize_image() now supports params given by user and preservs image colorspace
568
+ - fixed tests for zimscraperlib.imaging
569
+
570
+ ## [1.1.0]
571
+
572
+ - added video module with reencode, presets, config builder and video file probing
573
+ - `make_zim_file()` accepts extra kwargs for zimwriterfs
574
+
575
+ ## [1.0.6]
576
+
577
+ - added translation support to i18n
578
+
579
+ ## [1.0.5]
580
+
581
+ - added s3transfer to verbose dependencies list
582
+ - changed default log format to include module name
583
+
584
+ ## [1.0.4]
585
+
586
+ - verbose dependencies (urllib3, boto3) now logged at WARNING level by default
587
+ - ability to set verbose dependencies log level and add modules to the list
588
+ - zimscraperlib's logging level now aligned with scraper's requested one
589
+
590
+ ## [1.0.3]
591
+
592
+ - fix_ogvjs_dist script more generic (#1)
593
+ - updated zim to support other zimwriterfs params (#10)
594
+ - more flexible requirements for requests dependency
595
+
596
+ ## [1.0.2]
597
+
598
+ - fixed return value of `get_language_details` on non-existent language
599
+ - fixed crash on `resize_image` with method `height`
600
+ - fixed root logger level (now DEBUG)
601
+ - removed useless `console=True` `getLogger` param
602
+ - completed tests (100% coverage)
603
+ - added `./test` script for quick local testing
604
+ - improved tox.ini
605
+ - added `create_favicon` to generate a squared favicon
606
+ - added `handle_user_provided_file` to handle user file/URL from param
607
+
608
+ ## [1.0.1]
609
+
610
+ - fixed fix_ogvjs_dist
611
+
612
+ ## [1.0.0]
613
+
614
+ - initial version providing
615
+ - download: save_file, save_large_file
616
+ - fix_ogvjs_dist
617
+ - i18n: setlocale, get_language_details
618
+ - imaging: get_colors, resize_image, is_hex_color
619
+ - zim: ZimInfo, make_zim_file