warc2zim 2.2.0__tar.gz → 2.2.2__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 (185) hide show
  1. {warc2zim-2.2.0 → warc2zim-2.2.2}/.pre-commit-config.yaml +4 -18
  2. {warc2zim-2.2.0 → warc2zim-2.2.2}/CHANGELOG.md +13 -0
  3. {warc2zim-2.2.0 → warc2zim-2.2.2}/Dockerfile +1 -1
  4. {warc2zim-2.2.0 → warc2zim-2.2.2}/PKG-INFO +21 -19
  5. {warc2zim-2.2.0 → warc2zim-2.2.2}/contrib/cleanup_log.py +2 -1
  6. {warc2zim-2.2.0 → warc2zim-2.2.2}/contrib/html_convert.py +7 -4
  7. {warc2zim-2.2.0 → warc2zim-2.2.2}/contrib/marxists.org.py +3 -3
  8. warc2zim-2.2.2/docs/software_architecture.md +26 -0
  9. {warc2zim-2.2.0 → warc2zim-2.2.2}/pyproject.toml +16 -16
  10. warc2zim-2.2.2/src/warc2zim/__about__.py +1 -0
  11. warc2zim-2.2.2/src/warc2zim/cdxj_indexer/__init__.py +9 -0
  12. warc2zim-2.2.2/src/warc2zim/cdxj_indexer/bufferiter.py +130 -0
  13. warc2zim-2.2.2/src/warc2zim/cdxj_indexer/main.py +17 -0
  14. warc2zim-2.2.2/src/warc2zim/cdxj_indexer/postquery.py +173 -0
  15. {warc2zim-2.2.0 → warc2zim-2.2.2}/src/warc2zim/constants.py +1 -1
  16. {warc2zim-2.2.0 → warc2zim-2.2.2}/src/warc2zim/converter.py +5 -5
  17. {warc2zim-2.2.0 → warc2zim-2.2.2}/src/warc2zim/items.py +1 -1
  18. {warc2zim-2.2.0 → warc2zim-2.2.2}/src/warc2zim/rewriting.py +1 -1
  19. warc2zim-2.2.2/tests/cdxj_indexer/test_postappend.py +203 -0
  20. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/test_utils.py +1 -1
  21. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/test_warc_to_zim.py +2 -1
  22. warc2zim-2.2.0/src/warc2zim/__about__.py +0 -1
  23. {warc2zim-2.2.0 → warc2zim-2.2.2}/.eslintrc.json +0 -0
  24. {warc2zim-2.2.0 → warc2zim-2.2.2}/.gitignore +0 -0
  25. {warc2zim-2.2.0 → warc2zim-2.2.2}/LICENSE +0 -0
  26. {warc2zim-2.2.0 → warc2zim-2.2.2}/README.md +0 -0
  27. {warc2zim-2.2.0 → warc2zim-2.2.2}/src/warc2zim/__init__.py +0 -0
  28. {warc2zim-2.2.0 → warc2zim-2.2.2}/src/warc2zim/icon_finder.py +0 -0
  29. {warc2zim-2.2.0 → warc2zim-2.2.2}/src/warc2zim/language.py +0 -0
  30. {warc2zim-2.2.0 → warc2zim-2.2.2}/src/warc2zim/main.py +0 -0
  31. {warc2zim-2.2.0 → warc2zim-2.2.2}/src/warc2zim/templates/head_insert.html +0 -0
  32. {warc2zim-2.2.0 → warc2zim-2.2.2}/src/warc2zim/utils.py +0 -0
  33. {warc2zim-2.2.0 → warc2zim-2.2.2}/tasks.py +0 -0
  34. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/Caddyfile +0 -0
  35. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/Dockerfile +0 -0
  36. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/README.md +0 -0
  37. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/audio.html +0 -0
  38. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/bad-encoding.html +0 -0
  39. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/bad-redirections.html +0 -0
  40. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/base-href/image1.png +0 -0
  41. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/base-href/something.html +0 -0
  42. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/base-href.html +0 -0
  43. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/chinese-encoding.html +0 -0
  44. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/content-types/content1.json +0 -0
  45. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/content-types/content2.json +0 -0
  46. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/content-types/image1.png +0 -0
  47. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/content-types/image2.png +0 -0
  48. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/content-types/index.html +0 -0
  49. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/content-types/script1.js +0 -0
  50. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/content-types/script2.js +0 -0
  51. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/content-types/small.pdf +0 -0
  52. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/content-types/style1.css +0 -0
  53. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/content-types/style2.css +0 -0
  54. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/css-broken-file.css +0 -0
  55. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/css-broken-file.html +0 -0
  56. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/css-inline-broken.html +0 -0
  57. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/dailymotion.html +0 -0
  58. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/double-slash.html +0 -0
  59. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/facebook1.html +0 -0
  60. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/facebook2.html +0 -0
  61. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/form-get-1.html +0 -0
  62. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/form-get-2.html +0 -0
  63. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/form-get-3.html +0 -0
  64. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/form-get-4.html +0 -0
  65. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/form-get.html +0 -0
  66. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/full.html +0 -0
  67. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/href-to-folder/index.html +0 -0
  68. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/http-equiv-redirect.html +0 -0
  69. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/http-return-codes.html +0 -0
  70. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/icons/android-chrome-192x192.png +0 -0
  71. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/icons/android-chrome-512x512.png +0 -0
  72. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/icons/apple-touch-icon.png +0 -0
  73. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/icons/favicon-16x16.png +0 -0
  74. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/icons/favicon-32x32.png +0 -0
  75. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/icons/favicon.ico +0 -0
  76. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/icons/site.webmanifest +0 -0
  77. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/image-srcset.html +0 -0
  78. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/image1-1x.png +0 -0
  79. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/image1-2x.png +0 -0
  80. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/image1.png +0 -0
  81. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/image2-1x.png +0 -0
  82. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/image2-2x.png +0 -0
  83. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/image2.png +0 -0
  84. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/image3-high.png +0 -0
  85. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/image3-medium.png +0 -0
  86. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/image3-small.png +0 -0
  87. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/image3.png +0 -0
  88. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/image4-1.5x.png +0 -0
  89. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/image4.png +0 -0
  90. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/urlencoding1_ico/314/202ne-de/314/201buter-Solidarite/314/201-Nume/314/201rique_1@300x.png" +0 -0
  91. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/urlencoding2_ico%CC%82ne-de%CC%81buter-Solidarite%CC%81-Nume%CC%81rique_1%40300x.png +0 -0
  92. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/urlencoding3_ico/314/202ne-de/314/201buter-Solidarite%CC%81-Nume%CC%81rique_1@300x.png" +0 -0
  93. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/urlencoding4_(_[_|_]_).png +0 -0
  94. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/urlencoding4_/330/274.png" +0 -0
  95. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/urlencoding5_(_[_|_/330/274_]_).png" +0 -0
  96. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/urlencoding5_(_[_|_/330/274_]_)_1.png" +0 -0
  97. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/images/urlencoding5_(_[_|_/330/274_]_)_2.png" +0 -0
  98. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/index.html +0 -0
  99. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/instagram.html +0 -0
  100. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/internal_redirect_target.html +0 -0
  101. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/cont!nt.txt +0 -0
  102. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/cont?nt.txt +0 -0
  103. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/content.txt +0 -0
  104. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/cont/303/251nt.txt" +0 -0
  105. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/cont/360/237/216/201nt.txt" +0 -0
  106. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/not_working.png +0 -0
  107. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/r?sources.js +0 -0
  108. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/resources.js +0 -0
  109. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/r/303/251sources.js" +0 -0
  110. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script02!b.js +0 -0
  111. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script02a.js +0 -0
  112. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script03.js +0 -0
  113. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script04.js +0 -0
  114. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script05.js +0 -0
  115. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script06a.js +0 -0
  116. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script06b.js +0 -0
  117. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script06c.js +0 -0
  118. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script06d.js +0 -0
  119. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script06e.js +0 -0
  120. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script06f.js +0 -0
  121. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script06g.js +0 -0
  122. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script06h.js +0 -0
  123. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script06i.js +0 -0
  124. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script06j.js +0 -0
  125. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script07.js +0 -0
  126. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script08a.js +0 -0
  127. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script08b.js +0 -0
  128. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script08c.js +0 -0
  129. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script09a.js +0 -0
  130. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script09b.js +0 -0
  131. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script09c.js +0 -0
  132. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script09d.js +0 -0
  133. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/script10.js +0 -0
  134. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript/working.png +0 -0
  135. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/javascript.html +0 -0
  136. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/j/303/240v/303/240scr/303/257pt.html" +0 -0
  137. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/mediaelement.html +0 -0
  138. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/onxxx.html +0 -0
  139. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/soundcloud.html +0 -0
  140. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/spotify.html +0 -0
  141. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/tiktok.html +0 -0
  142. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/twitch1.html +0 -0
  143. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/twitch2.html +0 -0
  144. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/twitter1.html +0 -0
  145. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/twitter2.html +0 -0
  146. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/url-encoding.html +0 -0
  147. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/video.html +0 -0
  148. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/vimeo.html +0 -0
  149. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/content/youtube.html +0 -0
  150. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/entrypoint-reverse.sh +0 -0
  151. {warc2zim-2.2.0 → warc2zim-2.2.2}/test-website/entrypoint.sh +0 -0
  152. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/__init__.py +0 -0
  153. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/data/bad-redirections.warc.gz +0 -0
  154. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/data/content-resource-types.warc.gz +0 -0
  155. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/data/empty-file +0 -0
  156. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/data/example-response.warc +0 -0
  157. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/data/example-revisit.warc.gz +0 -0
  158. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/data/example-utf8.warc +0 -0
  159. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/data/example-with-timestamp.warc +0 -0
  160. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/data/http-return-codes.warc.gz +0 -0
  161. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/data/kiwix-with-redirects.warc.gz +0 -0
  162. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/data/main-entry-403.warc.gz +0 -0
  163. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/data/self-redirect.warc +0 -0
  164. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/data/single-page-test.warc +0 -0
  165. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/data/solidaritenum.warc.gz +0 -0
  166. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/data/video-vimeo.warc.gz +0 -0
  167. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/data/video-yt-2.warc.gz +0 -0
  168. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/data/video-yt.warc.gz +0 -0
  169. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/data-special/icons.html +0 -0
  170. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/data-special/qsl.net-encoding-alias.warc.gz +0 -0
  171. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/encodings/definition.json +0 -0
  172. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/encodings/file01.js +0 -0
  173. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/encodings/file02.js +0 -0
  174. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/encodings/file03.html +0 -0
  175. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/encodings/file04.js +0 -0
  176. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/encodings/file05.js +0 -0
  177. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/encodings/file06.html +0 -0
  178. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/encodings/file07.html +0 -0
  179. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/encodings/file08.js +0 -0
  180. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/test_converter.py +0 -0
  181. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/test_icon_finder.py +0 -0
  182. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/test_language.py +0 -0
  183. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/test_metadata_validation.py +0 -0
  184. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/test_rewriting.py +0 -0
  185. {warc2zim-2.2.0 → warc2zim-2.2.2}/tests/utils.py +0 -0
