Skip to content

Commit 097e10a

Browse files
committed
feat: get_private_file_url API
1 parent 2809975 commit 097e10a

8 files changed

Lines changed: 1643 additions & 2 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
"protobufjs": "^7.5.4",
4343
"protobufjs-cli": "^1.1.3",
4444
"ts-case-convert": "^2.1.0",
45-
"tsx": "^4.20.4",
45+
"tsx": "^4.20.5",
4646
"typescript": "^5.9.2",
4747
"vite": "^7.1.3",
4848
"vite-plugin-cp": "^6.0.3"
4949
},
50-
"packageManager": "yarn@4.9.2"
50+
"packageManager": "yarn@4.9.4"
5151
}

src/ntqqapi/native/pmhq/index.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,34 @@ export class PMHQ {
572572
const { download } = Oidb.GroupFileResponse.decode(oidbRespBody)
573573
return `https://${download?.downloadDns}/ftn_handler/${Buffer.from(download!.downloadUrl!).toString('hex')}/?fname=`
574574
}
575+
576+
async getPrivateFileUrl(receiverUid: string, fileUuid: string) {
577+
const body = Oidb.PrivateFile.encode({
578+
subCommand: 1200,
579+
field2: 1,
580+
body: {
581+
receiverUid,
582+
fileUuid,
583+
type: 2,
584+
t2: 0
585+
},
586+
field101: 3,
587+
field102: 103,
588+
field200: 1,
589+
field99999: Buffer.from([0xc0, 0x85, 0x2c, 0x01])
590+
}).finish()
591+
const data = Oidb.Base.encode({
592+
command: 0xe37,
593+
subCommand: 1200,
594+
body,
595+
}).finish()
596+
const res = await this.httpSendPB('OidbSvcTrpcTcp.0xe37_1200', data)
597+
const oidbRespBody = Oidb.Base.decode(Buffer.from(res.pb, 'hex')).body
598+
const file = Oidb.PrivateFileResponse.decode(oidbRespBody)
599+
const { download } = file.body!.result!.extra!
600+
const { fileName } = file.body!.metadata!
601+
return `https://${download?.downloadDns}/ftn_handler/${Buffer.from(download!.downloadUrl!).toString('hex')}/?fname=${encodeURIComponent(fileName!)}`
602+
}
575603
}
576604

577605
export const pmhq = new PMHQ()

0 commit comments

Comments
 (0)