BingWallpaper API is for you to download bing daily wallpaper at ease.
Give it a go from Nuget
To Use this library your friend will be this interface IBingWallpaperService
.
Two ways of getting the instance
- Factory:
BingWallpaperService.CreateService()
OR
- Service Collection Extension
services.AddBingWallpaper()
var bingWallpaper = BingWallpaperInstaller.CreateService();
var source = bingWallpaper.GetDailyWallpaperInfo(15);
foreach (var imageUrl in source)
{
Console.WriteLine($"Title: {imageUrl.Title}");
bingWallpaper.Download(imageUrl.Url!, imageUrl.Title!.Trim(), "png", "D://");
}
public Controller {
private readonly IBingWallpaperService _service;
Controller(IBingWallpaperService service) => _service = service;
[HttpGet()]
public async Task<IActionResult> GetWallpaperSource(int count){
var source = await bingWallpaper.GetDailyWallpaperInfoAsync(count);
return OK(source);
}
}
Made ❤ with C#.