{"record":{"id":"9dd640974399825c","repo":"yikart/AiToEarn","slug":"invalidworklink-9dd640","errorCode":"InvalidWorkLink","errorMessage":"InvalidWorkLink","messagePattern":"InvalidWorkLink","errorType":"error_code","errorClass":"AppException","httpStatus":null,"severity":"error","filePath":"project/aitoearn-backend/apps/aitoearn-server/src/core/channels/platforms/kwai/kwai-work.provider.ts","lineNumber":57,"sourceCode":"    }, undefined)?.photo_id\n\n    return {\n      items: response.items.map(photo => this.toListItem(photo)).filter(item => item.platformWorkId),\n      pagination: {\n        mode: ChannelPaginationMode.Cursor,\n        nextCursor,\n        hasNext: response.items.length >= limit,\n        hasPrevious: false,\n        limit,\n      },\n    }\n  }\n\n  async getLinkInfo(input: WorkLinkInfoInput): Promise<ChannelWorkDataResult> {\n    const resolvedUrl = await this.normalizeLink(input.link)\n    const photoId = this.parsePhotoId(resolvedUrl)\n    if (!photoId) {\n      throw new AppException(ResponseCode.InvalidWorkLink)\n    }\n\n    const url = this.buildWorkLink(photoId)\n    return {\n      snapshots: [],\n      work: {\n        id: photoId,\n        url,\n        mediaType: PublishType.VIDEO,\n      },\n      extra: {\n        dataId: photoId,\n        uniqueId: `${AccountType.Kwai}_${photoId}`,\n        type: PublishType.VIDEO,\n        videoType: 'short',\n        resolvedUrl,\n      },\n      rawResponse: { resolvedUrl },","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/yikart/AiToEarn/blob/d3aa8bea5b146a8675607cf0144d891aad3e9683/project/aitoearn-backend/apps/aitoearn-server/src/core/channels/platforms/kwai/kwai-work.provider.ts#L39-L75","documentation":"getLinkInfo could not extract a Kwai photo id from the normalized link. After short-link resolution, parsePhotoId found no match, so the URL isn't a recognized Kwai work/photo link.","triggerScenarios":"Calling getLinkInfo with input.link that, after normalizeLink, has no photo id pattern (e.g. a user profile link, live link, or unsupported short-link variant).","commonSituations":"Users paste kwai.com profile or /u/ links, app-share links with new formats, or links from other apps; the id regex doesn't cover the newest share URL shape.","solutions":["Verify the link is a Kwai photo/short-video URL containing an id (e.g. /short-video/<id> or photoId param)","Ask the user to use the in-app share 'copy link' output","Extend parsePhotoId to support the URL variant being pasted","Log resolvedUrl to see what the parser actually receives"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const KWAI_RE = /(?:short-video\\/(\\d+)|photoId=(\\d+)|photo\\/(\\d+))/.source\nconst resolved = input.link?.match(new RegExp(KWAI_RE))\nif (!resolved) {\n  throw new Error('Link must be a Kwai photo/short-video URL containing a photo id')\n}","typeGuard":"function isKwaiWorkUrl(url: string): boolean {\n  try { const u = new URL(url); return /(^|\\.)kwai\\.com$|(^|\\.)kuaishou\\.com$/.test(u.hostname) && /\\d{6,}/.test(u.pathname + u.search) } catch { return false }\n}","tryCatchPattern":null,"preventionTips":["Only accept Kwai share links that include a photo/short-video id in the input UI","Normalize short links before showing acceptance errors","Keep parsePhotoId updated with new Kwai share formats","Show users an example of a valid Kwai work link"],"tags":["kwai","url-parsing","link","validation"],"backgroundTag":"unsupported-work-link","analyzedSha":"d3aa8bea5b146a8675607cf0144d891aad3e9683","analyzedAt":"2026-08-31T14:19:24.185Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}