Repository navigation
feat: add wattpad provider - #702
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 5 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report for CI Build 38597060574Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage increased (+0.02%) to 97.709%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
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.
Wattpad provider
wattpadwattpad.com/api/v3/users/<username>?fields=avatar@NotFound, 16 stockuseravatar/<hex>imagesLive results
/wattpad/Wattpad/wattpad/zzqxnope9917Obtained by running this branch's provider through the library (
require('./src')().wattpad(input)) on 2026-10-14.Adds a
wattpadprovider.unavatar.io/wattpad/<username>now returns the user's Wattpad profile picture at the largest size Wattpad serves.How it works
GET https://www.wattpad.com/api/v3/users/<username>?fields=avatar. Public JSON, no auth, no HTML scraping.useravatar/Wattpad.128.838617.jpg. The provider rewrites the size segment to256, the largest size Wattpad renders. Sizes it does not support (300, 400, 512, 1024) return 200 but silently fall back to a 64px image, so 256 is the real ceiling (measured withsips).{"error_code":1014,"error_type":"NotFound"}, which resolves toundefined.useravatar/<hex digit>.128.jpg, with no per-user id. Those resolve toundefined.@is stripped, since/users/@Wattpadhits a 400InvalidEndpoint.Live evidence
The provider run with the real
got, with each returned URL fetched:Tests
npx ava test/unit/providers/wattpad.js test/unit/providers/index.js test/unit/providers/html-config.js: 101 passed.npx ava(full suite): 549 passed.npx standardon the changed JS files: clean.The unit tests stub
gotand assert literal URLs for the API URL,@stripping, encoding, the size rewrite (including a username that contains digits and dots), stock defaults, missing users, and empty bodies.Known gap
Some recent accounts have a generated letter tile (for example, a grey square with a "G") stored under a per-user URL such as
useravatar/Jihadelamer11.128.972906.jpg. The API exposes no flag for it, and the URL has the same shape as an uploaded photo. These still resolve as avatars.🤖 Generated with Claude Code
Note
Low Risk
Additive provider with isolated outbound API calls and unit tests; no changes to auth, billing, or existing provider behavior.
Overview
Adds Wattpad as a username provider so
unavatar.io/wattpad/<username>can resolve profile pictures.The new provider calls Wattpad’s public
GET /api/v3/users/<username>?fields=avatarendpoint (JSON viagot, no HTML scraping). It strips a leading@, URL-encodes the username, upgrades the returned image URL from 128px to 256px, and returnsundefinedon HTTP errors, missing users, empty avatars, and the 16 shared stockuseravatar/<hex>defaults.wattpadis wired into the provider registry and username tier insrc/providers/index.js, documented in README, and covered by unit tests for URL building, size rewriting, stock-avatar filtering, and API success/error paths.Reviewed by Cursor Bugbot for commit e9df9cf. Bugbot is set up for automated code reviews on this repo. Configure here.