Skip to content

Commit

Permalink
[Core] Refactored RecordDownloadService.cs and VideoDownloadService.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Linwenxuan04 committed Feb 23, 2024
1 parent 8f2165a commit 9549c6d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 45 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Lagrange.Core.Internal.Event.Message;
using Lagrange.Core.Internal.Packets.Service.Oidb;
using Lagrange.Core.Internal.Packets.Service.Oidb.Common;
using Lagrange.Core.Internal.Packets.Service.Oidb.Response;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Extension;
using ProtoBuf;
Expand Down Expand Up @@ -90,9 +89,9 @@ protected override bool Build(RecordDownloadEvent input, BotKeystore keystore, B
protected override bool Parse(byte[] input, BotKeystore keystore, BotAppInfo appInfo, BotDeviceInfo device, out RecordDownloadEvent output,
out List<ProtocolEvent>? extraEvents)
{
var payload = Serializer.Deserialize<OidbSvcTrpcTcpResponse<OidbSvcTrpcTcp0x1026_200Response>>(input.AsSpan());
var body = payload.Body.Body;
string url = $"https://{body.Field3.Domain}{body.Field3.Suffix}{body.DownloadParams}";
var payload = Serializer.Deserialize<OidbSvcTrpcTcpResponse<NTV2RichMediaResp>>(input.AsSpan());
var body = payload.Body.Download;
string url = $"https://{body.Info.Domain}{body.Info.UrlPath}{body.RKeyParam}";

output = RecordDownloadEvent.Result((int)payload.ErrorCode, url);
extraEvents = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
using Lagrange.Core.Internal.Event.Message;
using Lagrange.Core.Internal.Packets.Service.Oidb;
using Lagrange.Core.Internal.Packets.Service.Oidb.Common;
using Lagrange.Core.Internal.Packets.Service.Oidb.Request;
using Lagrange.Core.Internal.Packets.Service.Oidb.Response;
using Lagrange.Core.Utility.Binary;
using Lagrange.Core.Utility.Extension;
using ProtoBuf;
Expand Down Expand Up @@ -91,9 +89,9 @@ protected override bool Build(VideoDownloadEvent input, BotKeystore keystore, Bo
protected override bool Parse(byte[] input, BotKeystore keystore, BotAppInfo appInfo, BotDeviceInfo device, out VideoDownloadEvent output,
out List<ProtocolEvent>? extraEvents)
{
var payload = Serializer.Deserialize<OidbSvcTrpcTcpResponse<OidbSvcTrpcTcp0x1026_200Response>>(input.AsSpan());
var body = payload.Body.Body;
string url = $"https://{body.Field3.Domain}{body.Field3.Suffix}{body.DownloadParams}";
var payload = Serializer.Deserialize<OidbSvcTrpcTcpResponse<NTV2RichMediaResp>>(input.AsSpan());
var body = payload.Body.Download;
string url = $"https://{body.Info.Domain}{body.Info.UrlPath}{body.RKeyParam}";

output = VideoDownloadEvent.Result((int)payload.ErrorCode, url);
extraEvents = null;
Expand Down

0 comments on commit 9549c6d

Please sign in to comment.