Skip to content

.NET Standard library for downloading video from local storage of Blink cameras

License

Notifications You must be signed in to change notification settings

bvdcode/Blink.NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License NuGet NuGet version FuGet Build CodeFactor Repo size

Blink.NET

A .NET library (netstandard2.1) for accessing local Blink camera storage: fetching the list of clips, downloading and deleting videos. Works on runtimes that support .NET Standard 2.1 (for example .NET 6/7/8/9, .NET Core 3.0+).

Features

  • Login/password authorization and PIN confirmation (2FA).
  • Fetching dashboard data and the list of Sync Modules.
  • Getting the list of clips from a module's local storage.
  • Download a clip as a byte array.
  • Delete a clip from the device.
  • Configurable delay between requests to stabilize the API.

Installation

Via .NET CLI:

dotnet add package Blink.NET

Via PackageReference:

<ItemGroup>
    <PackageReference Include="Blink.NET" Version="x.y.z" />
    <!-- see the latest version on https://www.nuget.org/packages/Blink.NET/ -->
</ItemGroup>

Quick start

Simple scenario: authorize, confirm PIN (if required), download clips from a single Sync Module.

using Blink;

var client = new BlinkClient();

// Authorization (reauth:true emulates Blink app behavior)
var auth = await client.AuthorizeAsync(email: "you@example.com", password: "YourPassword", reauth: true);

// If the server requires client verification — enter PIN from SMS and confirm
if (auth.Account.IsClientVerificationRequired)
{
        Console.Write("Enter PIN: ");
        var code = Console.ReadLine();
        await client.VerifyPinAsync(code);
}

// Get clips from a single Sync Module (throws if there are multiple modules)
var videos = await client.GetVideosFromSingleModuleAsync();

// Download the first clip as bytes
var first = videos.First();
byte[] bytes = await client.GetVideoBytesAsync(first);
File.WriteAllBytes($"{first.Id}.mp4", bytes);

Step-by-step usage

  1. Authorization and, if necessary, PIN confirmation:
var auth = await client.AuthorizeAsync(email, password, reauth: true);
if (auth.Account.IsClientVerificationRequired)
{
        await client.VerifyPinAsync(pinFromSms);
}
  1. Get Sync Modules and clips:
var dashboard = await client.GetDashboardAsync();
var module = dashboard.SyncModules.Single(); // choose the desired module
var videos = await client.GetVideosFromModuleAsync(module);
  1. Download a clip and (optionally) delete it:
var data = await client.GetVideoBytesAsync(video);
await File.WriteAllBytesAsync($"{video.Id}.mp4", data);

// if needed — delete the clip from the device
// await client.DeleteVideoAsync(video);

Client settings

  • GeneralSleepTime (int, default 3500 ms) Small delay between requests. Without it the server may sometimes return an empty response. You can reduce or disable it if your environment is stable.

  • UniqueId (string) A unique identifier for the device/client that helps avoid repeated PIN verification. By default generated as a Guid.

Note: If you don't set this property, a new GUID will be generated each time you create a BlinkClient instance. This may lead to frequent requests for PIN verification, as the server treats each new GUID as a new device. To minimize the need for repeated PIN confirmations, it's recommended to set UniqueId to a consistent value (like a fixed GUID or a hash of your email) that remains the same across sessions.

Brief API overview

  • Task AuthorizeAsync(string email, string password, bool reauth = true)
  • Task VerifyPinAsync(string code)
  • Task GetDashboardAsync()
  • Task<IEnumerable> GetVideosFromModuleAsync(SyncModule module)
  • Task<IEnumerable> GetVideosFromSingleModuleAsync()
  • Task<byte[]> GetVideoBytesAsync(BlinkVideoInfo video, int tryCount = 3)
  • Task DeleteVideoAsync(BlinkVideoInfo video)

See models and exceptions in Sources/Blink/Models and Sources/Blink/Exceptions.

Sample console application from the repository

There is a small example in Sources/Blink.ConsoleTest:

  1. Create a secrets.json file next to Program.cs with your login/password:
{
  "email": "you@example.com",
  "password": "YourPassword"
}
  1. Build and run:
cd Sources/Blink.ConsoleTest
dotnet build
dotnet run

Requirements and limitations

  • A Blink account and at least one Sync Module with local storage are required.
  • Client verification (PIN via SMS) is often enabled. This is normal behavior.
  • The Blink API can be unstable without pauses between requests — use GeneralSleepTime.

Security

  • Do not store login/password in the repository. Use user secrets, environment variables, or encrypted stores.
  • Remove tokens and personal data from logs before publishing.

Building from source

dotnet build Sources/Blink/Blink.csproj

Disclaimer

This project is not affiliated with Blink, Amazon, or any other companies. Use at your own risk and in accordance with Blink's terms of service.

License

MIT — see LICENSE.md.

About

.NET Standard library for downloading video from local storage of Blink cameras

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages