rayohx 0.1.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.
- rayohx-0.1.0/.gitignore +49 -0
- rayohx-0.1.0/.python-version +1 -0
- rayohx-0.1.0/CHANGELOG.md +45 -0
- rayohx-0.1.0/LICENSE +201 -0
- rayohx-0.1.0/PKG-INFO +102 -0
- rayohx-0.1.0/README.md +80 -0
- rayohx-0.1.0/docs/architecture.md +110 -0
- rayohx-0.1.0/docs/benchmarks.md +101 -0
- rayohx-0.1.0/docs/development.md +86 -0
- rayohx-0.1.0/docs/engine.md +195 -0
- rayohx-0.1.0/docs/guides/migration.md +313 -0
- rayohx-0.1.0/docs/guides/python/downloading.md +414 -0
- rayohx-0.1.0/docs/guides/python/enums.md +168 -0
- rayohx-0.1.0/docs/guides/python/errors.md +202 -0
- rayohx-0.1.0/docs/guides/python/events.md +271 -0
- rayohx-0.1.0/docs/guides/python/inspecting.md +271 -0
- rayohx-0.1.0/docs/guides/python/logging.md +113 -0
- rayohx-0.1.0/docs/guides/python/models.md +364 -0
- rayohx-0.1.0/docs/guides/python/selecting.md +151 -0
- rayohx-0.1.0/docs/guides/python/settings.md +319 -0
- rayohx-0.1.0/docs/guides/python/workspaces.md +49 -0
- rayohx-0.1.0/docs/guides/python.md +239 -0
- rayohx-0.1.0/docs/packaging.md +50 -0
- rayohx-0.1.0/docs/security.md +70 -0
- rayohx-0.1.0/pyproject.toml +72 -0
- rayohx-0.1.0/scripts/benchmark.py +127 -0
- rayohx-0.1.0/scripts/make_media_fixtures.py +188 -0
- rayohx-0.1.0/src/rayohx/__init__.py +200 -0
- rayohx-0.1.0/src/rayohx/_crypto/__init__.py +51 -0
- rayohx-0.1.0/src/rayohx/_crypto/_cipher.py +55 -0
- rayohx-0.1.0/src/rayohx/_crypto/_keys.py +128 -0
- rayohx-0.1.0/src/rayohx/_crypto/_support.py +32 -0
- rayohx-0.1.0/src/rayohx/_download/__init__.py +48 -0
- rayohx-0.1.0/src/rayohx/_download/_containers/__init__.py +58 -0
- rayohx-0.1.0/src/rayohx/_download/_containers/_files.py +123 -0
- rayohx-0.1.0/src/rayohx/_download/_containers/_formats.py +17 -0
- rayohx-0.1.0/src/rayohx/_download/_containers/_segments.py +27 -0
- rayohx-0.1.0/src/rayohx/_download/_containers/_sniff.py +26 -0
- rayohx-0.1.0/src/rayohx/_download/_fetcher.py +99 -0
- rayohx-0.1.0/src/rayohx/_download/_media.py +345 -0
- rayohx-0.1.0/src/rayohx/_download/_output/__init__.py +55 -0
- rayohx-0.1.0/src/rayohx/_download/_output/_names.py +60 -0
- rayohx-0.1.0/src/rayohx/_download/_output/_plan.py +144 -0
- rayohx-0.1.0/src/rayohx/_download/_pipeline.py +302 -0
- rayohx-0.1.0/src/rayohx/_download/_progress.py +95 -0
- rayohx-0.1.0/src/rayohx/_download/_sinks.py +316 -0
- rayohx-0.1.0/src/rayohx/_download/_state.py +121 -0
- rayohx-0.1.0/src/rayohx/_download/_storage/__init__.py +105 -0
- rayohx-0.1.0/src/rayohx/_download/_storage/_common.py +15 -0
- rayohx-0.1.0/src/rayohx/_download/_storage/_metrics.py +69 -0
- rayohx-0.1.0/src/rayohx/_download/_storage/_space.py +171 -0
- rayohx-0.1.0/src/rayohx/_download/_storage/_stores.py +214 -0
- rayohx-0.1.0/src/rayohx/_download/_storage/_strategy.py +37 -0
- rayohx-0.1.0/src/rayohx/_download/_workspace.py +186 -0
- rayohx-0.1.0/src/rayohx/_http/__init__.py +36 -0
- rayohx-0.1.0/src/rayohx/_http/_client.py +279 -0
- rayohx-0.1.0/src/rayohx/_http/_common.py +171 -0
- rayohx-0.1.0/src/rayohx/_http/_credentials.py +59 -0
- rayohx-0.1.0/src/rayohx/_http/_response.py +124 -0
- rayohx-0.1.0/src/rayohx/_http/_stream.py +107 -0
- rayohx-0.1.0/src/rayohx/_http/_transport.py +70 -0
- rayohx-0.1.0/src/rayohx/_logs.py +62 -0
- rayohx-0.1.0/src/rayohx/_mux/__init__.py +6 -0
- rayohx-0.1.0/src/rayohx/_mux/_aac.py +135 -0
- rayohx-0.1.0/src/rayohx/_mux/_ac3.py +234 -0
- rayohx-0.1.0/src/rayohx/_mux/_bits.py +73 -0
- rayohx-0.1.0/src/rayohx/_mux/_boxes.py +40 -0
- rayohx-0.1.0/src/rayohx/_mux/_ffmpeg.py +127 -0
- rayohx-0.1.0/src/rayohx/_mux/_fmp4.py +149 -0
- rayohx-0.1.0/src/rayohx/_mux/_fmp4_source.py +286 -0
- rayohx-0.1.0/src/rayohx/_mux/_fragmenter.py +100 -0
- rayohx-0.1.0/src/rayohx/_mux/_h264.py +218 -0
- rayohx-0.1.0/src/rayohx/_mux/_hevc.py +163 -0
- rayohx-0.1.0/src/rayohx/_mux/_model.py +33 -0
- rayohx-0.1.0/src/rayohx/_mux/_mp3.py +90 -0
- rayohx-0.1.0/src/rayohx/_mux/_mp4read.py +52 -0
- rayohx-0.1.0/src/rayohx/_mux/_muxer.py +269 -0
- rayohx-0.1.0/src/rayohx/_mux/_sink.py +252 -0
- rayohx-0.1.0/src/rayohx/_mux/_source.py +324 -0
- rayohx-0.1.0/src/rayohx/_mux/_ts.py +285 -0
- rayohx-0.1.0/src/rayohx/_mux/_webvtt.py +150 -0
- rayohx-0.1.0/src/rayohx/_ratelimit.py +64 -0
- rayohx-0.1.0/src/rayohx/_redaction.py +84 -0
- rayohx-0.1.0/src/rayohx/cancellation.py +55 -0
- rayohx-0.1.0/src/rayohx/config/__init__.py +57 -0
- rayohx-0.1.0/src/rayohx/config/_common.py +29 -0
- rayohx-0.1.0/src/rayohx/config/download.py +82 -0
- rayohx-0.1.0/src/rayohx/config/network.py +131 -0
- rayohx-0.1.0/src/rayohx/config/output.py +52 -0
- rayohx-0.1.0/src/rayohx/config/proxy.py +66 -0
- rayohx-0.1.0/src/rayohx/config/selection.py +163 -0
- rayohx-0.1.0/src/rayohx/config/storage.py +56 -0
- rayohx-0.1.0/src/rayohx/config/url.py +23 -0
- rayohx-0.1.0/src/rayohx/downloader/__init__.py +52 -0
- rayohx-0.1.0/src/rayohx/downloader/_delivery.py +307 -0
- rayohx-0.1.0/src/rayohx/downloader/_prepare.py +129 -0
- rayohx-0.1.0/src/rayohx/downloader/_result.py +27 -0
- rayohx-0.1.0/src/rayohx/downloader/_stream.py +99 -0
- rayohx-0.1.0/src/rayohx/downloader/batch.py +119 -0
- rayohx-0.1.0/src/rayohx/downloader/controller.py +358 -0
- rayohx-0.1.0/src/rayohx/downloader/shortcut.py +96 -0
- rayohx-0.1.0/src/rayohx/enums.py +96 -0
- rayohx-0.1.0/src/rayohx/errors.py +193 -0
- rayohx-0.1.0/src/rayohx/events/__init__.py +49 -0
- rayohx-0.1.0/src/rayohx/events/bus.py +46 -0
- rayohx-0.1.0/src/rayohx/events/download.py +88 -0
- rayohx-0.1.0/src/rayohx/logs.py +66 -0
- rayohx-0.1.0/src/rayohx/models/__init__.py +108 -0
- rayohx-0.1.0/src/rayohx/models/download/__init__.py +50 -0
- rayohx-0.1.0/src/rayohx/models/download/output.py +20 -0
- rayohx-0.1.0/src/rayohx/models/download/progress.py +43 -0
- rayohx-0.1.0/src/rayohx/models/download/request.py +38 -0
- rayohx-0.1.0/src/rayohx/models/download/result.py +45 -0
- rayohx-0.1.0/src/rayohx/models/download/storage.py +17 -0
- rayohx-0.1.0/src/rayohx/models/download/workspace.py +22 -0
- rayohx-0.1.0/src/rayohx/models/playlist/__init__.py +61 -0
- rayohx-0.1.0/src/rayohx/models/playlist/master.py +44 -0
- rayohx-0.1.0/src/rayohx/models/playlist/media.py +45 -0
- rayohx-0.1.0/src/rayohx/models/playlist/resolution.py +46 -0
- rayohx-0.1.0/src/rayohx/models/playlist/tracks/__init__.py +41 -0
- rayohx-0.1.0/src/rayohx/models/playlist/tracks/audio.py +20 -0
- rayohx-0.1.0/src/rayohx/models/playlist/tracks/subtitle.py +19 -0
- rayohx-0.1.0/src/rayohx/models/playlist/tracks/video.py +16 -0
- rayohx-0.1.0/src/rayohx/models/playlist/variant.py +36 -0
- rayohx-0.1.0/src/rayohx/models/segment/__init__.py +47 -0
- rayohx-0.1.0/src/rayohx/models/segment/data.py +17 -0
- rayohx-0.1.0/src/rayohx/models/segment/encryption.py +54 -0
- rayohx-0.1.0/src/rayohx/models/segment/init_map.py +17 -0
- rayohx-0.1.0/src/rayohx/models/segment/range.py +51 -0
- rayohx-0.1.0/src/rayohx/models/segment/segment.py +35 -0
- rayohx-0.1.0/src/rayohx/playlist/__init__.py +57 -0
- rayohx-0.1.0/src/rayohx/playlist/_keys.py +67 -0
- rayohx-0.1.0/src/rayohx/playlist/_lines.py +29 -0
- rayohx-0.1.0/src/rayohx/playlist/_master.py +142 -0
- rayohx-0.1.0/src/rayohx/playlist/_media.py +157 -0
- rayohx-0.1.0/src/rayohx/playlist/_values.py +122 -0
- rayohx-0.1.0/src/rayohx/playlist/_variables.py +104 -0
- rayohx-0.1.0/src/rayohx/playlist/attributes.py +61 -0
- rayohx-0.1.0/src/rayohx/playlist/detect.py +8 -0
- rayohx-0.1.0/src/rayohx/playlist/inspection.py +79 -0
- rayohx-0.1.0/src/rayohx/playlist/parser.py +71 -0
- rayohx-0.1.0/src/rayohx/py.typed +0 -0
- rayohx-0.1.0/src/rayohx/serialization.py +163 -0
- rayohx-0.1.0/src/rayohx/stream/__init__.py +52 -0
- rayohx-0.1.0/src/rayohx/stream/_ranking.py +77 -0
- rayohx-0.1.0/src/rayohx/stream/_tracks.py +113 -0
- rayohx-0.1.0/src/rayohx/stream/quality.py +15 -0
- rayohx-0.1.0/src/rayohx/stream/selection.py +51 -0
- rayohx-0.1.0/src/rayohx/stream/variants.py +141 -0
- rayohx-0.1.0/src/rayohx/workspaces.py +81 -0
- rayohx-0.1.0/tests/__init__.py +0 -0
- rayohx-0.1.0/tests/conftest.py +8 -0
- rayohx-0.1.0/tests/fixtures/hls/malformed_empty.m3u8 +2 -0
- rayohx-0.1.0/tests/fixtures/hls/malformed_extinf_without_uri.m3u8 +5 -0
- rayohx-0.1.0/tests/fixtures/hls/malformed_iv.m3u8 +5 -0
- rayohx-0.1.0/tests/fixtures/hls/malformed_key_without_uri.m3u8 +5 -0
- rayohx-0.1.0/tests/fixtures/hls/malformed_missing_bandwidth.m3u8 +3 -0
- rayohx-0.1.0/tests/fixtures/hls/malformed_mixed.m3u8 +6 -0
- rayohx-0.1.0/tests/fixtures/hls/malformed_no_header.m3u8 +3 -0
- rayohx-0.1.0/tests/fixtures/hls/malformed_no_targetduration.m3u8 +3 -0
- rayohx-0.1.0/tests/fixtures/hls/malformed_relative_range.m3u8 +5 -0
- rayohx-0.1.0/tests/fixtures/hls/malformed_stream_at_end.m3u8 +2 -0
- rayohx-0.1.0/tests/fixtures/hls/malformed_stream_without_uri.m3u8 +4 -0
- rayohx-0.1.0/tests/fixtures/hls/malformed_unterminated_quote.m3u8 +3 -0
- rayohx-0.1.0/tests/fixtures/hls/malformed_uri_without_extinf.m3u8 +3 -0
- rayohx-0.1.0/tests/fixtures/hls/master_absolute.m3u8 +5 -0
- rayohx-0.1.0/tests/fixtures/hls/master_attribute_order.m3u8 +6 -0
- rayohx-0.1.0/tests/fixtures/hls/master_audio_subs.m3u8 +18 -0
- rayohx-0.1.0/tests/fixtures/hls/master_basic.m3u8 +10 -0
- rayohx-0.1.0/tests/fixtures/hls/master_unknown_tags.m3u8 +9 -0
- rayohx-0.1.0/tests/fixtures/hls/master_variables.m3u8 +5 -0
- rayohx-0.1.0/tests/fixtures/hls/media_absolute.m3u8 +7 -0
- rayohx-0.1.0/tests/fixtures/hls/media_byterange.m3u8 +14 -0
- rayohx-0.1.0/tests/fixtures/hls/media_discontinuity.m3u8 +12 -0
- rayohx-0.1.0/tests/fixtures/hls/media_encrypted.m3u8 +14 -0
- rayohx-0.1.0/tests/fixtures/hls/media_fmp4.m3u8 +10 -0
- rayohx-0.1.0/tests/fixtures/hls/media_paths.m3u8 +13 -0
- rayohx-0.1.0/tests/fixtures/hls/media_sample_aes.m3u8 +6 -0
- rayohx-0.1.0/tests/fixtures/hls/media_simple.m3u8 +12 -0
- rayohx-0.1.0/tests/fixtures/hls/media_subtitles.m3u8 +8 -0
- rayohx-0.1.0/tests/fixtures/hls/media_variables.m3u8 +8 -0
- rayohx-0.1.0/tests/fixtures/hls/unsupported_iframes.m3u8 +5 -0
- rayohx-0.1.0/tests/fixtures/hls/unsupported_scheme.m3u8 +4 -0
- rayohx-0.1.0/tests/fixtures/hls/web_page.html +2 -0
- rayohx-0.1.0/tests/fixtures/media/aac_only.ts +0 -0
- rayohx-0.1.0/tests/fixtures/media/h264_aac.ts +0 -0
- rayohx-0.1.0/tests/fixtures/media/h264_ac3.ts +0 -0
- rayohx-0.1.0/tests/fixtures/media/h264_eac3.ts +0 -0
- rayohx-0.1.0/tests/fixtures/media/h264_mp3.ts +0 -0
- rayohx-0.1.0/tests/fixtures/media/h264_only.ts +0 -0
- rayohx-0.1.0/tests/fixtures/media/h264_only_frag.mp4 +0 -0
- rayohx-0.1.0/tests/fixtures/media/hevc_aac.ts +0 -0
- rayohx-0.1.0/tests/fixtures/media/hls_fmp4/init_0.mp4 +0 -0
- rayohx-0.1.0/tests/fixtures/media/hls_fmp4/init_1.mp4 +0 -0
- rayohx-0.1.0/tests/fixtures/media/hls_fmp4/master.m3u8 +6 -0
- rayohx-0.1.0/tests/fixtures/media/hls_fmp4/v0.m3u8 +12 -0
- rayohx-0.1.0/tests/fixtures/media/hls_fmp4/v0_0.m4s +0 -0
- rayohx-0.1.0/tests/fixtures/media/hls_fmp4/v0_1.m4s +0 -0
- rayohx-0.1.0/tests/fixtures/media/hls_fmp4/v1.m3u8 +13 -0
- rayohx-0.1.0/tests/fixtures/media/hls_fmp4/v1_0.m4s +0 -0
- rayohx-0.1.0/tests/fixtures/media/hls_fmp4/v1_1.m4s +0 -0
- rayohx-0.1.0/tests/fixtures/media/hls_fmp4/v1_2.m4s +0 -0
- rayohx-0.1.0/tests/fixtures/media/hls_ts/master.m3u8 +6 -0
- rayohx-0.1.0/tests/fixtures/media/hls_ts/v0.m3u8 +11 -0
- rayohx-0.1.0/tests/fixtures/media/hls_ts/v0_0.ts +0 -0
- rayohx-0.1.0/tests/fixtures/media/hls_ts/v0_1.ts +0 -0
- rayohx-0.1.0/tests/fixtures/media/hls_ts/v1.m3u8 +12 -0
- rayohx-0.1.0/tests/fixtures/media/hls_ts/v1_0.ts +0 -0
- rayohx-0.1.0/tests/fixtures/media/hls_ts/v1_1.ts +0 -0
- rayohx-0.1.0/tests/fixtures/media/hls_ts/v1_2.ts +0 -0
- rayohx-0.1.0/tests/helpers/__init__.py +0 -0
- rayohx-0.1.0/tests/helpers/crypto.py +13 -0
- rayohx-0.1.0/tests/helpers/hls.py +47 -0
- rayohx-0.1.0/tests/helpers/http.py +87 -0
- rayohx-0.1.0/tests/helpers/media.py +231 -0
- rayohx-0.1.0/tests/helpers/mux.py +381 -0
- rayohx-0.1.0/tests/helpers/servers.py +156 -0
- rayohx-0.1.0/tests/helpers/storage.py +10 -0
- rayohx-0.1.0/tests/integration/__init__.py +0 -0
- rayohx-0.1.0/tests/integration/test_download_end_to_end.py +159 -0
- rayohx-0.1.0/tests/integration/test_http_network.py +215 -0
- rayohx-0.1.0/tests/integration/test_installed_package.py +15 -0
- rayohx-0.1.0/tests/integration/test_security_end_to_end.py +99 -0
- rayohx-0.1.0/tests/unit/__init__.py +0 -0
- rayohx-0.1.0/tests/unit/_crypto/__init__.py +0 -0
- rayohx-0.1.0/tests/unit/_crypto/test_cipher.py +51 -0
- rayohx-0.1.0/tests/unit/_crypto/test_keys.py +160 -0
- rayohx-0.1.0/tests/unit/_crypto/test_support.py +21 -0
- rayohx-0.1.0/tests/unit/_download/__init__.py +0 -0
- rayohx-0.1.0/tests/unit/_download/_containers/__init__.py +0 -0
- rayohx-0.1.0/tests/unit/_download/_containers/test_files.py +110 -0
- rayohx-0.1.0/tests/unit/_download/_containers/test_formats.py +49 -0
- rayohx-0.1.0/tests/unit/_download/_containers/test_segments.py +38 -0
- rayohx-0.1.0/tests/unit/_download/_containers/test_sniff.py +32 -0
- rayohx-0.1.0/tests/unit/_download/_output/__init__.py +0 -0
- rayohx-0.1.0/tests/unit/_download/_output/test_names.py +74 -0
- rayohx-0.1.0/tests/unit/_download/_output/test_plan.py +112 -0
- rayohx-0.1.0/tests/unit/_download/_storage/__init__.py +0 -0
- rayohx-0.1.0/tests/unit/_download/_storage/test_common.py +34 -0
- rayohx-0.1.0/tests/unit/_download/_storage/test_metrics.py +20 -0
- rayohx-0.1.0/tests/unit/_download/_storage/test_space.py +168 -0
- rayohx-0.1.0/tests/unit/_download/_storage/test_stores.py +121 -0
- rayohx-0.1.0/tests/unit/_download/_storage/test_strategy.py +22 -0
- rayohx-0.1.0/tests/unit/_download/test_fetcher.py +120 -0
- rayohx-0.1.0/tests/unit/_download/test_media.py +560 -0
- rayohx-0.1.0/tests/unit/_download/test_pipeline.py +277 -0
- rayohx-0.1.0/tests/unit/_download/test_progress.py +79 -0
- rayohx-0.1.0/tests/unit/_download/test_sinks.py +192 -0
- rayohx-0.1.0/tests/unit/_download/test_state.py +122 -0
- rayohx-0.1.0/tests/unit/_download/test_workspace.py +126 -0
- rayohx-0.1.0/tests/unit/_http/__init__.py +0 -0
- rayohx-0.1.0/tests/unit/_http/test_client.py +137 -0
- rayohx-0.1.0/tests/unit/_http/test_common.py +86 -0
- rayohx-0.1.0/tests/unit/_http/test_credentials.py +115 -0
- rayohx-0.1.0/tests/unit/_http/test_network_extras.py +84 -0
- rayohx-0.1.0/tests/unit/_http/test_response.py +232 -0
- rayohx-0.1.0/tests/unit/_http/test_stream.py +110 -0
- rayohx-0.1.0/tests/unit/_http/test_transport.py +65 -0
- rayohx-0.1.0/tests/unit/_mux/__init__.py +0 -0
- rayohx-0.1.0/tests/unit/_mux/test_aac.py +90 -0
- rayohx-0.1.0/tests/unit/_mux/test_ac3.py +130 -0
- rayohx-0.1.0/tests/unit/_mux/test_bits.py +81 -0
- rayohx-0.1.0/tests/unit/_mux/test_boxes.py +67 -0
- rayohx-0.1.0/tests/unit/_mux/test_ffmpeg.py +203 -0
- rayohx-0.1.0/tests/unit/_mux/test_fmp4.py +119 -0
- rayohx-0.1.0/tests/unit/_mux/test_fmp4_source.py +297 -0
- rayohx-0.1.0/tests/unit/_mux/test_fragmenter.py +114 -0
- rayohx-0.1.0/tests/unit/_mux/test_h264.py +157 -0
- rayohx-0.1.0/tests/unit/_mux/test_hevc.py +102 -0
- rayohx-0.1.0/tests/unit/_mux/test_model.py +51 -0
- rayohx-0.1.0/tests/unit/_mux/test_mp3.py +66 -0
- rayohx-0.1.0/tests/unit/_mux/test_mp4read.py +30 -0
- rayohx-0.1.0/tests/unit/_mux/test_mux_sink.py +182 -0
- rayohx-0.1.0/tests/unit/_mux/test_muxer.py +217 -0
- rayohx-0.1.0/tests/unit/_mux/test_oracle.py +111 -0
- rayohx-0.1.0/tests/unit/_mux/test_source.py +68 -0
- rayohx-0.1.0/tests/unit/_mux/test_ts.py +147 -0
- rayohx-0.1.0/tests/unit/_mux/test_webvtt.py +123 -0
- rayohx-0.1.0/tests/unit/config/__init__.py +0 -0
- rayohx-0.1.0/tests/unit/config/test_common.py +41 -0
- rayohx-0.1.0/tests/unit/config/test_download.py +60 -0
- rayohx-0.1.0/tests/unit/config/test_network.py +78 -0
- rayohx-0.1.0/tests/unit/config/test_output.py +21 -0
- rayohx-0.1.0/tests/unit/config/test_proxy.py +29 -0
- rayohx-0.1.0/tests/unit/config/test_selection.py +29 -0
- rayohx-0.1.0/tests/unit/config/test_storage.py +16 -0
- rayohx-0.1.0/tests/unit/config/test_url.py +28 -0
- rayohx-0.1.0/tests/unit/downloader/__init__.py +0 -0
- rayohx-0.1.0/tests/unit/downloader/test_batch.py +138 -0
- rayohx-0.1.0/tests/unit/downloader/test_controller.py +576 -0
- rayohx-0.1.0/tests/unit/downloader/test_controller_mux.py +528 -0
- rayohx-0.1.0/tests/unit/downloader/test_delivery.py +175 -0
- rayohx-0.1.0/tests/unit/downloader/test_pause.py +86 -0
- rayohx-0.1.0/tests/unit/downloader/test_prepare.py +159 -0
- rayohx-0.1.0/tests/unit/downloader/test_result.py +53 -0
- rayohx-0.1.0/tests/unit/downloader/test_shortcut.py +154 -0
- rayohx-0.1.0/tests/unit/downloader/test_stream.py +232 -0
- rayohx-0.1.0/tests/unit/events/__init__.py +0 -0
- rayohx-0.1.0/tests/unit/events/test_bus.py +37 -0
- rayohx-0.1.0/tests/unit/events/test_download.py +83 -0
- rayohx-0.1.0/tests/unit/models/__init__.py +0 -0
- rayohx-0.1.0/tests/unit/models/test_exports.py +91 -0
- rayohx-0.1.0/tests/unit/models/test_init_map.py +35 -0
- rayohx-0.1.0/tests/unit/models/test_output.py +30 -0
- rayohx-0.1.0/tests/unit/models/test_segment_data.py +30 -0
- rayohx-0.1.0/tests/unit/models/test_storage.py +40 -0
- rayohx-0.1.0/tests/unit/models/test_tracks.py +75 -0
- rayohx-0.1.0/tests/unit/models/test_variant.py +57 -0
- rayohx-0.1.0/tests/unit/playlist/__init__.py +0 -0
- rayohx-0.1.0/tests/unit/playlist/test_attributes.py +55 -0
- rayohx-0.1.0/tests/unit/playlist/test_detect.py +27 -0
- rayohx-0.1.0/tests/unit/playlist/test_inspection.py +113 -0
- rayohx-0.1.0/tests/unit/playlist/test_keys.py +128 -0
- rayohx-0.1.0/tests/unit/playlist/test_lines.py +65 -0
- rayohx-0.1.0/tests/unit/playlist/test_master.py +110 -0
- rayohx-0.1.0/tests/unit/playlist/test_media.py +100 -0
- rayohx-0.1.0/tests/unit/playlist/test_parser.py +74 -0
- rayohx-0.1.0/tests/unit/playlist/test_values.py +143 -0
- rayohx-0.1.0/tests/unit/playlist/test_variables.py +73 -0
- rayohx-0.1.0/tests/unit/scripts/__init__.py +0 -0
- rayohx-0.1.0/tests/unit/scripts/test_benchmark.py +25 -0
- rayohx-0.1.0/tests/unit/scripts/test_make_media_fixtures.py +66 -0
- rayohx-0.1.0/tests/unit/stream/__init__.py +0 -0
- rayohx-0.1.0/tests/unit/stream/test_preferences.py +86 -0
- rayohx-0.1.0/tests/unit/stream/test_quality.py +35 -0
- rayohx-0.1.0/tests/unit/stream/test_ranking.py +111 -0
- rayohx-0.1.0/tests/unit/stream/test_selection.py +59 -0
- rayohx-0.1.0/tests/unit/stream/test_tracks.py +256 -0
- rayohx-0.1.0/tests/unit/stream/test_variants.py +176 -0
- rayohx-0.1.0/tests/unit/test_cancellation.py +67 -0
- rayohx-0.1.0/tests/unit/test_dependencies.py +43 -0
- rayohx-0.1.0/tests/unit/test_enums.py +124 -0
- rayohx-0.1.0/tests/unit/test_errors.py +108 -0
- rayohx-0.1.0/tests/unit/test_hardening.py +180 -0
- rayohx-0.1.0/tests/unit/test_logs.py +87 -0
- rayohx-0.1.0/tests/unit/test_models.py +166 -0
- rayohx-0.1.0/tests/unit/test_ratelimit.py +78 -0
- rayohx-0.1.0/tests/unit/test_redaction.py +56 -0
- rayohx-0.1.0/tests/unit/test_serialization.py +126 -0
- rayohx-0.1.0/tests/unit/test_version.py +5 -0
- rayohx-0.1.0/tests/unit/test_workspaces.py +89 -0
rayohx-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# OS files
|
|
2
|
+
.DS_Store
|
|
3
|
+
Thumbs.db
|
|
4
|
+
desktop.ini
|
|
5
|
+
|
|
6
|
+
# Editors and IDEs
|
|
7
|
+
.idea/
|
|
8
|
+
.vscode/
|
|
9
|
+
*.swp
|
|
10
|
+
*.swo
|
|
11
|
+
*~
|
|
12
|
+
|
|
13
|
+
# Environment and secrets
|
|
14
|
+
.env
|
|
15
|
+
.env.*
|
|
16
|
+
!.env.example
|
|
17
|
+
*.pem
|
|
18
|
+
*.key
|
|
19
|
+
|
|
20
|
+
# Logs and temporary files
|
|
21
|
+
*.log
|
|
22
|
+
*.tmp
|
|
23
|
+
*.bak
|
|
24
|
+
|
|
25
|
+
# Claude Code local settings
|
|
26
|
+
.claude/settings.local.json
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# Python
|
|
30
|
+
__pycache__/
|
|
31
|
+
*.py[cod]
|
|
32
|
+
.venv/
|
|
33
|
+
build/
|
|
34
|
+
dist/
|
|
35
|
+
*.egg-info/
|
|
36
|
+
.mypy_cache/
|
|
37
|
+
.ruff_cache/
|
|
38
|
+
.pytest_cache/
|
|
39
|
+
.hypothesis/
|
|
40
|
+
.schemathesis/
|
|
41
|
+
.coverage
|
|
42
|
+
.coverage.*
|
|
43
|
+
htmlcov/
|
|
44
|
+
coverage.xml
|
|
45
|
+
|
|
46
|
+
.temp/
|
|
47
|
+
|
|
48
|
+
# Node (rayohx_ui/ui); its build output is covered by dist/ above
|
|
49
|
+
node_modules/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `find_workspaces` and `remove_workspaces` list and delete the working folders that interrupted downloads leave behind. Folders a running download is using are never removed.
|
|
10
|
+
- Download or look at a playlist you already have as text (`Downloader(playlist_text=...)`, `inspect_text`) without fetching it first.
|
|
11
|
+
- A download can be paused and resumed (`Downloader.pause()`, `resume()` and `is_paused`). Segments already running finish first, and `download_paused` and `download_resumed` events report the change.
|
|
12
|
+
- `download_many` saves several streams one after another into a folder and reports how each one ended. `batch_outputs` shows the file names it would use, and `OutputConfig(directory=...)` sets the folder for outputs that are not named.
|
|
13
|
+
- Streams whose AES-128 key is given inside the playlist (`data:` addresses) now download. Local key files (`file:`) can be allowed with `allow_file_keys`, and `key_fetcher` lets you supply keys from anywhere.
|
|
14
|
+
- Streams that use playlist variables (`EXT-X-DEFINE`) are now read and downloaded instead of refused.
|
|
15
|
+
- Prefer a video codec (`codec`) or dynamic range (`video_range`), and cap the frame rate (`max_frame_rate`), in `SelectionConfig`.
|
|
16
|
+
- SOCKS5 proxies (`socks5://`, `socks5h://`), proxies read from the environment with `NetworkConfig(proxy_from_env=True)`, and client certificates for mutual TLS (`client_cert`, `client_key`, `client_key_password`).
|
|
17
|
+
- Choose a stream exactly with `variant` (its number in the listing, from 1), `resolution` (such as `1280x720`), `bandwidth` and `variant_name` in `SelectionConfig`. A choice that matches nothing lists the available streams.
|
|
18
|
+
- `StorageConfig(check_space=False)` turns off the disk-space check, for drives that report free space wrongly.
|
|
19
|
+
- A guide for moving from `pym3u8downloader`.
|
|
20
|
+
- Damaged or hostile streams are refused with a clear error instead of crashing: playlists, MPEG-TS, MP4 and subtitles are tested against thousands of corrupted variations.
|
|
21
|
+
- A benchmark script (`scripts/benchmark.py`) to compare download speed and memory between changes.
|
|
22
|
+
- Read HLS playlists, including audio and subtitle tracks, encryption, byte ranges and fMP4.
|
|
23
|
+
- Look at a stream's variants, tracks and encryption from a web address without downloading any media.
|
|
24
|
+
- Choose a stream by quality, resolution or bitrate limit, with audio and subtitle selection by language or name.
|
|
25
|
+
- Download a stream to a file in one call, with parallel segments, progress events, and a cancelled download returning a result instead of an error.
|
|
26
|
+
- Encrypted (AES-128) streams are decrypted; protected (DRM) and live streams are refused with an explanation.
|
|
27
|
+
- MPEG-TS streams are saved as `.ts` and fragmented MP4 streams as `.mp4`; a name that does not match is refused instead of mislabelling the file, and an existing file is never replaced unless you allow it.
|
|
28
|
+
- Streams with a separate audio track are joined into one MP4 in the chosen language, and MPEG-TS streams can be saved as MP4. The re-wrapping is built in and nothing is re-encoded.
|
|
29
|
+
- Subtitles are saved next to the video as `.vtt` files that line up with it.
|
|
30
|
+
- An installed FFmpeg is used as an optional fallback for codecs the built-in remuxer cannot copy; it is never required or shipped.
|
|
31
|
+
- Segments can be saved as separate files in a folder, and a video-only option downloads just the video of a stream with a separate audio track.
|
|
32
|
+
- Interrupted or cancelled downloads continue where they stopped, and need disk space for the video only, not twice that.
|
|
33
|
+
- Every segment and the finished file are checked, so an error page, a cut-off file or a wrong key is caught instead of producing a corrupt file.
|
|
34
|
+
- Requests retry with back-off, follow redirects, and support proxies, TLS settings, headers, cookies and a speed limit.
|
|
35
|
+
- Typed settings, results, progress events and clear errors with hints, and logging that stays silent until you turn it on.
|
|
36
|
+
- A cancellation token lets one thread stop work started by others.
|
|
37
|
+
- A Python guide describes using RayoHX as a library.
|
|
38
|
+
|
|
39
|
+
### Security
|
|
40
|
+
|
|
41
|
+
- Login credentials go only to the starting host and to hosts you list; redirects never carry them elsewhere.
|
|
42
|
+
- Secrets such as tokens, cookies and proxy passwords are hidden from logs and error messages.
|
|
43
|
+
- Segment names from a stream cannot write outside the download folder, and an existing file is never replaced unless you allow it.
|
|
44
|
+
- Unsupported web address schemes and endless redirect loops are refused.
|
|
45
|
+
- Damaged or hostile streams are refused with a clear error instead of crashing.
|
rayohx-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 coldsofttech
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
rayohx-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: rayohx
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: RayoHX core library: HLS stream inspecting and downloading.
|
|
5
|
+
Project-URL: Homepage, https://github.com/coldsofttech/RayoHX
|
|
6
|
+
Project-URL: Issues, https://github.com/coldsofttech/RayoHX/issues
|
|
7
|
+
Project-URL: Changelog, https://github.com/coldsofttech/RayoHX/blob/main/CHANGELOG.md
|
|
8
|
+
Author: coldsofttech
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Requires-Dist: cryptography>=44
|
|
20
|
+
Requires-Dist: httpx[socks]>=0.28.1
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# RayoHX
|
|
24
|
+
|
|
25
|
+
[](https://github.com/coldsofttech/RayoHX/actions/workflows/ci.yml)
|
|
26
|
+
[](https://pypi.org/project/rayohx/)
|
|
27
|
+
[](https://pypi.org/project/rayohx/)
|
|
28
|
+
[](https://mypy-lang.org/)
|
|
29
|
+
[](https://www.python-httpx.org/)
|
|
30
|
+
[](https://github.com/astral-sh/ruff)
|
|
31
|
+
[](https://github.com/astral-sh/uv)
|
|
32
|
+
[](LICENSE)
|
|
33
|
+
|
|
34
|
+
The RayoHX Python library: look at an HLS stream, choose the quality and tracks you want, and
|
|
35
|
+
download it to a file, all from your own code.
|
|
36
|
+
|
|
37
|
+
Coming from `pym3u8downloader`? See the
|
|
38
|
+
[migration guide](https://github.com/coldsofttech/RayoHX/blob/main/packages/core/docs/guides/migration.md).
|
|
39
|
+
|
|
40
|
+
Want a ready-made command instead? Install the `rayohx` command line from `rayohx-cli`.
|
|
41
|
+
|
|
42
|
+
## What you can do
|
|
43
|
+
|
|
44
|
+
- Inspect a stream from its web address and see its qualities, audio and subtitle tracks and
|
|
45
|
+
encryption, without downloading any media
|
|
46
|
+
- Choose a stream by quality, resolution or bitrate limit, or exactly by its number, resolution or
|
|
47
|
+
name, prefer a video codec or dynamic range, and pick audio and subtitles by language or name
|
|
48
|
+
- Download in one call, with parallel segments, progress events, and cancellation that returns a
|
|
49
|
+
result instead of an error
|
|
50
|
+
- Pause a running download and resume it later
|
|
51
|
+
- Work with a playlist you already have as text, without fetching it
|
|
52
|
+
- Download several streams one after another into a folder with `download_many`
|
|
53
|
+
- Find and remove the working folders that interrupted downloads leave behind
|
|
54
|
+
- Resume interrupted downloads where they stopped, with disk space needed for the video only
|
|
55
|
+
- Save segments as separate files in a folder, or download just the video of a stream with a
|
|
56
|
+
separate audio track
|
|
57
|
+
- Save MPEG-TS and fragmented MP4 streams, join a separate audio track into one MP4 and save
|
|
58
|
+
subtitles as `.vtt` files, with nothing re-encoded
|
|
59
|
+
- Decrypt AES-128 streams, including keys given in the playlist or supplied by your own code; protected (DRM) and live streams are refused with a clear explanation
|
|
60
|
+
- Use proxies (including SOCKS5 and ones from the environment), client certificates, TLS settings,
|
|
61
|
+
headers, cookies and a speed limit, with automatic retries
|
|
62
|
+
- Refuse damaged or hostile streams with a clear error instead of crashing, and never replace an
|
|
63
|
+
existing file unless you allow it
|
|
64
|
+
- Keep secrets such as tokens, cookies and proxy passwords out of logs and error messages
|
|
65
|
+
|
|
66
|
+
## Install
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
pip install rayohx
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Requires Python 3.11 or newer. An installed FFmpeg is used only as an optional fallback for codecs
|
|
73
|
+
the built-in remuxer cannot copy.
|
|
74
|
+
|
|
75
|
+
## Quick start
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
import rayohx
|
|
79
|
+
|
|
80
|
+
url = "https://cdn.example.com/vod/master.m3u8"
|
|
81
|
+
|
|
82
|
+
playlist = rayohx.inspect(url)
|
|
83
|
+
for variant in playlist.variants:
|
|
84
|
+
print(variant.height, variant.bandwidth)
|
|
85
|
+
|
|
86
|
+
result = rayohx.download(url, "video.ts", quality="720p")
|
|
87
|
+
print(result.output.path, result.output.size_bytes)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Learn more
|
|
91
|
+
|
|
92
|
+
- [Python guide](https://github.com/coldsofttech/RayoHX/blob/main/packages/core/docs/guides/python.md): inspecting, selecting, downloading, settings, events,
|
|
93
|
+
errors and logging
|
|
94
|
+
- [Migration guide](https://github.com/coldsofttech/RayoHX/blob/main/packages/core/docs/guides/migration.md):
|
|
95
|
+
moving from `pym3u8downloader`
|
|
96
|
+
- Prefer a command? See the [`rayohx-cli`](https://pypi.org/project/rayohx-cli/) command line
|
|
97
|
+
- [Changelog](CHANGELOG.md)
|
|
98
|
+
- [Report a problem](https://github.com/coldsofttech/RayoHX/issues)
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
Apache-2.0. See [LICENSE](LICENSE).
|
rayohx-0.1.0/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# RayoHX
|
|
2
|
+
|
|
3
|
+
[](https://github.com/coldsofttech/RayoHX/actions/workflows/ci.yml)
|
|
4
|
+
[](https://pypi.org/project/rayohx/)
|
|
5
|
+
[](https://pypi.org/project/rayohx/)
|
|
6
|
+
[](https://mypy-lang.org/)
|
|
7
|
+
[](https://www.python-httpx.org/)
|
|
8
|
+
[](https://github.com/astral-sh/ruff)
|
|
9
|
+
[](https://github.com/astral-sh/uv)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
|
|
12
|
+
The RayoHX Python library: look at an HLS stream, choose the quality and tracks you want, and
|
|
13
|
+
download it to a file, all from your own code.
|
|
14
|
+
|
|
15
|
+
Coming from `pym3u8downloader`? See the
|
|
16
|
+
[migration guide](https://github.com/coldsofttech/RayoHX/blob/main/packages/core/docs/guides/migration.md).
|
|
17
|
+
|
|
18
|
+
Want a ready-made command instead? Install the `rayohx` command line from `rayohx-cli`.
|
|
19
|
+
|
|
20
|
+
## What you can do
|
|
21
|
+
|
|
22
|
+
- Inspect a stream from its web address and see its qualities, audio and subtitle tracks and
|
|
23
|
+
encryption, without downloading any media
|
|
24
|
+
- Choose a stream by quality, resolution or bitrate limit, or exactly by its number, resolution or
|
|
25
|
+
name, prefer a video codec or dynamic range, and pick audio and subtitles by language or name
|
|
26
|
+
- Download in one call, with parallel segments, progress events, and cancellation that returns a
|
|
27
|
+
result instead of an error
|
|
28
|
+
- Pause a running download and resume it later
|
|
29
|
+
- Work with a playlist you already have as text, without fetching it
|
|
30
|
+
- Download several streams one after another into a folder with `download_many`
|
|
31
|
+
- Find and remove the working folders that interrupted downloads leave behind
|
|
32
|
+
- Resume interrupted downloads where they stopped, with disk space needed for the video only
|
|
33
|
+
- Save segments as separate files in a folder, or download just the video of a stream with a
|
|
34
|
+
separate audio track
|
|
35
|
+
- Save MPEG-TS and fragmented MP4 streams, join a separate audio track into one MP4 and save
|
|
36
|
+
subtitles as `.vtt` files, with nothing re-encoded
|
|
37
|
+
- Decrypt AES-128 streams, including keys given in the playlist or supplied by your own code; protected (DRM) and live streams are refused with a clear explanation
|
|
38
|
+
- Use proxies (including SOCKS5 and ones from the environment), client certificates, TLS settings,
|
|
39
|
+
headers, cookies and a speed limit, with automatic retries
|
|
40
|
+
- Refuse damaged or hostile streams with a clear error instead of crashing, and never replace an
|
|
41
|
+
existing file unless you allow it
|
|
42
|
+
- Keep secrets such as tokens, cookies and proxy passwords out of logs and error messages
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
pip install rayohx
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Requires Python 3.11 or newer. An installed FFmpeg is used only as an optional fallback for codecs
|
|
51
|
+
the built-in remuxer cannot copy.
|
|
52
|
+
|
|
53
|
+
## Quick start
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import rayohx
|
|
57
|
+
|
|
58
|
+
url = "https://cdn.example.com/vod/master.m3u8"
|
|
59
|
+
|
|
60
|
+
playlist = rayohx.inspect(url)
|
|
61
|
+
for variant in playlist.variants:
|
|
62
|
+
print(variant.height, variant.bandwidth)
|
|
63
|
+
|
|
64
|
+
result = rayohx.download(url, "video.ts", quality="720p")
|
|
65
|
+
print(result.output.path, result.output.size_bytes)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Learn more
|
|
69
|
+
|
|
70
|
+
- [Python guide](https://github.com/coldsofttech/RayoHX/blob/main/packages/core/docs/guides/python.md): inspecting, selecting, downloading, settings, events,
|
|
71
|
+
errors and logging
|
|
72
|
+
- [Migration guide](https://github.com/coldsofttech/RayoHX/blob/main/packages/core/docs/guides/migration.md):
|
|
73
|
+
moving from `pym3u8downloader`
|
|
74
|
+
- Prefer a command? See the [`rayohx-cli`](https://pypi.org/project/rayohx-cli/) command line
|
|
75
|
+
- [Changelog](CHANGELOG.md)
|
|
76
|
+
- [Report a problem](https://github.com/coldsofttech/RayoHX/issues)
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
Apache-2.0. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Core architecture
|
|
2
|
+
|
|
3
|
+
How the `rayohx` package (the download engine) is put together. For using it, see the [Python guide](guides/python.md).
|
|
4
|
+
|
|
5
|
+
## Layering
|
|
6
|
+
|
|
7
|
+
The package is a library. It takes typed settings, returns frozen results and raises meaningful exceptions. It never prints, never exits the process and never reads global state. The command line, the API and the window are front ends over this one package, and the package never imports any of them.
|
|
8
|
+
|
|
9
|
+
It has two runtime dependencies: `httpx` for every network request and `cryptography` for AES-128 segment decryption. Everything else, including the MPEG-TS and MP4 remuxer, is written in the package.
|
|
10
|
+
|
|
11
|
+
Names without a leading underscore are public; the ones re-exported from `rayohx/__init__.py` (listed in `__all__`) are the supported surface. Modules and packages that start with `_` are internal and may change at any time. Public packages load their submodules lazily on first use, so `import rayohx` stays cheap.
|
|
12
|
+
|
|
13
|
+
```mermaid
|
|
14
|
+
flowchart LR
|
|
15
|
+
C[CLI] -->|calls| L[rayohx]
|
|
16
|
+
A[API] -->|calls| L
|
|
17
|
+
W[Window] -->|calls| L
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Modules
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
packages/core/src/rayohx/
|
|
24
|
+
__init__.py the public names: inspect, select_stream, download, Downloader and the models
|
|
25
|
+
config/ typed, validated settings: network, storage, output, selection, proxy, and DownloadConfig that groups them
|
|
26
|
+
models/ frozen data: playlists, tracks, segments, requests, progress and results
|
|
27
|
+
enums.py DownloadState, EventType, StorageStrategy, OutputFormat, RemuxBackend and the other enums
|
|
28
|
+
errors.py every exception the engine raises, each with a message and a hint
|
|
29
|
+
cancellation.py CancellationToken: ask work to stop, and let it stop cleanly
|
|
30
|
+
events/ the download state machine and the event bus
|
|
31
|
+
playlist/ reading HLS playlists (RFC 8216) and inspecting a stream before downloading it
|
|
32
|
+
stream/ choosing a variant and its audio and subtitle tracks
|
|
33
|
+
downloader/ Downloader (the controller), the download() shortcut and the ways output is delivered
|
|
34
|
+
serialization.py plain-data views of playlists, selections, progress and results
|
|
35
|
+
logs.py configure_logging for applications
|
|
36
|
+
|
|
37
|
+
_http/ HttpClient: every network request goes through it
|
|
38
|
+
_crypto/ AES-128 decryption and key retrieval
|
|
39
|
+
_download/ the engine that downloads, stores and checks segments
|
|
40
|
+
_mux/ the built-in remuxer, and the optional use of an installed FFmpeg
|
|
41
|
+
_ratelimit.py a speed limit shared by all workers
|
|
42
|
+
_redaction.py removes secrets from URLs, headers and text before they are logged or shown
|
|
43
|
+
_logs.py the logger namespace, the download id tag and the redaction filter
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Looking at a stream
|
|
47
|
+
|
|
48
|
+
`inspect` fetches a playlist through `HttpClient` and returns a `MasterPlaylist` (a list of variants and their tracks) or a `MediaPlaylist` (a list of segments). `playlist/parser.py` reads the text into the frozen models in `models/playlist` and `models/segment`; an invalid playlist raises `InvalidPlaylistError` with the line it failed on. `select_stream` then picks a variant and its audio and subtitle tracks from a `SelectionConfig`, and reports in `notes` why a wish could not be met. Neither step downloads any media.
|
|
49
|
+
|
|
50
|
+
## A download, step by step
|
|
51
|
+
|
|
52
|
+
1. `download()` is a shortcut that builds a `DownloadRequest` and a `DownloadConfig` and runs a `Downloader`. `Downloader.run()` can also be used directly, with `cancel()` and `events` for control and progress.
|
|
53
|
+
2. The settings and the address are validated first. A bad value raises `ConfigurationError` before any request is made.
|
|
54
|
+
3. **Inspecting.** The playlists are read and the stream is chosen, as above. Separate audio tracks and subtitles become extra jobs beside the main video.
|
|
55
|
+
4. **Preparing.** `_download/_output` decides the output name and format, `_download/_storage` estimates the space needed and checks the disk has it, and `_download/_workspace` opens the working folder.
|
|
56
|
+
5. **Downloading.** `_download/_media.py` downloads one media playlist with the segment pipeline (see below).
|
|
57
|
+
6. **Finalizing.** The finished output is checked against the format the playlist promised, then moved into place.
|
|
58
|
+
7. The result is a frozen `DownloadResult`. A failure raises an error, and a stop raises `CancellationError`.
|
|
59
|
+
|
|
60
|
+
The controller moves through the states `queued`, `inspecting`, `preparing`, `downloading` (or `paused`) and `finalizing`, and ends in `completed`, `failed` or `cancelled`. Each change is published as an event.
|
|
61
|
+
|
|
62
|
+
## The segment pipeline
|
|
63
|
+
|
|
64
|
+
Workers fetch, decrypt and store; one thread takes segments out of the store in playlist order and hands them to the output sink. Because only one thread writes, sinks need no locking. New work starts only while the storage strategy allows it, which is what keeps memory and disk use bounded.
|
|
65
|
+
|
|
66
|
+
- **Fetching** (`_fetcher.py`) turns a playlist entry into decrypted bytes: it requests the segment (or its byte range), fetches the key, and decrypts. Playlists whose encryption cannot be undone are refused up front rather than failing part-way.
|
|
67
|
+
- **Storage strategy** (`_storage`) decides where finished segments wait for their turn. `auto` writes straight to a resumable file when the output is one, and streams otherwise. With `direct` and `streaming`, workers may run at most twice the worker count ahead of the segment being written. `StorageMetrics` reports what is held in memory and on disk.
|
|
68
|
+
- **Sinks** (`_sinks.py`) are where the ordered segments go: a file, a caller's stream, or a folder of one file per segment. All share one protocol: `preflight`, `open`, `write`, `checkpoint`, `commit` and `abort`.
|
|
69
|
+
- **Containers** (`_containers`) recognise a segment's format from its first bytes and check each segment, and the finished file, against what the playlist promised, so damaged media is caught instead of saved.
|
|
70
|
+
- **Progress** (`_progress.py`) turns the counts into speed, ETA and the other numbers a display needs.
|
|
71
|
+
|
|
72
|
+
## Output
|
|
73
|
+
|
|
74
|
+
A download becomes an output file in one of three ways (`downloader/_delivery.py`):
|
|
75
|
+
|
|
76
|
+
- **Plain.** The segments are joined as they are (MPEG-TS into `.ts`, fragmented MP4 into `.mp4`), or saved one file each.
|
|
77
|
+
- **Native remux.** The built-in remuxer in `_mux` re-wraps the stream into a fragmented MP4, joining in any separate audio tracks. It demuxes MPEG-TS, parses H.264, HEVC, AAC, AC-3/E-AC-3 and MP3, and writes the fragments.
|
|
78
|
+
- **FFmpeg.** For codecs the built-in remuxer cannot copy, an FFmpeg that is already installed copies the pieces into an MP4. It is never required, bundled or asked to transcode. `RemuxBackend` chooses between the two.
|
|
79
|
+
|
|
80
|
+
Subtitles are written next to the output as `.vtt` files.
|
|
81
|
+
|
|
82
|
+
## Resuming
|
|
83
|
+
|
|
84
|
+
Each download has its own working folder, named from a hash of the download (the address without its query string, so signed links still match) and never from user input, so a hostile address cannot point it elsewhere. It holds the resume state (`state.json`), staged segments and a lock. The state is saved safely, so an interrupted download continues where it stopped, and the lock keeps two runs from sharing a folder.
|
|
85
|
+
|
|
86
|
+
## Events and cancellation
|
|
87
|
+
|
|
88
|
+
`Downloader.events` is an `EventBus`. Listeners receive a `DownloadEvent` for each `EventType`: started, playlist loaded, stream selected, segment started, completed or failed, progress, finalization, and the three endings. A listener can be any callable, which is how front ends draw progress.
|
|
89
|
+
|
|
90
|
+
Cancellation is cooperative. `Downloader.cancel()` (or a `CancellationToken` passed in) asks the workers to stop; they finish or drop what they are doing and the download ends cleanly with the partial work kept for a later resume.
|
|
91
|
+
|
|
92
|
+
Pausing uses the same token. `Downloader.pause()` stops new segments from starting while the ones already running finish, and `resume()` lets the download go on. The state becomes `paused` and back to `downloading`, with `download_paused` and `download_resumed` events. Cancelling a paused download wakes it and stops it.
|
|
93
|
+
|
|
94
|
+
## HTTP and security
|
|
95
|
+
|
|
96
|
+
- Every request goes through `HttpClient` (`_http`), which applies the timeouts, retries, TLS, proxy and rate limit from `NetworkConfig`, and rejects bad responses.
|
|
97
|
+
- `_redaction` removes secrets (tokens in URLs, sensitive headers, keys in text) before anything is logged, shown in an error or stored in the settings' text form.
|
|
98
|
+
- Settings and models are frozen after they are built, so they can be shared between threads.
|
|
99
|
+
|
|
100
|
+
## Tests
|
|
101
|
+
|
|
102
|
+
The tests live in `packages/core/tests`: `unit/` runs by default, and `integration/` holds slower end-to-end tests marked `integration`, which are skipped by default and in pre-commit and run in CI. Coverage must stay at 80% or more.
|
|
103
|
+
|
|
104
|
+
## Packaging
|
|
105
|
+
|
|
106
|
+
The package is built with Hatchling. The version lives in one place, `__version__` in `rayohx/__init__.py`, and Hatchling reads it at build time. The release workflow compares it with the release tag. The wheel and sdist of this package go to PyPI; the command line ships in its own package. For the repository-wide checks and the release flow, see the [root architecture](../../../docs/architecture.md).
|
|
107
|
+
|
|
108
|
+
## Errors
|
|
109
|
+
|
|
110
|
+
Every error derives from `RayoHXError` and carries a message and a hint. The main ones are `ConfigurationError`, `InvalidPlaylistError`, `DownloadError`, `OutputFormatError`, `UnsupportedCodecError` and `CancellationError`. Front ends show the message and the hint; they never need to parse text.
|