Major refactor #141
@ -11,4 +11,6 @@ public class PreviewDto
|
|||||||
[JsonProperty("size")] public int? Size { get; set; }
|
[JsonProperty("size")] public int? Size { get; set; }
|
||||||
|
|
||||||
[JsonProperty("url")] public string Url { get; set; } = "";
|
[JsonProperty("url")] public string Url { get; set; } = "";
|
||||||
|
|
||||||
|
[JsonProperty("sources")] public SourcesDto Sources { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,4 +11,6 @@ public class SquarePreviewDto
|
|||||||
[JsonProperty("height")] public int Height { get; set; }
|
[JsonProperty("height")] public int Height { get; set; }
|
||||||
|
|
||||||
[JsonProperty("size")] public long Size { get; set; }
|
[JsonProperty("size")] public long Size { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("sources")] public SourcesDto Sources { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
|||||||
22
OF DL/Models/Dtos/Highlights/HighlightMediaDto.cs
Normal file
22
OF DL/Models/Dtos/Highlights/HighlightMediaDto.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace OF_DL.Models.Dtos.Highlights;
|
||||||
|
|
||||||
|
public class HighlightMediaDto
|
||||||
|
{
|
||||||
|
[JsonProperty("id")] public long Id { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("userId")] public long UserId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("title")] public string Title { get; set; } = "";
|
||||||
|
|
||||||
|
[JsonProperty("coverStoryId")] public long CoverStoryId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("cover")] public string Cover { get; set; } = "";
|
||||||
|
|
||||||
|
[JsonProperty("storiesCount")] public int StoriesCount { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("createdAt")] public DateTime? CreatedAt { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("stories")] public List<StoryDto> Stories { get; set; } = [];
|
||||||
|
}
|
||||||
10
OF DL/Models/Dtos/Highlights/HighlightsDto.cs
Normal file
10
OF DL/Models/Dtos/Highlights/HighlightsDto.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace OF_DL.Models.Dtos.Highlights;
|
||||||
|
|
||||||
|
public class HighlightsDto
|
||||||
|
{
|
||||||
|
[JsonProperty("list")] public List<ListItemDto> List { get; set; } = [];
|
||||||
|
|
||||||
|
[JsonProperty("hasMore")] public bool HasMore { get; set; }
|
||||||
|
}
|
||||||
20
OF DL/Models/Dtos/Highlights/ListItemDto.cs
Normal file
20
OF DL/Models/Dtos/Highlights/ListItemDto.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace OF_DL.Models.Dtos.Highlights;
|
||||||
|
|
||||||
|
public class ListItemDto
|
||||||
|
{
|
||||||
|
[JsonProperty("id")] public long Id { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("userId")] public long UserId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("title")] public string Title { get; set; } = "";
|
||||||
|
|
||||||
|
[JsonProperty("coverStoryId")] public long CoverStoryId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("cover")] public string Cover { get; set; } = "";
|
||||||
|
|
||||||
|
[JsonProperty("storiesCount")] public int StoriesCount { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("createdAt")] public DateTime? CreatedAt { get; set; }
|
||||||
|
}
|
||||||
21
OF DL/Models/Dtos/Highlights/MediumDto.cs
Normal file
21
OF DL/Models/Dtos/Highlights/MediumDto.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using OF_DL.Models.Dtos.Common;
|
||||||
|
|
||||||
|
namespace OF_DL.Models.Dtos.Highlights;
|
||||||
|
|
||||||
|
public class MediumDto
|
||||||
|
{
|
||||||
|
[JsonProperty("id")] public long Id { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("type")] public string Type { get; set; } = "";
|
||||||
|
|
||||||
|
[JsonProperty("convertedToVideo")] public bool ConvertedToVideo { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("canView")] public bool CanView { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("hasError")] public bool HasError { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("createdAt")] public DateTime? CreatedAt { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("files")] public FilesDto Files { get; set; } = new();
|
||||||
|
}
|
||||||
24
OF DL/Models/Dtos/Highlights/StoryDto.cs
Normal file
24
OF DL/Models/Dtos/Highlights/StoryDto.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace OF_DL.Models.Dtos.Highlights;
|
||||||
|
|
||||||
|
public class StoryDto
|
||||||
|
{
|
||||||
|
[JsonProperty("id")] public long Id { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("userId")] public long UserId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("isWatched")] public bool IsWatched { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("isReady")] public bool IsReady { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("media")] public List<MediumDto> Media { get; set; } = [];
|
||||||
|
|
||||||
|
[JsonProperty("createdAt")] public DateTime? CreatedAt { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("question")] public object Question { get; set; } = new();
|
||||||
|
|
||||||
|
[JsonProperty("canLike")] public bool CanLike { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("isLiked")] public bool IsLiked { get; set; }
|
||||||
|
}
|
||||||
6
OF DL/Models/Entities/Highlights/HighlightMedia.cs
Normal file
6
OF DL/Models/Entities/Highlights/HighlightMedia.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace OF_DL.Models.Entities.Highlights;
|
||||||
|
|
||||||
|
public class HighlightMedia
|
||||||
|
{
|
||||||
|
public List<Story> Stories { get; set; } = [];
|
||||||
|
}
|
||||||
8
OF DL/Models/Entities/Highlights/Highlights.cs
Normal file
8
OF DL/Models/Entities/Highlights/Highlights.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace OF_DL.Models.Entities.Highlights;
|
||||||
|
|
||||||
|
public class Highlights
|
||||||
|
{
|
||||||
|
public List<ListItem> List { get; set; } = [];
|
||||||
|
|
||||||
|
public bool HasMore { get; set; }
|
||||||
|
}
|
||||||
6
OF DL/Models/Entities/Highlights/ListItem.cs
Normal file
6
OF DL/Models/Entities/Highlights/ListItem.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace OF_DL.Models.Entities.Highlights;
|
||||||
|
|
||||||
|
public class ListItem
|
||||||
|
{
|
||||||
|
public long Id { get; set; }
|
||||||
|
}
|
||||||
16
OF DL/Models/Entities/Highlights/Medium.cs
Normal file
16
OF DL/Models/Entities/Highlights/Medium.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using OF_DL.Models.Entities.Common;
|
||||||
|
|
||||||
|
namespace OF_DL.Models.Entities.Highlights;
|
||||||
|
|
||||||
|
public class Medium
|
||||||
|
{
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
public string? Type { get; set; }
|
||||||
|
|
||||||
|
public bool CanView { get; set; }
|
||||||
|
|
||||||
|
public DateTime? CreatedAt { get; set; }
|
||||||
|
|
||||||
|
public Files? Files { get; set; }
|
||||||
|
}
|
||||||
10
OF DL/Models/Entities/Highlights/Story.cs
Normal file
10
OF DL/Models/Entities/Highlights/Story.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace OF_DL.Models.Entities.Highlights;
|
||||||
|
|
||||||
|
public class Story
|
||||||
|
{
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
public DateTime? CreatedAt { get; set; }
|
||||||
|
|
||||||
|
public List<Medium>? Media { get; set; }
|
||||||
|
}
|
||||||
@ -1,102 +0,0 @@
|
|||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace OF_DL.Models.Highlights;
|
|
||||||
|
|
||||||
public class HighlightMedia
|
|
||||||
{
|
|
||||||
public long id { get; set; }
|
|
||||||
public long userId { get; set; }
|
|
||||||
public string title { get; set; }
|
|
||||||
public long coverStoryId { get; set; }
|
|
||||||
public string cover { get; set; }
|
|
||||||
public int storiesCount { get; set; }
|
|
||||||
public DateTime? createdAt { get; set; }
|
|
||||||
public List<Story> stories { get; set; }
|
|
||||||
|
|
||||||
public class Files
|
|
||||||
{
|
|
||||||
public Full full { get; set; }
|
|
||||||
public Thumb thumb { get; set; }
|
|
||||||
public Preview preview { get; set; }
|
|
||||||
public SquarePreview squarePreview { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Full
|
|
||||||
{
|
|
||||||
public string url { get; set; }
|
|
||||||
public int width { get; set; }
|
|
||||||
public int height { get; set; }
|
|
||||||
public long size { get; set; }
|
|
||||||
public List<object> sources { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Medium
|
|
||||||
{
|
|
||||||
public long id { get; set; }
|
|
||||||
public string type { get; set; }
|
|
||||||
public bool convertedToVideo { get; set; }
|
|
||||||
public bool canView { get; set; }
|
|
||||||
public bool hasError { get; set; }
|
|
||||||
public DateTime? createdAt { get; set; }
|
|
||||||
public Files files { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Preview
|
|
||||||
{
|
|
||||||
public string url { get; set; }
|
|
||||||
public int width { get; set; }
|
|
||||||
public int height { get; set; }
|
|
||||||
public long size { get; set; }
|
|
||||||
public Sources sources { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Source
|
|
||||||
{
|
|
||||||
public string url { get; set; }
|
|
||||||
public int width { get; set; }
|
|
||||||
public int height { get; set; }
|
|
||||||
public int duration { get; set; }
|
|
||||||
public long size { get; set; }
|
|
||||||
public Sources sources { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Sources
|
|
||||||
{
|
|
||||||
[JsonProperty("720")] public string _720 { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("240")] public string _240 { get; set; }
|
|
||||||
|
|
||||||
public string w150 { get; set; }
|
|
||||||
public string w480 { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class SquarePreview
|
|
||||||
{
|
|
||||||
public string url { get; set; }
|
|
||||||
public int width { get; set; }
|
|
||||||
public int height { get; set; }
|
|
||||||
public long size { get; set; }
|
|
||||||
public Sources sources { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Story
|
|
||||||
{
|
|
||||||
public long id { get; set; }
|
|
||||||
public long userId { get; set; }
|
|
||||||
public bool isWatched { get; set; }
|
|
||||||
public bool isReady { get; set; }
|
|
||||||
public List<Medium> media { get; set; }
|
|
||||||
public DateTime? createdAt { get; set; }
|
|
||||||
public object question { get; set; }
|
|
||||||
public bool canLike { get; set; }
|
|
||||||
public bool isLiked { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Thumb
|
|
||||||
{
|
|
||||||
public string url { get; set; }
|
|
||||||
public int width { get; set; }
|
|
||||||
public int height { get; set; }
|
|
||||||
public long size { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
namespace OF_DL.Models.Highlights;
|
|
||||||
|
|
||||||
public class Highlights
|
|
||||||
{
|
|
||||||
public List<List> list { get; set; }
|
|
||||||
public bool hasMore { get; set; }
|
|
||||||
|
|
||||||
public class List
|
|
||||||
{
|
|
||||||
public long id { get; set; }
|
|
||||||
public long userId { get; set; }
|
|
||||||
public string title { get; set; }
|
|
||||||
public long coverStoryId { get; set; }
|
|
||||||
public string cover { get; set; }
|
|
||||||
public int storiesCount { get; set; }
|
|
||||||
public DateTime? createdAt { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
66
OF DL/Models/Mappers/HighlightsMapper.cs
Normal file
66
OF DL/Models/Mappers/HighlightsMapper.cs
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
using OF_DL.Models.Dtos.Common;
|
||||||
|
using OF_DL.Models.Dtos.Highlights;
|
||||||
|
using OF_DL.Models.Entities.Common;
|
||||||
|
using OF_DL.Models.Entities.Highlights;
|
||||||
|
|
||||||
|
namespace OF_DL.Models.Mappers;
|
||||||
|
|
||||||
|
public static class HighlightsMapper
|
||||||
|
{
|
||||||
|
public static Highlights FromDto(HighlightsDto? dto)
|
||||||
|
{
|
||||||
|
Highlights mapped = new() { HasMore = dto?.HasMore ?? false };
|
||||||
|
|
||||||
|
if (dto?.List == null)
|
||||||
|
{
|
||||||
|
return mapped;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (ListItemDto entry in dto.List)
|
||||||
|
{
|
||||||
|
mapped.List.Add(MapListItem(entry));
|
||||||
|
}
|
||||||
|
|
||||||
|
return mapped;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HighlightMedia FromDto(HighlightMediaDto? dto)
|
||||||
|
{
|
||||||
|
HighlightMedia mapped = new();
|
||||||
|
|
||||||
|
if (dto?.Stories == null)
|
||||||
|
{
|
||||||
|
return mapped;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (StoryDto story in dto.Stories)
|
||||||
|
{
|
||||||
|
mapped.Stories.Add(MapStory(story));
|
||||||
|
}
|
||||||
|
|
||||||
|
return mapped;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ListItem MapListItem(ListItemDto dto) => new() { Id = dto.Id };
|
||||||
|
|
||||||
|
private static Story MapStory(StoryDto dto) =>
|
||||||
|
new() { Id = dto.Id, CreatedAt = dto.CreatedAt, Media = MapMedia(dto.Media) };
|
||||||
|
|
||||||
|
private static List<Medium>? MapMedia(List<MediumDto>? media) =>
|
||||||
|
media?.Select(MapMedium).ToList();
|
||||||
|
|
||||||
|
private static Medium MapMedium(MediumDto dto) =>
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Id = dto.Id,
|
||||||
|
Type = dto.Type,
|
||||||
|
CanView = dto.CanView,
|
||||||
|
CreatedAt = dto.CreatedAt,
|
||||||
|
Files = MapFiles(dto.Files)
|
||||||
|
};
|
||||||
|
|
||||||
|
private static Files? MapFiles(FilesDto? dto) => dto == null ? null : new Files { Full = MapFull(dto.Full) };
|
||||||
|
|
||||||
|
private static Full? MapFull(FullDto? dto) =>
|
||||||
|
dto == null ? null : new Full { Url = dto.Url };
|
||||||
|
}
|
||||||
@ -13,11 +13,11 @@ using OF_DL.Models.Purchased;
|
|||||||
using OF_DL.Models.Streams;
|
using OF_DL.Models.Streams;
|
||||||
using OF_DL.Enumerations;
|
using OF_DL.Enumerations;
|
||||||
using OF_DL.Helpers;
|
using OF_DL.Helpers;
|
||||||
using OF_DL.Models.Entities.Archived;
|
using ArchivedModels = OF_DL.Models.Entities.Archived;
|
||||||
using OF_DL.Services;
|
using OF_DL.Services;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Spectre.Console;
|
using Spectre.Console;
|
||||||
using Constants = OF_DL.Widevine.Constants;
|
using WidevineConstants = OF_DL.Widevine.Constants;
|
||||||
|
|
||||||
namespace OF_DL;
|
namespace OF_DL;
|
||||||
|
|
||||||
@ -502,7 +502,8 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
Environment.Exit(4);
|
Environment.Exit(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!File.Exists(Path.Join(Constants.DEVICES_FOLDER, Constants.DEVICE_NAME, "device_client_id_blob")))
|
if (!File.Exists(Path.Join(WidevineConstants.DEVICES_FOLDER, WidevineConstants.DEVICE_NAME,
|
||||||
|
"device_client_id_blob")))
|
||||||
{
|
{
|
||||||
clientIdBlobMissing = true;
|
clientIdBlobMissing = true;
|
||||||
Log.Debug("clientIdBlobMissing missing");
|
Log.Debug("clientIdBlobMissing missing");
|
||||||
@ -510,11 +511,12 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
AnsiConsole.Markup("[green]device_client_id_blob located successfully![/]\n");
|
AnsiConsole.Markup("[green]device_client_id_blob located successfully![/]\n");
|
||||||
Log.Debug("clientIdBlobMissing found: " + File.Exists(Path.Join(Constants.DEVICES_FOLDER,
|
Log.Debug("clientIdBlobMissing found: " + File.Exists(Path.Join(WidevineConstants.DEVICES_FOLDER,
|
||||||
Constants.DEVICE_NAME, "device_client_id_blob")));
|
WidevineConstants.DEVICE_NAME, "device_client_id_blob")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!File.Exists(Path.Join(Constants.DEVICES_FOLDER, Constants.DEVICE_NAME, "device_private_key")))
|
if (!File.Exists(Path.Join(WidevineConstants.DEVICES_FOLDER, WidevineConstants.DEVICE_NAME,
|
||||||
|
"device_private_key")))
|
||||||
{
|
{
|
||||||
devicePrivateKeyMissing = true;
|
devicePrivateKeyMissing = true;
|
||||||
Log.Debug("devicePrivateKeyMissing missing");
|
Log.Debug("devicePrivateKeyMissing missing");
|
||||||
@ -522,8 +524,8 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
AnsiConsole.Markup("[green]device_private_key located successfully![/]\n");
|
AnsiConsole.Markup("[green]device_private_key located successfully![/]\n");
|
||||||
Log.Debug("devicePrivateKeyMissing found: " + File.Exists(Path.Join(Constants.DEVICES_FOLDER,
|
Log.Debug("devicePrivateKeyMissing found: " + File.Exists(Path.Join(WidevineConstants.DEVICES_FOLDER,
|
||||||
Constants.DEVICE_NAME, "device_private_key")));
|
WidevineConstants.DEVICE_NAME, "device_private_key")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clientIdBlobMissing || devicePrivateKeyMissing)
|
if (clientIdBlobMissing || devicePrivateKeyMissing)
|
||||||
@ -1272,7 +1274,7 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
IAPIService apiService = serviceProvider.GetRequiredService<IAPIService>();
|
IAPIService apiService = serviceProvider.GetRequiredService<IAPIService>();
|
||||||
IDownloadService downloadService = serviceProvider.GetRequiredService<IDownloadService>();
|
IDownloadService downloadService = serviceProvider.GetRequiredService<IDownloadService>();
|
||||||
|
|
||||||
ArchivedCollection archived = new();
|
ArchivedModels.ArchivedCollection archived = new();
|
||||||
|
|
||||||
await AnsiConsole.Status()
|
await AnsiConsole.Status()
|
||||||
.StartAsync("[red]Getting Archived Posts[/]",
|
.StartAsync("[red]Getting Archived Posts[/]",
|
||||||
|
|||||||
@ -6,7 +6,6 @@ using System.Xml.Linq;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using OF_DL.Models;
|
using OF_DL.Models;
|
||||||
using OF_DL.Models.Highlights;
|
|
||||||
using OF_DL.Models.Lists;
|
using OF_DL.Models.Lists;
|
||||||
using OF_DL.Models.Messages;
|
using OF_DL.Models.Messages;
|
||||||
using OF_DL.Models.Post;
|
using OF_DL.Models.Post;
|
||||||
@ -15,8 +14,9 @@ using OF_DL.Models.Stories;
|
|||||||
using OF_DL.Models.Streams;
|
using OF_DL.Models.Streams;
|
||||||
using OF_DL.Enumerations;
|
using OF_DL.Enumerations;
|
||||||
using OF_DL.Models.Dtos.Archived;
|
using OF_DL.Models.Dtos.Archived;
|
||||||
using OF_DL.Models.Entities;
|
using OF_DL.Models.Dtos.Highlights;
|
||||||
using OF_DL.Models.Entities.Archived;
|
using ArchivedModels = OF_DL.Models.Entities.Archived;
|
||||||
|
using HighlightEntities = OF_DL.Models.Entities.Highlights;
|
||||||
using OF_DL.Models.Mappers;
|
using OF_DL.Models.Mappers;
|
||||||
using OF_DL.Widevine;
|
using OF_DL.Widevine;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
@ -452,24 +452,25 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
else if (mediatype == MediaType.Highlights)
|
else if (mediatype == MediaType.Highlights)
|
||||||
{
|
{
|
||||||
List<string> highlight_ids = new();
|
List<string> highlight_ids = new();
|
||||||
Highlights highlights = JsonConvert.DeserializeObject<Highlights>(body, m_JsonSerializerSettings) ??
|
HighlightsDto? highlightsDto =
|
||||||
new Highlights();
|
JsonConvert.DeserializeObject<HighlightsDto>(body, m_JsonSerializerSettings);
|
||||||
|
HighlightEntities.Highlights highlights = HighlightsMapper.FromDto(highlightsDto);
|
||||||
|
|
||||||
if (highlights.hasMore)
|
if (highlights.HasMore)
|
||||||
{
|
{
|
||||||
offset += 5;
|
offset += 5;
|
||||||
getParams["offset"] = offset.ToString();
|
getParams["offset"] = offset.ToString();
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
Highlights newhighlights = new();
|
|
||||||
|
|
||||||
Log.Debug("Media Highlights - " + endpoint);
|
Log.Debug("Media Highlights - " + endpoint);
|
||||||
|
|
||||||
string? loopbody = await BuildHeaderAndExecuteRequests(getParams, endpoint, GetHttpClient());
|
string? loopbody = await BuildHeaderAndExecuteRequests(getParams, endpoint, GetHttpClient());
|
||||||
newhighlights = JsonConvert.DeserializeObject<Highlights>(loopbody, m_JsonSerializerSettings);
|
HighlightsDto? newHighlightsDto =
|
||||||
|
JsonConvert.DeserializeObject<HighlightsDto>(loopbody, m_JsonSerializerSettings);
|
||||||
|
HighlightEntities.Highlights newHighlights = HighlightsMapper.FromDto(newHighlightsDto);
|
||||||
|
|
||||||
highlights.list.AddRange(newhighlights.list);
|
highlights.List.AddRange(newHighlights.List);
|
||||||
if (!newhighlights.hasMore)
|
if (!newHighlights.HasMore)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -479,17 +480,16 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Highlights.List list in highlights.list)
|
foreach (HighlightEntities.ListItem list in highlights.List)
|
||||||
{
|
{
|
||||||
if (!highlight_ids.Contains(list.id.ToString()))
|
if (!highlight_ids.Contains(list.Id.ToString()))
|
||||||
{
|
{
|
||||||
highlight_ids.Add(list.id.ToString());
|
highlight_ids.Add(list.Id.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string highlight_id in highlight_ids)
|
foreach (string highlight_id in highlight_ids)
|
||||||
{
|
{
|
||||||
HighlightMedia highlightMedia = new();
|
|
||||||
Dictionary<string, string> highlight_headers =
|
Dictionary<string, string> highlight_headers =
|
||||||
GetDynamicHeaders("/api2/v2/stories/highlights/" + highlight_id, string.Empty);
|
GetDynamicHeaders("/api2/v2/stories/highlights/" + highlight_id, string.Empty);
|
||||||
|
|
||||||
@ -506,61 +506,61 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
using HttpResponseMessage highlightResponse = await highlight_client.SendAsync(highlight_request);
|
using HttpResponseMessage highlightResponse = await highlight_client.SendAsync(highlight_request);
|
||||||
highlightResponse.EnsureSuccessStatusCode();
|
highlightResponse.EnsureSuccessStatusCode();
|
||||||
string highlightBody = await highlightResponse.Content.ReadAsStringAsync();
|
string highlightBody = await highlightResponse.Content.ReadAsStringAsync();
|
||||||
highlightMedia =
|
HighlightMediaDto? highlightMediaDto =
|
||||||
JsonConvert.DeserializeObject<HighlightMedia>(highlightBody, m_JsonSerializerSettings);
|
JsonConvert.DeserializeObject<HighlightMediaDto>(highlightBody, m_JsonSerializerSettings);
|
||||||
if (highlightMedia != null)
|
HighlightEntities.HighlightMedia highlightMedia = HighlightsMapper.FromDto(highlightMediaDto);
|
||||||
|
|
||||||
|
foreach (HighlightEntities.Story item in highlightMedia.Stories)
|
||||||
{
|
{
|
||||||
foreach (HighlightMedia.Story item in highlightMedia.stories)
|
if (item.Media != null && item.Media.Count > 0 && item.Media[0].CreatedAt.HasValue)
|
||||||
{
|
{
|
||||||
if (item.media[0].createdAt.HasValue)
|
await dbService.AddStory(folder, item.Id, string.Empty, "0", false, false,
|
||||||
{
|
item.Media[0].CreatedAt.Value);
|
||||||
await dbService.AddStory(folder, item.id, string.Empty, "0", false, false,
|
}
|
||||||
item.media[0].createdAt.Value);
|
else if (item.CreatedAt.HasValue)
|
||||||
}
|
{
|
||||||
else if (item.createdAt.HasValue)
|
await dbService.AddStory(folder, item.Id, string.Empty, "0", false, false,
|
||||||
{
|
item.CreatedAt.Value);
|
||||||
await dbService.AddStory(folder, item.id, string.Empty, "0", false, false,
|
}
|
||||||
item.createdAt.Value);
|
else
|
||||||
}
|
{
|
||||||
else
|
await dbService.AddStory(folder, item.Id, string.Empty, "0", false, false,
|
||||||
{
|
DateTime.Now);
|
||||||
await dbService.AddStory(folder, item.id, string.Empty, "0", false, false,
|
}
|
||||||
DateTime.Now);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.media.Count > 0 && item.media[0].canView)
|
if (item.Media != null && item.Media.Count > 0 && item.Media[0].CanView)
|
||||||
|
{
|
||||||
|
foreach (HighlightEntities.Medium medium in item.Media)
|
||||||
{
|
{
|
||||||
foreach (HighlightMedia.Medium medium in item.media)
|
string storyUrl = item.Media[0].Files?.Full?.Url ?? string.Empty;
|
||||||
|
await dbService.AddMedia(folder, medium.Id, item.Id, storyUrl, null, null, null,
|
||||||
|
"Stories",
|
||||||
|
medium.Type == "photo" ? "Images" :
|
||||||
|
medium.Type == "video" || medium.Type == "gif" ? "Videos" :
|
||||||
|
medium.Type == "audio" ? "Audios" : null, false, false, null);
|
||||||
|
if (medium.Type == "photo" && !configService.CurrentConfig.DownloadImages)
|
||||||
{
|
{
|
||||||
await dbService.AddMedia(folder, medium.id, item.id, item.media[0].files.full.url,
|
continue;
|
||||||
null, null, null, "Stories",
|
}
|
||||||
medium.type == "photo" ? "Images" :
|
|
||||||
medium.type == "video" || medium.type == "gif" ? "Videos" :
|
|
||||||
medium.type == "audio" ? "Audios" : null, false, false, null);
|
|
||||||
if (medium.type == "photo" && !configService.CurrentConfig.DownloadImages)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (medium.type == "video" && !configService.CurrentConfig.DownloadVideos)
|
if (medium.Type == "video" && !configService.CurrentConfig.DownloadVideos)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (medium.type == "gif" && !configService.CurrentConfig.DownloadVideos)
|
if (medium.Type == "gif" && !configService.CurrentConfig.DownloadVideos)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (medium.type == "audio" && !configService.CurrentConfig.DownloadAudios)
|
if (medium.Type == "audio" && !configService.CurrentConfig.DownloadAudios)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!return_urls.ContainsKey(medium.id))
|
if (!return_urls.ContainsKey(medium.Id) && !string.IsNullOrEmpty(storyUrl))
|
||||||
{
|
{
|
||||||
return_urls.Add(medium.id, item.media[0].files.full.url);
|
return_urls.Add(medium.Id, storyUrl);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1361,14 +1361,14 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<ArchivedCollection> GetArchived(string endpoint, string folder, StatusContext ctx)
|
public async Task<ArchivedModels.ArchivedCollection> GetArchived(string endpoint, string folder, StatusContext ctx)
|
||||||
{
|
{
|
||||||
Log.Debug($"Calling GetArchived - {endpoint}");
|
Log.Debug($"Calling GetArchived - {endpoint}");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Archived archived = new();
|
ArchivedModels.Archived archived = new();
|
||||||
ArchivedCollection archivedCollection = new();
|
ArchivedModels.ArchivedCollection archivedCollection = new();
|
||||||
int post_limit = 50;
|
int post_limit = 50;
|
||||||
Dictionary<string, string> getParams = new()
|
Dictionary<string, string> getParams = new()
|
||||||
{
|
{
|
||||||
@ -1406,7 +1406,7 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
archived.TailMarker);
|
archived.TailMarker);
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
Archived newarchived = new();
|
ArchivedModels.Archived newarchived = new();
|
||||||
|
|
||||||
string? loopbody = await BuildHeaderAndExecuteRequests(getParams, endpoint, GetHttpClient());
|
string? loopbody = await BuildHeaderAndExecuteRequests(getParams, endpoint, GetHttpClient());
|
||||||
ArchivedDto newarchivedDto =
|
ArchivedDto newarchivedDto =
|
||||||
@ -1429,7 +1429,7 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ListItem archive in archived.List)
|
foreach (ArchivedModels.ListItem archive in archived.List)
|
||||||
{
|
{
|
||||||
List<long> previewids = new();
|
List<long> previewids = new();
|
||||||
if (archive.Preview != null)
|
if (archive.Preview != null)
|
||||||
@ -1452,7 +1452,7 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
archivedCollection.ArchivedPostObjects.Add(archive);
|
archivedCollection.ArchivedPostObjects.Add(archive);
|
||||||
if (archive.Media != null && archive.Media.Count > 0)
|
if (archive.Media != null && archive.Media.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (Medium medium in archive.Media)
|
foreach (ArchivedModels.Medium medium in archive.Media)
|
||||||
{
|
{
|
||||||
if (medium.Type == "photo" && !configService.CurrentConfig.DownloadImages)
|
if (medium.Type == "photo" && !configService.CurrentConfig.DownloadImages)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,8 +9,7 @@ using OF_DL.Models.Post;
|
|||||||
using OF_DL.Models.Purchased;
|
using OF_DL.Models.Purchased;
|
||||||
using OF_DL.Models.Streams;
|
using OF_DL.Models.Streams;
|
||||||
using OF_DL.Enumerations;
|
using OF_DL.Enumerations;
|
||||||
using OF_DL.Models.Entities;
|
using ArchivedModels = OF_DL.Models.Entities.Archived;
|
||||||
using OF_DL.Models.Entities.Archived;
|
|
||||||
using OF_DL.Utils;
|
using OF_DL.Utils;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
@ -1037,7 +1036,7 @@ public class DownloadService(
|
|||||||
|
|
||||||
|
|
||||||
public async Task<bool> DownloadMessageMedia(string url, string folder, long media_id, string api_type,
|
public async Task<bool> DownloadMessageMedia(string url, string folder, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, List? messageInfo, Messages.Medium? messageMedia,
|
IProgressReporter progressReporter, string? filenameFormat, List? messageInfo, Medium? messageMedia,
|
||||||
Messages.FromUser? fromUser, Dictionary<string, long> users)
|
Messages.FromUser? fromUser, Dictionary<string, long> users)
|
||||||
{
|
{
|
||||||
string path;
|
string path;
|
||||||
@ -1061,7 +1060,7 @@ public class DownloadService(
|
|||||||
|
|
||||||
public async Task<bool> DownloadMessagePreviewMedia(string url, string folder, long media_id, string api_type,
|
public async Task<bool> DownloadMessagePreviewMedia(string url, string folder, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, SingleMessage? messageInfo,
|
IProgressReporter progressReporter, string? filenameFormat, SingleMessage? messageInfo,
|
||||||
Messages.Medium? messageMedia,
|
Medium? messageMedia,
|
||||||
FromUser? fromUser, Dictionary<string, long> users)
|
FromUser? fromUser, Dictionary<string, long> users)
|
||||||
{
|
{
|
||||||
string path;
|
string path;
|
||||||
@ -1085,8 +1084,8 @@ public class DownloadService(
|
|||||||
|
|
||||||
|
|
||||||
public async Task<bool> DownloadArchivedMedia(string url, string folder, long media_id, string api_type,
|
public async Task<bool> DownloadArchivedMedia(string url, string folder, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, ListItem? messageInfo,
|
IProgressReporter progressReporter, string? filenameFormat, ArchivedModels.ListItem? messageInfo,
|
||||||
OF_DL.Models.Entities.Archived.Medium? messageMedia, Models.Entities.Common.Author? author,
|
ArchivedModels.Medium? messageMedia, Models.Entities.Common.Author? author,
|
||||||
Dictionary<string, long> users)
|
Dictionary<string, long> users)
|
||||||
{
|
{
|
||||||
string path = "/Archived/Posts/Free";
|
string path = "/Archived/Posts/Free";
|
||||||
@ -1111,7 +1110,7 @@ public class DownloadService(
|
|||||||
|
|
||||||
public async Task<bool> DownloadPurchasedMedia(string url, string folder, long media_id, string api_type,
|
public async Task<bool> DownloadPurchasedMedia(string url, string folder, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, Purchased.List? messageInfo,
|
IProgressReporter progressReporter, string? filenameFormat, Purchased.List? messageInfo,
|
||||||
Messages.Medium? messageMedia,
|
Medium? messageMedia,
|
||||||
Purchased.FromUser? fromUser, Dictionary<string, long> users)
|
Purchased.FromUser? fromUser, Dictionary<string, long> users)
|
||||||
{
|
{
|
||||||
string path;
|
string path;
|
||||||
@ -1135,7 +1134,7 @@ public class DownloadService(
|
|||||||
|
|
||||||
public async Task<bool> DownloadSinglePurchasedMedia(string url, string folder, long media_id, string api_type,
|
public async Task<bool> DownloadSinglePurchasedMedia(string url, string folder, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, SingleMessage? messageInfo,
|
IProgressReporter progressReporter, string? filenameFormat, SingleMessage? messageInfo,
|
||||||
Messages.Medium? messageMedia,
|
Medium? messageMedia,
|
||||||
FromUser? fromUser, Dictionary<string, long> users)
|
FromUser? fromUser, Dictionary<string, long> users)
|
||||||
{
|
{
|
||||||
string path;
|
string path;
|
||||||
@ -1164,7 +1163,7 @@ public class DownloadService(
|
|||||||
IProgressReporter progressReporter,
|
IProgressReporter progressReporter,
|
||||||
string? filenameFormat,
|
string? filenameFormat,
|
||||||
Purchased.List? messageInfo,
|
Purchased.List? messageInfo,
|
||||||
Messages.Medium? messageMedia,
|
Medium? messageMedia,
|
||||||
Purchased.FromUser? fromUser,
|
Purchased.FromUser? fromUser,
|
||||||
Dictionary<string, long> users)
|
Dictionary<string, long> users)
|
||||||
{
|
{
|
||||||
@ -1194,7 +1193,7 @@ public class DownloadService(
|
|||||||
|
|
||||||
public async Task<bool> DownloadMessageDRMVideo(string policy, string signature, string kvp, string url,
|
public async Task<bool> DownloadMessageDRMVideo(string policy, string signature, string kvp, string url,
|
||||||
string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, List? messageInfo, Messages.Medium? messageMedia,
|
IProgressReporter progressReporter, string? filenameFormat, List? messageInfo, Medium? messageMedia,
|
||||||
Messages.FromUser? fromUser, Dictionary<string, long> users)
|
Messages.FromUser? fromUser, Dictionary<string, long> users)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -1324,7 +1323,7 @@ public class DownloadService(
|
|||||||
public async Task<bool> DownloadSingleMessagePreviewDRMVideo(string policy, string signature, string kvp,
|
public async Task<bool> DownloadSingleMessagePreviewDRMVideo(string policy, string signature, string kvp,
|
||||||
string url, string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
string url, string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, SingleMessage? messageInfo,
|
IProgressReporter progressReporter, string? filenameFormat, SingleMessage? messageInfo,
|
||||||
Messages.Medium? messageMedia,
|
Medium? messageMedia,
|
||||||
FromUser? fromUser, Dictionary<string, long> users)
|
FromUser? fromUser, Dictionary<string, long> users)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -1455,7 +1454,7 @@ public class DownloadService(
|
|||||||
public async Task<bool> DownloadPurchasedMessageDRMVideo(string policy, string signature, string kvp, string url,
|
public async Task<bool> DownloadPurchasedMessageDRMVideo(string policy, string signature, string kvp, string url,
|
||||||
string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, Purchased.List? messageInfo,
|
IProgressReporter progressReporter, string? filenameFormat, Purchased.List? messageInfo,
|
||||||
Messages.Medium? messageMedia,
|
Medium? messageMedia,
|
||||||
Purchased.FromUser? fromUser, Dictionary<string, long> users)
|
Purchased.FromUser? fromUser, Dictionary<string, long> users)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -1584,7 +1583,7 @@ public class DownloadService(
|
|||||||
public async Task<bool> DownloadSinglePurchasedMessageDRMVideo(string policy, string signature, string kvp,
|
public async Task<bool> DownloadSinglePurchasedMessageDRMVideo(string policy, string signature, string kvp,
|
||||||
string url, string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
string url, string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, SingleMessage? messageInfo,
|
IProgressReporter progressReporter, string? filenameFormat, SingleMessage? messageInfo,
|
||||||
Messages.Medium? messageMedia,
|
Medium? messageMedia,
|
||||||
FromUser? fromUser, Dictionary<string, long> users)
|
FromUser? fromUser, Dictionary<string, long> users)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -2098,7 +2097,7 @@ public class DownloadService(
|
|||||||
public async Task<bool> DownloadPurchasedPostDRMVideo(string policy, string signature, string kvp, string url,
|
public async Task<bool> DownloadPurchasedPostDRMVideo(string policy, string signature, string kvp, string url,
|
||||||
string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, Purchased.List? postInfo,
|
IProgressReporter progressReporter, string? filenameFormat, Purchased.List? postInfo,
|
||||||
Messages.Medium? postMedia,
|
Medium? postMedia,
|
||||||
Purchased.FromUser? fromUser, Dictionary<string, long> users)
|
Purchased.FromUser? fromUser, Dictionary<string, long> users)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -2228,8 +2227,8 @@ public class DownloadService(
|
|||||||
|
|
||||||
public async Task<bool> DownloadArchivedPostDRMVideo(string policy, string signature, string kvp, string url,
|
public async Task<bool> DownloadArchivedPostDRMVideo(string policy, string signature, string kvp, string url,
|
||||||
string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, ListItem? postInfo,
|
IProgressReporter progressReporter, string? filenameFormat, ArchivedModels.ListItem? postInfo,
|
||||||
OF_DL.Models.Entities.Archived.Medium? postMedia,
|
ArchivedModels.Medium? postMedia,
|
||||||
Models.Entities.Common.Author? author, Dictionary<string, long> users)
|
Models.Entities.Common.Author? author, Dictionary<string, long> users)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -2455,7 +2454,7 @@ public class DownloadService(
|
|||||||
|
|
||||||
public async Task<DownloadResult> DownloadArchived(string username, long userId, string path,
|
public async Task<DownloadResult> DownloadArchived(string username, long userId, string path,
|
||||||
Dictionary<string, long> users, bool clientIdBlobMissing, bool devicePrivateKeyMissing,
|
Dictionary<string, long> users, bool clientIdBlobMissing, bool devicePrivateKeyMissing,
|
||||||
ArchivedCollection archived, IProgressReporter progressReporter)
|
ArchivedModels.ArchivedCollection archived, IProgressReporter progressReporter)
|
||||||
{
|
{
|
||||||
Log.Debug($"Calling DownloadArchived - {username}");
|
Log.Debug($"Calling DownloadArchived - {username}");
|
||||||
|
|
||||||
@ -2512,9 +2511,9 @@ public class DownloadService(
|
|||||||
pssh);
|
pssh);
|
||||||
}
|
}
|
||||||
|
|
||||||
OF_DL.Models.Entities.Archived.Medium? mediaInfo =
|
ArchivedModels.Medium? mediaInfo =
|
||||||
archived.ArchivedPostMedia.FirstOrDefault(m => m.Id == archivedKVP.Key);
|
archived.ArchivedPostMedia.FirstOrDefault(m => m.Id == archivedKVP.Key);
|
||||||
ListItem? postInfo =
|
ArchivedModels.ListItem? postInfo =
|
||||||
archived.ArchivedPostObjects.FirstOrDefault(p => p?.Media?.Contains(mediaInfo) == true);
|
archived.ArchivedPostObjects.FirstOrDefault(p => p?.Media?.Contains(mediaInfo) == true);
|
||||||
|
|
||||||
isNew = await DownloadArchivedPostDRMVideo(
|
isNew = await DownloadArchivedPostDRMVideo(
|
||||||
@ -2542,9 +2541,9 @@ public class DownloadService(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OF_DL.Models.Entities.Archived.Medium? mediaInfo =
|
ArchivedModels.Medium? mediaInfo =
|
||||||
archived.ArchivedPostMedia.FirstOrDefault(m => m.Id == archivedKVP.Key);
|
archived.ArchivedPostMedia.FirstOrDefault(m => m.Id == archivedKVP.Key);
|
||||||
ListItem? postInfo =
|
ArchivedModels.ListItem? postInfo =
|
||||||
archived.ArchivedPostObjects.FirstOrDefault(p => p?.Media?.Contains(mediaInfo) == true);
|
archived.ArchivedPostObjects.FirstOrDefault(p => p?.Media?.Contains(mediaInfo) == true);
|
||||||
|
|
||||||
isNew = await DownloadArchivedMedia(
|
isNew = await DownloadArchivedMedia(
|
||||||
@ -2642,7 +2641,7 @@ public class DownloadService(
|
|||||||
pssh);
|
pssh);
|
||||||
}
|
}
|
||||||
|
|
||||||
Messages.Medium? mediaInfo = messages.MessageMedia.FirstOrDefault(m => m.id == messageKVP.Key);
|
Medium? mediaInfo = messages.MessageMedia.FirstOrDefault(m => m.id == messageKVP.Key);
|
||||||
List? messageInfo =
|
List? messageInfo =
|
||||||
messages.MessageObjects.FirstOrDefault(p => p?.media?.Contains(mediaInfo) == true);
|
messages.MessageObjects.FirstOrDefault(p => p?.media?.Contains(mediaInfo) == true);
|
||||||
|
|
||||||
@ -2671,7 +2670,7 @@ public class DownloadService(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Messages.Medium? mediaInfo = messages.MessageMedia.FirstOrDefault(m => m.id == messageKVP.Key);
|
Medium? mediaInfo = messages.MessageMedia.FirstOrDefault(m => m.id == messageKVP.Key);
|
||||||
List? messageInfo = messages.MessageObjects.FirstOrDefault(p => p?.media?.Contains(mediaInfo) == true);
|
List? messageInfo = messages.MessageObjects.FirstOrDefault(p => p?.media?.Contains(mediaInfo) == true);
|
||||||
|
|
||||||
isNew = await DownloadMessageMedia(
|
isNew = await DownloadMessageMedia(
|
||||||
@ -2758,7 +2757,7 @@ public class DownloadService(
|
|||||||
$"https://onlyfans.com/api2/v2/users/media/{parsed[4]}/drm/message/{parsed[5]}?type=widevine",
|
$"https://onlyfans.com/api2/v2/users/media/{parsed[4]}/drm/message/{parsed[5]}?type=widevine",
|
||||||
pssh);
|
pssh);
|
||||||
|
|
||||||
Messages.Medium? mediaInfo =
|
Medium? mediaInfo =
|
||||||
paidMessageCollection.PaidMessageMedia.FirstOrDefault(m => m.id == kvp.Key);
|
paidMessageCollection.PaidMessageMedia.FirstOrDefault(m => m.id == kvp.Key);
|
||||||
Purchased.List? messageInfo =
|
Purchased.List? messageInfo =
|
||||||
paidMessageCollection.PaidMessageObjects.FirstOrDefault(p =>
|
paidMessageCollection.PaidMessageObjects.FirstOrDefault(p =>
|
||||||
@ -2776,7 +2775,7 @@ public class DownloadService(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Messages.Medium? mediaInfo =
|
Medium? mediaInfo =
|
||||||
paidMessageCollection.PaidMessageMedia.FirstOrDefault(m => m.id == kvp.Key);
|
paidMessageCollection.PaidMessageMedia.FirstOrDefault(m => m.id == kvp.Key);
|
||||||
Purchased.List? messageInfo =
|
Purchased.List? messageInfo =
|
||||||
paidMessageCollection.PaidMessageObjects.FirstOrDefault(p => p?.media?.Contains(mediaInfo) == true);
|
paidMessageCollection.PaidMessageObjects.FirstOrDefault(p => p?.media?.Contains(mediaInfo) == true);
|
||||||
@ -3033,7 +3032,7 @@ public class DownloadService(
|
|||||||
$"https://onlyfans.com/api2/v2/users/media/{parsed[4]}/drm/post/{parsed[5]}?type=widevine",
|
$"https://onlyfans.com/api2/v2/users/media/{parsed[4]}/drm/post/{parsed[5]}?type=widevine",
|
||||||
pssh);
|
pssh);
|
||||||
|
|
||||||
Messages.Medium? mediaInfo = purchasedPosts.PaidPostMedia.FirstOrDefault(m => m.id == postKVP.Key);
|
Medium? mediaInfo = purchasedPosts.PaidPostMedia.FirstOrDefault(m => m.id == postKVP.Key);
|
||||||
Purchased.List? postInfo =
|
Purchased.List? postInfo =
|
||||||
purchasedPosts.PaidPostObjects.FirstOrDefault(p => p?.media?.Contains(mediaInfo) == true);
|
purchasedPosts.PaidPostObjects.FirstOrDefault(p => p?.media?.Contains(mediaInfo) == true);
|
||||||
|
|
||||||
@ -3049,7 +3048,7 @@ public class DownloadService(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Messages.Medium? mediaInfo = purchasedPosts.PaidPostMedia.FirstOrDefault(m => m.id == postKVP.Key);
|
Medium? mediaInfo = purchasedPosts.PaidPostMedia.FirstOrDefault(m => m.id == postKVP.Key);
|
||||||
Purchased.List? postInfo =
|
Purchased.List? postInfo =
|
||||||
purchasedPosts.PaidPostObjects.FirstOrDefault(p => p?.media?.Contains(mediaInfo) == true);
|
purchasedPosts.PaidPostObjects.FirstOrDefault(p => p?.media?.Contains(mediaInfo) == true);
|
||||||
isNew = await DownloadPurchasedPostMedia(postKVP.Value, path, postKVP.Key, "Posts", progressReporter,
|
isNew = await DownloadPurchasedPostMedia(postKVP.Value, path, postKVP.Key, "Posts", progressReporter,
|
||||||
|
|||||||
@ -5,7 +5,7 @@ using OF_DL.Models.Post;
|
|||||||
using OF_DL.Models.Purchased;
|
using OF_DL.Models.Purchased;
|
||||||
using OF_DL.Models.Streams;
|
using OF_DL.Models.Streams;
|
||||||
using OF_DL.Enumerations;
|
using OF_DL.Enumerations;
|
||||||
using OF_DL.Models.Entities.Archived;
|
using ArchivedModels = OF_DL.Models.Entities.Archived;
|
||||||
using Spectre.Console;
|
using Spectre.Console;
|
||||||
|
|
||||||
namespace OF_DL.Services;
|
namespace OF_DL.Services;
|
||||||
@ -28,7 +28,7 @@ public interface IAPIService
|
|||||||
Task<PostCollection> GetPosts(string endpoint, string folder, List<long> paid_post_ids, StatusContext ctx);
|
Task<PostCollection> GetPosts(string endpoint, string folder, List<long> paid_post_ids, StatusContext ctx);
|
||||||
Task<SinglePostCollection> GetPost(string endpoint, string folder);
|
Task<SinglePostCollection> GetPost(string endpoint, string folder);
|
||||||
Task<StreamsCollection> GetStreams(string endpoint, string folder, List<long> paid_post_ids, StatusContext ctx);
|
Task<StreamsCollection> GetStreams(string endpoint, string folder, List<long> paid_post_ids, StatusContext ctx);
|
||||||
Task<ArchivedCollection> GetArchived(string endpoint, string folder, StatusContext ctx);
|
Task<ArchivedModels.ArchivedCollection> GetArchived(string endpoint, string folder, StatusContext ctx);
|
||||||
Task<MessageCollection> GetMessages(string endpoint, string folder, StatusContext ctx);
|
Task<MessageCollection> GetMessages(string endpoint, string folder, StatusContext ctx);
|
||||||
Task<PaidMessageCollection> GetPaidMessages(string endpoint, string folder, string username, StatusContext ctx);
|
Task<PaidMessageCollection> GetPaidMessages(string endpoint, string folder, string username, StatusContext ctx);
|
||||||
Task<SinglePaidMessageCollection> GetPaidMessage(string endpoint, string folder);
|
Task<SinglePaidMessageCollection> GetPaidMessage(string endpoint, string folder);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
using OF_DL.Models;
|
using OF_DL.Models;
|
||||||
using OF_DL.Models.Entities.Archived;
|
using ArchivedModels = OF_DL.Models.Entities.Archived;
|
||||||
using OF_DL.Models.Messages;
|
using OF_DL.Models.Messages;
|
||||||
using OF_DL.Models.Post;
|
using OF_DL.Models.Post;
|
||||||
using OF_DL.Models.Purchased;
|
using OF_DL.Models.Purchased;
|
||||||
@ -17,14 +17,14 @@ public interface IDownloadService
|
|||||||
string serverFileName, string resolvedFileName, string extension, IProgressReporter progressReporter);
|
string serverFileName, string resolvedFileName, string extension, IProgressReporter progressReporter);
|
||||||
|
|
||||||
Task<bool> DownloadArchivedMedia(string url, string folder, long media_id, string api_type,
|
Task<bool> DownloadArchivedMedia(string url, string folder, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, ListItem? messageInfo,
|
IProgressReporter progressReporter, string? filenameFormat, ArchivedModels.ListItem? messageInfo,
|
||||||
OF_DL.Models.Entities.Archived.Medium? messageMedia, Models.Entities.Common.Author? author,
|
ArchivedModels.Medium? messageMedia, Models.Entities.Common.Author? author,
|
||||||
Dictionary<string, long> users);
|
Dictionary<string, long> users);
|
||||||
|
|
||||||
Task<bool> DownloadArchivedPostDRMVideo(string policy, string signature, string kvp, string url,
|
Task<bool> DownloadArchivedPostDRMVideo(string policy, string signature, string kvp, string url,
|
||||||
string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, ListItem? postInfo,
|
IProgressReporter progressReporter, string? filenameFormat, ArchivedModels.ListItem? postInfo,
|
||||||
OF_DL.Models.Entities.Archived.Medium? postMedia,
|
ArchivedModels.Medium? postMedia,
|
||||||
Models.Entities.Common.Author? author, Dictionary<string, long> users);
|
Models.Entities.Common.Author? author, Dictionary<string, long> users);
|
||||||
|
|
||||||
Task<bool> DownloadPostDRMVideo(string policy, string signature, string kvp, string url, string decryptionKey,
|
Task<bool> DownloadPostDRMVideo(string policy, string signature, string kvp, string url, string decryptionKey,
|
||||||
@ -41,11 +41,11 @@ public interface IDownloadService
|
|||||||
|
|
||||||
Task<bool> DownloadMessageDRMVideo(string policy, string signature, string kvp, string url, string decryptionKey,
|
Task<bool> DownloadMessageDRMVideo(string policy, string signature, string kvp, string url, string decryptionKey,
|
||||||
string folder, DateTime lastModified, long media_id, string api_type, IProgressReporter progressReporter,
|
string folder, DateTime lastModified, long media_id, string api_type, IProgressReporter progressReporter,
|
||||||
string? filenameFormat, List? messageInfo, Messages.Medium? messageMedia, Messages.FromUser? fromUser,
|
string? filenameFormat, List? messageInfo, Medium? messageMedia, Messages.FromUser? fromUser,
|
||||||
Dictionary<string, long> users);
|
Dictionary<string, long> users);
|
||||||
|
|
||||||
Task<bool> DownloadMessageMedia(string url, string folder, long media_id, string api_type,
|
Task<bool> DownloadMessageMedia(string url, string folder, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, List? messageInfo, Messages.Medium? messageMedia,
|
IProgressReporter progressReporter, string? filenameFormat, List? messageInfo, Medium? messageMedia,
|
||||||
Messages.FromUser? fromUser, Dictionary<string, long> users);
|
Messages.FromUser? fromUser, Dictionary<string, long> users);
|
||||||
|
|
||||||
Task<bool> DownloadPostMedia(string url, string folder, long media_id, string api_type,
|
Task<bool> DownloadPostMedia(string url, string folder, long media_id, string api_type,
|
||||||
@ -58,35 +58,35 @@ public interface IDownloadService
|
|||||||
|
|
||||||
Task<bool> DownloadPurchasedMedia(string url, string folder, long media_id, string api_type,
|
Task<bool> DownloadPurchasedMedia(string url, string folder, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, Purchased.List? messageInfo,
|
IProgressReporter progressReporter, string? filenameFormat, Purchased.List? messageInfo,
|
||||||
Messages.Medium? messageMedia,
|
Medium? messageMedia,
|
||||||
Purchased.FromUser? fromUser, Dictionary<string, long> users);
|
Purchased.FromUser? fromUser, Dictionary<string, long> users);
|
||||||
|
|
||||||
Task<bool> DownloadSinglePurchasedMedia(string url, string folder, long media_id, string api_type,
|
Task<bool> DownloadSinglePurchasedMedia(string url, string folder, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, SingleMessage? messageInfo,
|
IProgressReporter progressReporter, string? filenameFormat, SingleMessage? messageInfo,
|
||||||
Messages.Medium? messageMedia,
|
Medium? messageMedia,
|
||||||
FromUser? fromUser, Dictionary<string, long> users);
|
FromUser? fromUser, Dictionary<string, long> users);
|
||||||
|
|
||||||
Task<bool> DownloadPurchasedMessageDRMVideo(string policy, string signature, string kvp, string url,
|
Task<bool> DownloadPurchasedMessageDRMVideo(string policy, string signature, string kvp, string url,
|
||||||
string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, Purchased.List? messageInfo,
|
IProgressReporter progressReporter, string? filenameFormat, Purchased.List? messageInfo,
|
||||||
Messages.Medium? messageMedia,
|
Medium? messageMedia,
|
||||||
Purchased.FromUser? fromUser, Dictionary<string, long> users);
|
Purchased.FromUser? fromUser, Dictionary<string, long> users);
|
||||||
|
|
||||||
Task<bool> DownloadSinglePurchasedMessageDRMVideo(string policy, string signature, string kvp, string url,
|
Task<bool> DownloadSinglePurchasedMessageDRMVideo(string policy, string signature, string kvp, string url,
|
||||||
string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, SingleMessage? messageInfo,
|
IProgressReporter progressReporter, string? filenameFormat, SingleMessage? messageInfo,
|
||||||
Messages.Medium? messageMedia,
|
Medium? messageMedia,
|
||||||
FromUser? fromUser, Dictionary<string, long> users);
|
FromUser? fromUser, Dictionary<string, long> users);
|
||||||
|
|
||||||
Task<bool> DownloadPurchasedPostDRMVideo(string policy, string signature, string kvp, string url,
|
Task<bool> DownloadPurchasedPostDRMVideo(string policy, string signature, string kvp, string url,
|
||||||
string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, Purchased.List? postInfo,
|
IProgressReporter progressReporter, string? filenameFormat, Purchased.List? postInfo,
|
||||||
Messages.Medium? postMedia,
|
Medium? postMedia,
|
||||||
Purchased.FromUser? fromUser, Dictionary<string, long> users);
|
Purchased.FromUser? fromUser, Dictionary<string, long> users);
|
||||||
|
|
||||||
Task<bool> DownloadPurchasedPostMedia(string url, string folder, long media_id, string api_type,
|
Task<bool> DownloadPurchasedPostMedia(string url, string folder, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, Purchased.List? messageInfo,
|
IProgressReporter progressReporter, string? filenameFormat, Purchased.List? messageInfo,
|
||||||
Messages.Medium? messageMedia,
|
Medium? messageMedia,
|
||||||
Purchased.FromUser? fromUser, Dictionary<string, long> users);
|
Purchased.FromUser? fromUser, Dictionary<string, long> users);
|
||||||
|
|
||||||
Task<bool> DownloadStoryMedia(string url, string folder, long media_id, string api_type,
|
Task<bool> DownloadStoryMedia(string url, string folder, long media_id, string api_type,
|
||||||
@ -104,12 +104,12 @@ public interface IDownloadService
|
|||||||
Task<bool> DownloadSingleMessagePreviewDRMVideo(string policy, string signature, string kvp, string url,
|
Task<bool> DownloadSingleMessagePreviewDRMVideo(string policy, string signature, string kvp, string url,
|
||||||
string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, SingleMessage? messageInfo,
|
IProgressReporter progressReporter, string? filenameFormat, SingleMessage? messageInfo,
|
||||||
Messages.Medium? messageMedia,
|
Medium? messageMedia,
|
||||||
FromUser? fromUser, Dictionary<string, long> users);
|
FromUser? fromUser, Dictionary<string, long> users);
|
||||||
|
|
||||||
Task<bool> DownloadMessagePreviewMedia(string url, string folder, long media_id, string api_type,
|
Task<bool> DownloadMessagePreviewMedia(string url, string folder, long media_id, string api_type,
|
||||||
IProgressReporter progressReporter, string? filenameFormat, SingleMessage? messageInfo,
|
IProgressReporter progressReporter, string? filenameFormat, SingleMessage? messageInfo,
|
||||||
Messages.Medium? messageMedia,
|
Medium? messageMedia,
|
||||||
FromUser? fromUser, Dictionary<string, long> users);
|
FromUser? fromUser, Dictionary<string, long> users);
|
||||||
|
|
||||||
Task<DownloadResult> DownloadHighlights(string username, long userId, string path, HashSet<long> paidPostIds,
|
Task<DownloadResult> DownloadHighlights(string username, long userId, string path, HashSet<long> paidPostIds,
|
||||||
@ -119,7 +119,7 @@ public interface IDownloadService
|
|||||||
IProgressReporter progressReporter);
|
IProgressReporter progressReporter);
|
||||||
|
|
||||||
Task<DownloadResult> DownloadArchived(string username, long userId, string path, Dictionary<string, long> users,
|
Task<DownloadResult> DownloadArchived(string username, long userId, string path, Dictionary<string, long> users,
|
||||||
bool clientIdBlobMissing, bool devicePrivateKeyMissing, ArchivedCollection archived,
|
bool clientIdBlobMissing, bool devicePrivateKeyMissing, ArchivedModels.ArchivedCollection archived,
|
||||||
IProgressReporter progressReporter);
|
IProgressReporter progressReporter);
|
||||||
|
|
||||||
Task<DownloadResult> DownloadMessages(string username, long userId, string path, Dictionary<string, long> users,
|
Task<DownloadResult> DownloadMessages(string username, long userId, string path, Dictionary<string, long> users,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user