@@ -2,20 +2,20 @@
2
2
  # See https://pre-commit.com/hooks.html for more hooks
3
3
  repos:
4
4
  - repo: https://github.com/pre-commit/pre-commit-hooks
5
- rev: v4.4.0
5
+ rev: v5.0.0
6
6
  hooks:
7
7
  - id: trailing-whitespace
8
8
  - id: end-of-file-fixer
9
9
  - repo: https://github.com/psf/black
10
- rev: "24.10.0"
10
+ rev: "25.1.0"
11
11
  hooks:
12
12
  - id: black
13
13
  - repo: https://github.com/astral-sh/ruff-pre-commit
14
- rev: v0.8.4
14
+ rev: v0.9.6
15
15
  hooks:
16
16
  - id: ruff
17
17
  - repo: https://github.com/RobertCraigie/pyright-python
18
- rev: v1.1.391
18
+ rev: v1.1.394
19
19
  hooks:
20
20
  - id: pyright
21
21
  name: pyright (system)
@@ -25,17 +25,3 @@ repos:
25
25
  'types_or': [python, pyi]
26
26
  require_serial: true
27
27
  minimum_pre_commit_version: '2.9.2'
28
- - repo: https://github.com/pre-commit/mirrors-prettier
29
- rev: v3.1.0
30
- hooks:
31
- - id: prettier
32
- files: javascript\/.*$ # files in javascript folder
33
- args:
34
- - --config
35
- - javascript/.prettierrc.json
36
- - repo: https://github.com/pre-commit/mirrors-eslint
37
- rev: v8.51.0
38
- hooks:
39
- - id: eslint
40
- types: [file]
41
- files: javascript\/src\/.*(?:\.[jt]sx?|\.vue)$ # *.js, *.jsx, *.ts, *.tsx, *.vue in javascript/src folder
@@ -5,6 +5,19 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (as of version 1.4.0).
7
7
 
