fix(opensea): title collections by their collection name, not the page title - #16
Merged
Merged
Conversation
…e title An OpenSea collection page's <title> embeds the floor price and page furniture -- "PXL NET 0.1904 ETH - Collection | OpenSea" -- and the generic title chain persisted it (minus the "| OpenSea" suffix) as the playlist title, freezing a price that is stale the moment it is stored. No adapter implemented extractTitleFromHtml, so the raw <title> always outranked the humanized-slug fallback that already produced a usable name. Give the OpenSea adapter an extractTitleFromHtml for collection pages. The collection's real name rides the same embedded JSON payloads the keyless item extraction already scans; the collection object carries "name" adjacent to a "slug" that is known from the parsed URL, so the extractor takes the name nearest that slug marker (window-bounded, so a payment-token or item name elsewhere in the payload is never read as the collection's). When no embedded name is present it falls back to the <title> scrubbed of the price/"- Collection" furniture, and returns null when there is no furniture -- pages whose <title> is already just the collection name keep their existing behavior unchanged. Verified against the live pxl-net page: extracts "PXL NET". Fixes #15.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15.
Resolving
https://opensea.io/collection/pxl-nettitled the playlistPXL NET 0.1904 ETH - Collection— the page<title>minus the| OpenSeasuffix, floor price included, stale the moment it was stored. Product decision from the FF side: collection imports always use the collection name, never the webpage name.Approach
No site implemented
extractTitleFromHtml, so the generic<title>path always won (bestFetchedTitle→fetchedHtmlTitle). Rather than reordering the generic chain — which would regress pages whose<title>is the clean collection name (the existing Chromie Squiggle test) — this gives the OpenSea adapter a collection-pageextractTitleFromHtml:"name"adjacent to a"slug"known from the parsed URL. The extractor takes the name nearest the slug marker, window-bounded so a payment-token or item name elsewhere in the payload can't be misread.<title>fallback. Price +- Collectionfurniture stripped.<title>keeps today's behavior exactly.Verification
npm test: 177 pass, 0 fail — including the pre-existing 'uses fetched page title instead of slug fallback' test, deliberately untouched<title>; furniture scrub works when no embedded name exists"PXL NET"Deploy note
ff-source-resolver-serviceconsumes this via@feralfile/source-resolver, so the app-visible fix needs an npm release + a version bump in the service. Re-adding a collection in the FF app after that deploy overwrites the stored bad title (imports replace the playlist).