Skip to content

[AppleAppStoreBridge] replace regex with string search to extract serialized server data - #5024

Merged
dvikan merged 1 commit into
RSS-Bridge:masterfrom
NohamR:master
Aug 1, 2026
Merged

[AppleAppStoreBridge] replace regex with string search to extract serialized server data#5024
dvikan merged 1 commit into
RSS-Bridge:masterfrom
NohamR:master

Conversation

@NohamR

@NohamR NohamR commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

The preg_match regex used to extract the serialized-server-data JSON block from Apple's HTML page fails when the JSON payload exceeds ~1MB, hitting PHP's default PCRE backtrack limit (1,000,000). This causes a "Failed to locate serialized server data in HTML page" error on every request.

Replaced the regex-based extraction with strpos/substr string operations, which have no backtrack limit and handle arbitrarily large payloads reliably.

…ialized server data

The `preg_match` regex used to extract the `serialized-server-data` JSON block from Apple's HTML page fails when the JSON payload exceeds ~1MB, hitting PHP's default PCRE backtrack limit (1,000,000). This causes a "Failed to locate serialized server data in HTML page" error on every request.

Replaced the regex-based extraction with `strpos/substr` string operations, which have no backtrack limit and handle arbitrarily large payloads reliably.
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Pull request artifacts

Bridge Context Status
AppleAppStore 1 untitled (current) ✔️
AppleAppStore 1 untitled (pr) ✔️

last change: Thursday 2026-07-02 18:34:50

@NohamR

NohamR commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

This fix is necessary for some App Store pages with lots of versions, such as https://apps.apple.com/us/app/youtube/id544007664.

Type: Exception
Code: 0
Message: Failed to locate serialized server data in HTML page
File: bridges/AppleAppStoreBridge.php
Line: 114
Trace
#0 index.php(73): RssBridge->main()
#1 lib/RssBridge.php(39): RssBridge->{closure}()
#2 lib/RssBridge.php(37): BasicAuthMiddleware->__invoke()
#3 middlewares/BasicAuthMiddleware.php(13): RssBridge->{closure}()
#4 lib/RssBridge.php(37): CacheMiddleware->__invoke()
#5 middlewares/CacheMiddleware.php(44): RssBridge->{closure}()
#6 lib/RssBridge.php(37): ExceptionMiddleware->__invoke()
#7 middlewares/ExceptionMiddleware.php(17): RssBridge->{closure}()
#8 lib/RssBridge.php(37): SecurityMiddleware->__invoke()
#9 middlewares/SecurityMiddleware.php(19): RssBridge->{closure}()
#10 lib/RssBridge.php(37): MaintenanceMiddleware->__invoke()
#11 middlewares/MaintenanceMiddleware.php(10): RssBridge->{closure}()
#12 lib/RssBridge.php(37): TokenAuthenticationMiddleware->__invoke()
#13 middlewares/TokenAuthenticationMiddleware.php(10): RssBridge->{closure}()
#14 lib/RssBridge.php(34): DisplayAction->__invoke()
#15 actions/DisplayAction.php(54): DisplayAction->createResponse()
#16 actions/DisplayAction.php(89): AppleAppStoreBridge->collectData()
#17 bridges/AppleAppStoreBridge.php(195): AppleAppStoreBridge->getAppData()
#18 bridges/AppleAppStoreBridge.php(114)

This has now been fixed (see https://rss-bridge.noh.am/?action=display&bridge=AppleAppStoreBridge&id=544007664&p=mac&country=US&format=Atom).

@dvikan
dvikan merged commit fb1e9eb into RSS-Bridge:master Aug 1, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants