Skip to content

Discover media resources in HLS playlists - #810

Open
Shrashti1234 wants to merge 1 commit into
internetarchive:masterfrom
Shrashti1234:feat/hls-playlists
Open

Shrashti1234 wants to merge 1 commit into
internetarchive:masterfrom
Shrashti1234:feat/hls-playlists

Conversation

@Shrashti1234

Copy link
Copy Markdown

Implements RFC 8216 playlist resource discovery for #799.

Fetching an HLS playlist currently does not discover the media needed to preserve the presentation. Add ExtractorHLS to follow URI lines (segments and nested playlists) and quoted URI attributes on EXT-X-KEY, EXT-X-MAP, EXT-X-MEDIA, EXT-X-I-FRAME-STREAM-INF, EXT-X-SESSION-DATA, and EXT-X-SESSION-KEY.

Resolve every link against the fetched playlist URL, classify it as an embed, and honor the shared outlink limit. Read UTF-8 playlists incrementally, recognize standard/legacy HLS MIME types and .m3u8/.m3u paths, and require the #EXTM3U header before claiming extraction. Attribute parsing preserves commas inside quoted values and ignores malformed lists. Non-HTTP(S) links, inline data and unresolved variable templates are skipped.

Enable the extractor in both default XML/Groovy profiles and document setup for existing jobs. This handles the fetched RFC 8216 playlist snapshot; live-playlist reload scheduling, newer variable substitution and low-latency HLS extensions are outside this change. Byte-range entries discover the underlying resource URL rather than adding a new ranged-fetch mechanism.

The branch is based directly on master and is independent of the other contribution branches.

Validation (JDK 21):

mvn -B -pl docgen,commons,modules,engine -Dtest=ExtractorHLSTest,ExtractorHTMLTest,JerichoExtractorHTMLTest,ProfileCrawlerBeansTest -Dsurefire.failIfNoSpecifiedTests=false test

117 tests passed: 115 extraction tests (including 23 HLS tests) and 2 default-profile validation tests. Coverage includes HTML → master playlist → media playlist → segment, alternate/key/init/session resources, relative and protocol-relative URLs, extensionless URLs, quoted commas, malformed attributes, MIME/filename recognition, CRLF/BOM input, duplicate byte-range URLs, non-HTTP URLs and the outlink limit.

Reference: RFC 8216, section 4.

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.

1 participant