8
+ ## [2.2.2] - 2024-02-17
9
+
10
+ ### Changed
11
+
12
+ - Upgrade dependencies especially zimscraperlib 5.1.1 (#439)
13
+
14
+ ## [2.2.1] - 2024-02-07
15
+
16
+ ### Changed
17
+
18
+ - Upgrade dependencies: Python 3.13, zimscraperlib 5.1.0 and others (#434)
19
+ - Fork cdxj_indexer codebase (#428)
20
+
8
21
  ## [2.2.0] - 2024-01-10
9
22
 
10
23
  ### Changed
@@ -1,4 +1,4 @@
1
- FROM python:3.12-slim-bookworm
1
+ FROM python:3.13-slim-bookworm
2
2
  LABEL org.opencontainers.image.source=https://github.com/openzim/warc2zim
3
3
 
4
4
  RUN apt-get update -y \
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: warc2zim
3
- Version: 2.2.0
3
+ Version: 2.2.2
4
4
  Summary: Convert WARC to ZIM
5
5
  Project-URL: Donate, https://www.kiwix.org/en/support-us/
6
6
  Project-URL: Homepage, https://github.com/openzim/warc2zim
@@ -10,34 +10,36 @@ License-File: LICENSE
10
10
  Keywords: offline,openzim,warc,zim
11
11
  Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
12
12
  Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.12
14
- Requires-Python: <3.13,>=3.12
15
- Requires-Dist: beautifulsoup4==4.12.3
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Requires-Python: <3.14,>=3.13
15
+ Requires-Dist: beautifulsoup4==4.13.3
16
16
  Requires-Dist: brotlipy==0.7.0
17
- Requires-Dist: cdxj-indexer==1.4.6
18
- Requires-Dist: jinja2==3.1.4
19
- Requires-Dist: lxml==5.3.0
17
+ Requires-Dist: jinja2==3.1.5
18
+ Requires-Dist: lxml==5.3.1
19
+ Requires-Dist: multipart==1.2.1
20
20
  Requires-Dist: python-dateutil==2.9.0.post0
21
21
  Requires-Dist: requests==2.32.3
22
22
  Requires-Dist: tinycss2==1.4.0
23
23
  Requires-Dist: warcio==1.7.5
24
- Requires-Dist: zimscraperlib==5.0.0rc3
24
+ Requires-Dist: zimscraperlib==5.1.1
25
25
  Provides-Extra: check
26
- Requires-Dist: pyright==1.1.391; extra == 'check'
26
+ Requires-Dist: pyright==1.1.394; extra == 'check'
27
27
  Provides-Extra: dev
28
- Requires-Dist: debugpy==1.8.11; extra == 'dev'
29
- Requires-Dist: pre-commit==4.0.1; extra == 'dev'
30
- Requires-Dist: warc2zim[check]; extra == 'dev'
31
- Requires-Dist: warc2zim[lint]; extra == 'dev'
32
- Requires-Dist: warc2zim[scripts]; extra == 'dev'
33
- Requires-Dist: warc2zim[test]; extra == 'dev'
28
+ Requires-Dist: black==25.1.0; extra == 'dev'
29
+ Requires-Dist: coverage==7.6.12; extra == 'dev'
30
+ Requires-Dist: debugpy==1.8.12; extra == 'dev'
31
+ Requires-Dist: invoke==2.2.0; extra == 'dev'
32
+ Requires-Dist: pre-commit==4.1.0; extra == 'dev'
33
+ Requires-Dist: pyright==1.1.394; extra == 'dev'
34
+ Requires-Dist: pytest==8.3.4; extra == 'dev'
35
+ Requires-Dist: ruff==0.9.6; extra == 'dev'
34
36
  Provides-Extra: lint
35
- Requires-Dist: black==24.10.0; extra == 'lint'
36
- Requires-Dist: ruff==0.8.4; extra == 'lint'
37
+ Requires-Dist: black==25.1.0; extra == 'lint'
38
+ Requires-Dist: ruff==0.9.6; extra == 'lint'
37
39
  Provides-Extra: scripts
38
40
  Requires-Dist: invoke==2.2.0; extra == 'scripts'
39
41
  Provides-Extra: test
40
- Requires-Dist: coverage==7.6.9; extra == 'test'
42
+ Requires-Dist: coverage==7.6.12; extra == 'test'
41
43
  Requires-Dist: pytest==8.3.4; extra == 'test'
42
44
  Description-Content-Type: text/markdown
43
45
 
@@ -2,8 +2,9 @@ import re
2
2
  import sys
3
3
  from pathlib import Path
4
4
 
5
+ from zimscraperlib.rewriting.url_rewriting import ZimPath
6
+
5
7
  from warc2zim.constants import logger
6
- from warc2zim.url_rewriting import ZimPath
7
8
 
8
9
 
9
10
  def notify(_: ZimPath):
@@ -1,4 +1,4 @@
1
- """ html rewrite test utility
1
+ """html rewrite test utility
2
2
 
3
3
  This utility takes a given HTML content as input, base64 encoded, its original URL, and
4
4
  rewrites its content.
@@ -17,9 +17,10 @@ import logging
17
17
  import sys
18
18
  from pathlib import Path
19
19
 
20
+ from zimscraperlib.rewriting.html import HtmlRewriter
21
+ from zimscraperlib.rewriting.url_rewriting import ArticleUrlRewriter, HttpUrl, ZimPath
22
+
20
23
  from warc2zim.constants import logger
21
- from warc2zim.content_rewriting.html import HtmlRewriter
22
- from warc2zim.url_rewriting import ArticleUrlRewriter, HttpUrl, ZimPath
23
24
  from warc2zim.utils import to_string
24
25
 
25
26
 
@@ -37,7 +38,9 @@ def main(path_to_content: str, article_url: str, encoding: str | None = None):
37
38
  content = Path(path_to_content)
38
39
 
39
40
  url_rewriter = ArticleUrlRewriter(
40
- HttpUrl(article_url), existing_zim_paths=set(), missing_zim_paths=set()
41
+ article_url=HttpUrl(article_url),
42
+ existing_zim_paths=set(),
43
+ missing_zim_paths=set(),
41
44
  )
42
45
 
43
46
  html_rewriter = HtmlRewriter(url_rewriter, "", None, notify)
@@ -1,4 +1,4 @@
1
- """ MIA English exclude list
1
+ """MIA English exclude list
2
2
 
3
3
  This utility computes the list of all subpages/languages that must be ignored for the
4
4
  English ZIM of The Marxists Internet Archive (MIA) at www.marxists.org.
@@ -23,9 +23,9 @@ soup = BeautifulSoup(resp.text, "html.parser")
23
23
  subfolders = set()
24
24
  REGEX = re.compile(r"\.\.\/(?P<subfolder>.*?)\/")
25
25
  for anchor in soup.find_all("a"):
26
- if not anchor.has_attr("href"):
26
+ if not anchor.has_attr("href"): # pyright: ignore
27
27
  continue
28
- if match := REGEX.match(anchor["href"]):
28
+ if match := REGEX.match(anchor["href"]): # pyright: ignore
29
29
  subfolders.add(match.group("subfolder"))
30
30
 
31
31
  print("|".join(sorted(subfolders))) # noqa: T201
@@ -0,0 +1,26 @@
1
+ # Software architecture
2
+
3
+ ## cdxj_indexer and warcio
4
+
5
+ [cdxj_indexer Python library](https://pypi.org/project/cdxj-indexer/) is a thin wrapper over [warcio Python library](https://pypi.org/project/warcio/). It used to iterate all record in WARCs.
6
+
7
+ It provide two main features:
8
+
9
+ - Loop over several WARCs in a directory (A visit of a website may be stored in several WARCs in the same directory).
10
+ - Provide a buffered access to warcs content (and not a "stream" (fileio) only api) (but monkey patching returned WarcRecord.
11
+
12
+ Except that, scraper directly uses WarcRecord (returned by cdxj_indexer, implemented in warcio) to access metadata and such.
13
+
14
+ cdxj_indexer usefull methods are currently forked in warc2zim, see https://github.com/openzim/warc2zim/pull/428 for details.
15
+
16
+ ## zimscraperlib
17
+
18
+ [zimscraperlib Python library](https://pypi.org/project/zimscraperlib) is used for ZIM operations and for all HTML / CSS / JS rewriting operations (mostly around URL manipulations, but not only).
19
+
20
+ ## requests
21
+
22
+ [requests Python library](https://pypi.org/project/requests/) is used to retrieve the custom CSS file when a URL is passed.
23
+
24
+ ## brotlipy
25
+
26
+ [brotlipy Python library](https://pypi.org/project/brotlipy/) is used to access brotli content in WARC records (not part of warcio because it is an optional dependency).
@@ -1,24 +1,24 @@
1
1
  [build-system]
2
- requires = ["hatchling", "hatch-openzim==0.2.1"]
2
+ requires = ["hatchling", "hatch-openzim"]
3
3
  build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "warc2zim"
7
- requires-python = ">=3.12,<3.13"
7
+ requires-python = ">=3.13,<3.14"
8
8
  description = "Convert WARC to ZIM"
9
9
  readme = "README.md"
10
10
  dependencies = [
11
11
  "warcio==1.7.5",
12
12
  "requests==2.32.3",
13
- "zimscraperlib==5.0.0rc3",
14
- "jinja2==3.1.4", # also update version in build-system above and in build_js.sh
13
+ "zimscraperlib==5.1.1",
14
+ "jinja2==3.1.5",
15
15
  # to support possible brotli content in warcs, must be added separately
16
16
  "brotlipy==0.7.0",
17
- "cdxj_indexer==1.4.6",
18
17
  "tinycss2==1.4.0",
19
- "beautifulsoup4==4.12.3", # used to parse base href
20
- "lxml==5.3.0", # used by beautifulsoup4 for parsing html
18
+ "beautifulsoup4==4.13.3", # used to parse base href
19
+ "lxml==5.3.1", # used by beautifulsoup4 for parsing html
21
20
  "python-dateutil==2.9.0.post0",
21
+ "multipart==1.2.1",
22
22
  ]
23
23
  dynamic = ["authors", "classifiers", "keywords", "license", "version", "urls"]
24
24
 
@@ -35,19 +35,19 @@ scripts = [
35
35
  "invoke==2.2.0",
36
36
  ]
37
37
  lint = [
38
- "black==24.10.0",
39
- "ruff==0.8.4",
38
+ "black==25.1.0",
39
+ "ruff==0.9.6",
40
40
  ]
41
41
  check = [
42
- "pyright==1.1.391",
42
+ "pyright==1.1.394",
43
43
  ]
44
44
  test = [
45
45
  "pytest==8.3.4",
46
- "coverage==7.6.9",
46
+ "coverage==7.6.12",
47
47
  ]
48
48
  dev = [
49
- "pre-commit==4.0.1",
50
- "debugpy==1.8.11",
49
+ "pre-commit==4.1.0",
50
+ "debugpy==1.8.12",
51
51
  "warc2zim[scripts]",
52
52
  "warc2zim[lint]",
53
53
  "warc2zim[test]",
@@ -103,10 +103,10 @@ all = "inv checkall --args '{args}'"
103
103
 
104
104
  [tool.black]
105
105
  line-length = 88
106
- target-version = ['py312']
106
+ target-version = ['py313']
107
107
 
108
108
  [tool.ruff]
109
- target-version = "py312"
109
+ target-version = "py313"
110
110
  line-length = 88
111
111
  src = ["src"]
112
112
 
@@ -229,6 +229,6 @@ exclude_lines = [
229
229
  include = ["src", "tests", "tasks.py"]
230
230
  exclude = [".env/**", ".venv/**"]
231
231
  extraPaths = ["src"]
232
- pythonVersion = "3.12"
232
+ pythonVersion = "3.13"
233
233
  typeCheckingMode = "basic"
234
234
  disableBytesTypePromotions = true
@@ -0,0 +1 @@
1
+ __version__ = "2.2.2"
@@ -0,0 +1,9 @@
1
+ from warc2zim.cdxj_indexer.bufferiter import buffering_record_iter
2
+ from warc2zim.cdxj_indexer.main import iter_file_or_dir
3
+ from warc2zim.cdxj_indexer.postquery import append_method_query_from_req_resp
4
+
5
+ __all__ = [
6
+ "append_method_query_from_req_resp",
7
+ "buffering_record_iter",
8
+ "iter_file_or_dir",
9
+ ]
@@ -0,0 +1,130 @@
1
+ import hashlib
2
+ import shutil
3
+ import tempfile
4
+
5
+ from warc2zim.cdxj_indexer.postquery import append_method_query_from_req_resp
6
+
7
+ BUFF_SIZE = 1024 * 64
8
+
9
+
10
+ # ============================================================================
11
+ def buffering_record_iter(
12
+ record_iter, digest_reader=None, url_key_func=None, *, post_append=False
13
+ ):
14
+ prev_record = None
15
+
16
+ for record in record_iter:
17
+ buffer_record_content(record)
18
+
19
+ record.file_offset = record_iter.get_record_offset()
20
+ record.file_length = record_iter.get_record_length()
21
+
22
+ if digest_reader:
23
+ curr = digest_reader.tell()
24
+ digest_reader.seek(record.file_offset)
25
+ record_digest, digest_length = digest_block(
26
+ digest_reader, record.file_length
27
+ )
28
+ digest_reader.seek(curr)
29
+
30
+ if digest_length != record.file_length:
31
+ raise Exception(
32
+ f"Digest block mismatch, expected {record.file_length}, "
33
+ f"got {digest_length}"
34
+ )
35
+
36
+ record.record_digest = record_digest
37
+
38
+ req, resp = concur_req_resp(prev_record, record)
39
+
40
+ if not req or not resp:
41
+ if prev_record:
42
+ yield prev_record
43
+ prev_record.buffered_stream.close()
44
+ prev_record = record
45
+ continue
46
+
47
+ join_req_resp(req, resp, post_append, url_key_func)
48
+
49
+ yield prev_record
50
+ if prev_record:
51
+ prev_record.buffered_stream.close()
52
+ yield record
53
+ record.buffered_stream.close()
54
+ prev_record = None
55
+
56
+ if prev_record:
57
+ yield prev_record
58
+ prev_record.buffered_stream.close()
59
+
60
+
61
+ # ============================================================================
62
+ def concur_req_resp(rec_1, rec_2):
63
+ if not rec_1 or not rec_2:
64
+ return None, None
65
+
66
+ if rec_1.rec_headers.get_header("WARC-Target-URI") != rec_2.rec_headers.get_header(
67
+ "WARC-Target-URI"
68
+ ):
69
+ return None, None
70
+
71
+ if rec_2.rec_headers.get_header(
72
+ "WARC-Concurrent-To"
73
+ ) != rec_1.rec_headers.get_header("WARC-Record-ID"):
74
+ return None, None
75
+
76
+ if rec_1.rec_type == "response" and rec_2.rec_type == "request":
77
+ req = rec_2
78
+ resp = rec_1
79
+
80
+ elif rec_1.rec_type == "request" and rec_2.rec_type == "response":
81
+ req = rec_1
82
+ resp = rec_2
83
+
84
+ else:
85
+ return None, None
86
+
87
+ return req, resp
88
+
89
+
90
+ # ============================================================================
91
+ def buffer_record_content(record):
92
+ spool = tempfile.SpooledTemporaryFile(BUFF_SIZE)
93
+ shutil.copyfileobj(record.content_stream(), spool)
94
+ spool.seek(0)
95
+ record.buffered_stream = spool
96
+
97
+
98
+ # ============================================================================
99
+ def join_req_resp(req, resp, post_append, url_key_func=None):
100
+ if req.http_headers is None:
101
+ return
102
+
103
+ resp.req = req
104
+
105
+ method = req.http_headers.protocol
106
+ if post_append and method.upper() in ("POST", "PUT"):
107
+ url = req.rec_headers.get_header("WARC-Target-URI")
108
+ query, append_str = append_method_query_from_req_resp(req)
109
+ resp.method = method.upper()
110
+ resp.requestBody = query
111
+ resp.urlkey = url + append_str
112
+ if url_key_func:
113
+ resp.urlkey = url_key_func(resp.urlkey)
114
+ req.urlkey = resp.urlkey
115
+
116
+
117
+ # ============================================================================
118
+ def digest_block(reader, length):
119
+ count = 0
120
+ hasher = hashlib.sha256()
121
+
122
+ while length > 0:
123
+ buff = reader.read(min(BUFF_SIZE, length))
124
+ if not buff:
125
+ break
126
+ hasher.update(buff)
127
+ length -= len(buff)
128
+ count += len(buff)
129
+
130
+ return "sha256:" + hasher.hexdigest(), count
@@ -0,0 +1,17 @@
1
+ import os
2
+
3
+ ALLOWED_EXT = (".arc", ".arc.gz", ".warc", ".warc.gz")
4
+
5
+
6
+ # =================================================================
7
+ def iter_file_or_dir(inputs: list[str]):
8
+ for input_ in inputs:
9
+ if not isinstance(input_, str) or not os.path.isdir(input_):
10
+ yield input_
11
+ continue
12
+
13
+ for root, _, files in os.walk(input_):
14
+ for filename in files:
15
+ if filename.endswith(ALLOWED_EXT):
16
+ full_path = os.path.join(root, filename)
17
+ yield full_path
@@ -0,0 +1,173 @@
1
+ import base64
2
+ import json
3
+ import sys
4
+ from io import BytesIO
5
+ from urllib.parse import unquote_plus, urlencode
6
+
7
+ from multipart import MultipartParser
8
+
9
+ MAX_QUERY_LENGTH = 4096
10
+
11
+
12
+ # ============================================================================
13
+ def append_method_query_from_req_resp(req):
14
+ len_ = req.http_headers.get_header("Content-Length")
15
+ content_type = req.http_headers.get_header("Content-Type")
16
+ stream = req.buffered_stream
17
+ stream.seek(0)
18
+
19
+ url = req.rec_headers.get_header("WARC-Target-URI")
20
+ method = req.http_headers.protocol
21
+ return append_method_query(method, content_type, len_, stream, url)
22
+
23
+
24
+ # ============================================================================
25
+ def append_method_query(method, content_type, len_, stream, url):
26
+ # if method == 'GET':
27
+ # return '', ''
28
+
29
+ if method in ("POST", "PUT"):
30
+ query = query_extract(content_type, len_, stream)
31
+ else:
32
+ query = ""
33
+
34
+ if "?" not in url:
35
+ append_str = "?"
36
+ else:
37
+ append_str = "&"
38
+
39
+ append_str += "__wb_method=" + method
40
+ if query:
41
+ append_str += "&" + query
42
+
43
+ return query, append_str
44
+
45
+
46
+ # ============================================================================
47
+ def query_extract(mime, length, stream):
48
+ """
49
+ Extract a url-encoded form POST/PUT from stream
50
+ content length, return None
51
+ Attempt to decode application/x-www-form-urlencoded or multipart/*,
52
+ otherwise read whole block and b64encode
53
+ """
54
+ query_data = b""
55
+
56
+ try:
57
+ length = int(length)
58
+ except (ValueError, TypeError):
59
+ if length is None:
60
+ length = 8192
61
+ else:
62
+ return
63
+
64
+ while length > 0:
65
+ buff = stream.read(length)
66
+
67
+ length -= len(buff)
68
+
69
+ if not buff:
70
+ break
71
+
72
+ query_data += buff
73
+
74
+ if not mime:
75
+ mime = ""
76
+
77
+ query = ""
78
+
79
+ def handle_binary(query_data):
80
+ return f"__wb_post_data={ base64.b64encode(query_data).decode()}"
81
+
82
+ if mime.startswith("application/x-www-form-urlencoded"):
83
+ try:
84
+ query = unquote_plus(query_data.decode("utf-8"))
85
+ except UnicodeDecodeError:
86
+ query = handle_binary(query_data)
87
+
88
+ elif mime.startswith("multipart/"):
89
+ try:
90
+ boundary = mime.split("boundary=")[1]
91
+ parser = MultipartParser(BytesIO(query_data), boundary, charset="utf8")
92
+ except (ValueError, IndexError):
93
+ # Content-Type multipart/form-data may lack "boundary" info
94
+ query = handle_binary(query_data)
95
+ else:
96
+ values = []
97
+ for part in parser:
98
+ if part is None:
99
+ continue
100
+ values.append((part.name, part.value))
101
+
102
+ query = urlencode(values, True)
103
+
104
+ elif mime.startswith("application/json"):
105
+ try:
106
+ query = json_parse(query_data)
107
+ except Exception:
108
+ if query_data:
109
+ try:
110
+ sys.stderr.write(
111
+ "Error parsing: " + query_data.decode("utf-8") + "\n"
112
+ )
113
+ except Exception: # noqa: S110 # nosec B110
114
+ pass
115
+
116
+ query = ""
117
+
118
+ elif mime.startswith("text/plain"):
119
+ try:
120
+ query = json_parse(query_data)
121
+ except Exception:
122
+ query = handle_binary(query_data)
123
+
124
+ # Remove AMF parsing, we do not really need it in warc2zim and AMF library is not
125
+ # maintained at all
126
+ # elif mime.startswith("application/x-amf"):
127
+ # query = amf_parse(query_data)
128
+
129
+ else:
130
+ query = handle_binary(query_data)
131
+
132
+ if query:
133
+ query = query[:MAX_QUERY_LENGTH]
134
+
135
+ return query
136
+
137
+
138
+ def json_parse(string):
139
+ data = {}
140
+ dupes = {}
141
+
142
+ def get_key(n):
143
+ if n not in data:
144
+ return n
145
+
146
+ if n not in dupes:
147
+ dupes[n] = 1
148
+
149
+ dupes[n] += 1
150
+ return n + "." + str(dupes[n]) + "_"
151
+
152
+ def _parser(json_obj, name=""):
153
+ if isinstance(json_obj, dict):
154
+ for n, v in json_obj.items():
155
+ _parser(v, n)
156
+
157
+ elif isinstance(json_obj, list):
158
+ for v in json_obj:
159
+ _parser(v, name)
160
+
161
+ elif name:
162
+ data[get_key(name)] = str(json_obj)
163
+
164
+ try:
165
+ _parser(json.loads(string))
166
+ except json.decoder.JSONDecodeError:
167
+ if b"\n" in string:
168
+ for line in string.split(b"\n"):
169
+ _parser(json.loads(line))
170
+ else:
171
+ raise
172
+
173
+ return urlencode(data)
@@ -1,4 +1,4 @@
1
- from zimscraperlib import getLogger
1
+ from zimscraperlib.logging import getLogger
2
2
 
3
3
  # Shared logger with default log level at this stage
4
4
  logger = getLogger("warc2zim")