Tags: Cloxl/xhshow
Tags
Fix: Encode b1 from raw bytes to avoid byte corruption (#75) * Encode b1 from raw bytes (bytearray) instead of string/text to avoid byte corruption during encoding. This restores parity with browser/VM output: the base64 result must start with I38r…. Prevents downstream requests from being rejected due to an invalid b1 value. * fix(encoder): improve type handling and fix type checking errors --------- Co-authored-by: Edward <[email protected]>
feat: add x-s-common signature support (#71) * feat(client): add x-b3-traceid and x-xray-traceid generation methods * feat(client): add trace id generation and unified timestamp support * feat(client): add unified sign_headers method for complete request headers * feat(client): improve sign_headers parameter handling and add convenience methods - fix: distinguish params/payload parameters in sign_headers method - params: for GET requests only - payload: for POST requests only - feat: add sign_headers_get convenience method for GET requests - feat: add sign_headers_post convenience method for POST requests - docs: update docstrings with clear parameter usage examples * test(crypto): update tests for improved sign_headers methods - fix: use params for GET and payload for POST in sign_headers tests - test: add test_sign_headers_get for GET convenience method - test: add test_sign_headers_post for POST convenience method - test: verify timestamp parameter support in convenience methods * docs(readme): reorganize usage examples to highlight convenience methods - feat: promote sign_headers_get/post as recommended approach - feat: move build_url and build_json_body to recommended section - refactor: move sign_headers unified method to traditional methods section - refactor: collapse traditional single-field generation methods into details - improve: clearer documentation structure for better user experience * fuck style * feat(client): add parameter validation for sign_headers method - validate GET requests only use params, not payload - validate POST requests only use payload, not params - raise ValueError for unsupported HTTP methods (only GET/POST allowed) - add comprehensive test coverage for parameter validation - improve error messages for better developer experience * add xs-common parameter (#72) * Add the cryptodemo library, using a custom encode_to_b64 method instead of the official standard base64 method. Add some initialization parameters to the configuration file to generate fingerprints. Perhaps using customer_encoder to replace the encoder file name is better than directly using the encoder name, since encoders are a native Python method. * Add the cryptodemo library, using a custom encode_to_b64 method instead of the official standard base64 method. Add some initialization parameters to the configuration file to generate fingerprints. ADD CRC32_encrypt for gen xs-common Perhaps using customer_encoder to replace the encoder file name is better than directly using the encoder name, since encoders are a native Python method. Use case: cookie = "you cookie dict or string" xs_common = client.sign_xsc(cookie) * style: format code to match project standards * refactor(core): split fingerprint generation into separate modules * perf(encoder): optimize base64 encoding with cached translation tables * feat(client): add unified cookie parsing and x-s-common signature support * test: add comprehensive cookie parsing tests and update crypto tests * chore(crc32): remove example code comments * docs: update API documentation for cookie-based authentication * chore(deps): update project dependencies --------- Co-authored-by: Cloxl <[email protected]> * chore(deps): remove unused curl-cffi dependency * fix: uncomment x-s signature code * fix(config): update X3_PREFIX from mns0101_ to mns0301_ --------- Co-authored-by: invisibility <[email protected]>
Merge pull request #65 * refactor(encoder): remove Base58 and rename Base64 methods * fix(utils): remove Base58Encoder from exports and fix BYTE_SIZE reference * style: fix line length and remove Python version check * style: format code with ruff * refactor(encoder): remove unnecessary try-except in encode_x3 and improve tests * chore(git): ignore local test files and Node.js artifacts * style(config): increase line length to 120 * refactor(crypto): align payload structure with t.js implementation * feat(config): add experimental signature extraction and config override support * style(format): apply code formatting and remove unused imports * style(format): apply code formatting and remove unused imports * fuck style * ci(release): restrict trigger to stable versions and upgrade action * refactor(config): replace static fingerprints with dynamic generation parameters * feat(crypto): implement dynamic environment fingerprint generation * docs(random_gen): translate Chinese comments to English * docs(config): fix outdated field names in with_overrides example * docs(readme): update config example to use with_overrides method * fuck style
feat(utils): add URL utilities and improve code documentation Features: - Add extract_uri() to extract URI path from full URLs - Add build_url() with XHS platform-specific encoding (only '=' encoded as '%3D') - Add build_json_body() convenience method for POST request serialization - Expose URL utilities through Xhshow client class Improvements: - Fix URL separator logic to handle edge cases (trailing '?' or '&') - Translate all code comments from Chinese to English - Add comprehensive documentation for XHS encoding requirements - Format codebase with ruff formatter Testing: - Add 37 test cases for URL utilities - Add parameter validation tests for sign_xs_get method - Update README with new method usage examples