description: The shared networking interface provided by the App: HTTP, cookies, sessions, batching and downloads.
Shared Networking
The App provides networking before initialization: net in Java, self.net in Python and net in QuickJS. Time units are milliseconds. See the CatVodSpider development notes for full parameters and samples.
Method overview
HTTP
Use net.json(url, options) when you only need JSON; connection failure, non-2xx or invalid JSON throws. Use net.req when you need the status code, error body or bytes, and await net.http in QuickJS. Java options are JSON strings unless noted, and json/req also return JSON strings.
QuickJS req runs synchronously; http/json are awaited. Python/QuickJS pass options as objects and use buffer: 3 for binary responses, yielding bytes/ArrayBuffer. net.getUserAgent() returns the App UA; add it to headers yourself when needed.
Cookies and sessions
cookie: true uses and updates WebView cookies; read with getCookie(url) and write a single Set-Cookie with setCookie(url, cookie). net.session() manages isolated cookies automatically; it does not share the site's cookies or TTL cache and does not support persist.
Always close a session: try-with-resources in Java, with in Python, finally in QuickJS. Closing cancels its requests, streams and connections, and it cannot be reused.
Batching and downloads
net.batch(requests, limit) takes {url, options} per entry, 4 concurrent by default, and returns results in input order. When each item also needs caching, signing or parsing, use net.map(items, mapper, limit); the callback receives item/index and must check the HTTP status itself. Dispatch stops on a thrown error while started work finishes; Java/Python call back on background threads, QuickJS may use async.
Java downloads with net.download(url, optionsJson, file); Python/QuickJS use net.download(url, path, options). threads is 0 for automatic, 1 for a single connection, 2–4 for a concurrent cap; size sets the exact byte count and maxBytes caps the written size. Resume and segmentation depend on Range and validators from the source; cookie:true / sessions never resume. Verify the resulting file afterwards.
Related
- Large files and proxying: Streams and proxy
- WebSockets: WebSocket
- Caching and storage: Cache and storage