fix(group-album): return video media metadata

Decode the QQ group album video payload, including cover, duration, and multi-resolution URLs. Add a wire-level regression test and update generated action documentation.

Fixes #270
This commit is contained in:
DrSmoothl committed 2026-07-22 20:00:07 +08:00
1 parent 7fb8aa1d42
commit aed15b9a3f
6 files changed
+131 -10

No files matched your search

@@ -27,30 +27,30 @@ export interface GroupAlbumListRequestWireOracle {
extMap?: pb_repeated<10, GroupAlbumListExtWireOracle>;
}
interface GroupAlbumCoverUrlWireOracle {
interface GroupAlbumUrlInfoWireOracle {
url?: pb<1, string>;
width?: pb<2, uint_32>;
height?: pb<3, uint_32>;
}
interface GroupAlbumCoverPhotoUrlWireOracle {
interface GroupAlbumPhotoUrlWireOracle {
spec?: pb<1, uint_32>;
url?: pb<2, GroupAlbumCoverUrlWireOracle>;
url?: pb<2, GroupAlbumUrlInfoWireOracle>;
}
interface GroupAlbumCoverImageWireOracle {
interface GroupAlbumImageWireOracle {
name?: pb<1, string>;
sloc?: pb<2, string>;
lloc?: pb<3, string>;
photoUrls?: pb_repeated<4, GroupAlbumCoverPhotoUrlWireOracle>;
defaultUrl?: pb<5, GroupAlbumCoverUrlWireOracle>;
photoUrls?: pb_repeated<4, GroupAlbumPhotoUrlWireOracle>;
defaultUrl?: pb<5, GroupAlbumUrlInfoWireOracle>;
isGif?: pb<6, bool>;
hasRaw?: pb<7, bool>;
}
interface GroupAlbumCoverWireOracle {
type?: pb<1, uint_32>;
image?: pb<2, GroupAlbumCoverImageWireOracle>;
image?: pb<2, GroupAlbumImageWireOracle>;
}
interface GroupAlbumListItemWireOracle {
@@ -81,3 +81,32 @@ interface GroupAlbumMediaListReqInfoWireOracle {
export interface GroupAlbumMediaListRequestWireOracle {
reqInfo?: pb<4, GroupAlbumMediaListReqInfoWireOracle>;
}
interface GroupAlbumVideoWireOracle {
id?: pb<1, string>;
url?: pb<2, string>;
cover?: pb<3, GroupAlbumImageWireOracle>;
width?: pb<4, uint_32>;
height?: pb<5, uint_32>;
videoTime?: pb<6, uint_64>;
videoUrl?: pb_repeated<7, GroupAlbumPhotoUrlWireOracle>;
}
interface GroupAlbumMediaWireOracle {
type?: pb<1, uint_32>;
image?: pb<2, GroupAlbumImageWireOracle>;
video?: pb<3, GroupAlbumVideoWireOracle>;
uploader?: pb<6, string>;
batchId?: pb<7, uint_64>;
uploadTime?: pb<8, uint_64>;
}
interface GroupAlbumMediaListResponseDataWireOracle {
mediaList?: pb_repeated<3, GroupAlbumMediaWireOracle>;
nextAttachInfo?: pb<5, string>;
}
export interface GroupAlbumMediaListResponseWireOracle {
result?: pb<1, int_32>;
data?: pb<4, GroupAlbumMediaListResponseDataWireOracle>;
}
@@ -10,6 +10,7 @@ import type {
GroupAlbumListRequestWireOracle,
GroupAlbumListResponseWireOracle,
GroupAlbumMediaListRequestWireOracle,
GroupAlbumMediaListResponseWireOracle,
} from './group-album-wire-fixture';
function albumListResponseWithCover(): Uint8Array {
@@ -256,6 +257,7 @@ describe('apis/group-album', () => {
mediaList: [{
type: 1,
image: null,
video: null,
uploader: '10001',
batchId: '123',
uploadTime: '456',
@@ -263,4 +265,84 @@ describe('apis/group-album', () => {
nextAttachInfo: 'next-page',
});
});
it('returns video metadata from the group album media list', async () => {
const bridge = mockBridge();
bridge.sendRawPacket.mockResolvedValueOnce({
success: true,
gotResponse: true,
errorCode: 0,
errorMessage: '',
responseData: Buffer.from(protobuf_encode<GroupAlbumMediaListResponseWireOracle>({
data: {
mediaList: [{
type: 2,
video: {
id: 'video-id',
url: 'https://example.test/video.mp4',
cover: {
name: 'cover.jpg',
sloc: 'cover-small',
lloc: 'cover-large',
photoUrls: [{
spec: 3,
url: { url: 'https://example.test/cover-320.jpg', width: 320, height: 180 },
}],
defaultUrl: { url: 'https://example.test/cover.jpg', width: 1920, height: 1080 },
isGif: true,
hasRaw: true,
},
width: 1920,
height: 1080,
videoTime: 15n,
videoUrl: [{
spec: 1,
url: { url: 'https://example.test/video-720p.mp4', width: 1280, height: 720 },
}],
},
uploader: '10001',
batchId: 123n,
uploadTime: 456n,
}],
nextAttachInfo: 'next-video-page',
},
})),
});
const result = await new GroupAlbumApi(bridge as never).getMediaList(12345, 'album-id');
expect(result).toEqual({
mediaList: [{
type: 2,
image: null,
video: {
id: 'video-id',
url: 'https://example.test/video.mp4',
cover: {
name: 'cover.jpg',
sloc: 'cover-small',
lloc: 'cover-large',
photoUrls: [{
spec: 3,
url: { url: 'https://example.test/cover-320.jpg', width: 320, height: 180 },
}],
defaultUrl: { url: 'https://example.test/cover.jpg', width: 1920, height: 1080 },
isGif: true,
hasRaw: true,
},
width: 1920,
height: 1080,
videoTime: '15',
videoUrl: [{
spec: 1,
url: { url: 'https://example.test/video-720p.mp4', width: 1280, height: 720 },
}],
},
uploader: '10001',
batchId: '123',
uploadTime: '456',
}],
nextAttachInfo: 'next-video-page',
});
});
});
+1 -1
View File
@@ -3617,7 +3617,7 @@
{
"name": "get_group_album_media_list",
"aliases": [],
"returns": "相册媒体列表及下一页分页游标:{mediaList, nextAttachInfo}。",
"returns": "相册图片/视频列表及下一页分页游标;视频项包含 id、url、cover、尺寸、时长和多规格地址。",
"returnsSchema": {
"type": "object",
"properties": {
+1 -1
View File
@@ -3620,7 +3620,7 @@ export const ACTIONS: CatalogAction[] = [
{
"name": "get_group_album_media_list",
"aliases": [],
"returns": "相册媒体列表及下一页分页游标:{mediaList, nextAttachInfo}。",
"returns": "相册图片/视频列表及下一页分页游标;视频项包含 id、url、cover、尺寸、时长和多规格地址。",
"returnsSchema": {
"type": "object",
"properties": {
+1 -1
View File
@@ -158,7 +158,7 @@ export const actions = [
groupAction({
name: 'get_group_album_media_list',
readOnly: true,
returns: '相册媒体列表及下一页分页游标:{mediaList, nextAttachInfo}。',
returns: '相册图片/视频列表及下一页分页游标;视频项包含 id、url、cover、尺寸、时长和多规格地址。',
returnsSchema: {
type: 'object',
properties: {
@@ -106,9 +106,19 @@ export interface ImageInfo {
isGif?: pb<6, bool>;
hasRaw?: pb<7, bool>;
}
export interface VideoInfo {
id?: pb<1, string>;
url?: pb<2, string>;
cover?: pb<3, ImageInfo>;
width?: pb<4, uint_32>;
height?: pb<5, uint_32>;
videoTime?: pb<6, uint_64>;
videoUrl?: pb_repeated<7, PhotoUrl>;
}
export interface MediaInfo {
type?: pb<1, uint_32>;
image?: pb<2, ImageInfo>;
video?: pb<3, VideoInfo>;
uploader?: pb<6, string>;
batchId?: pb<7, uint_64>;
uploadTime?: pb<8, uint_64>;