Copyleaks SDK is a simple framework that allows you to perform plagiarism scans and track content distribution around the web, using Copyleaks cloud.
With Copyleaks SDK you can submit for scan:
- Webpages
- Local files - pdf, doc, docx, rtf and more (see full list)
- Free text
- OCR (Optical Character Recognition) - scanning pictures containing textual content (see full list)
You can integrate with the Copyleaks SDK in one of two ways:
- Download the code from here, compile it and add reference to the assembly.
- Add CopyleaksAPI NuGet by running the following command in the Package Manager Console
Install-Package CopyleaksAPI
To use the Copyleaks API you need to be a registered user. Signing up is quick and free of charge.
Signup to Copyleaks and confirm your account by clicking the link on the confirmation email. Generate your personal API key on your dashboard (Businesses dashboard/Academic dashboard/Websites dashboard) under 'Access Keys'.
For more information check out our API guide.
This code will show you where the textual content in the parameter ‘url’ has been used online:
using System; using System.Threading; using Copyleaks.SDK.API; using Copyleaks.SDK.API.Exceptions; using Copyleaks.SDK.API.Models; //... private static void Scan(string email, string apiKey, string url) { CopyleaksCloud copyleaks = new CopyleaksCloud(); CopyleaksProcess createdProcess; ProcessOptions scanOptions = new ProcessOptions() { // SandboxMode = true // -------------------> Read more https://api.copyleaks.com/Documentation/RequestHeaders#sandbox-mode }; try { #region Login to Copyleaks cloud Console.Write("Login to Copyleaks cloud..."); copyleaks.Login(email, apiKey); Console.WriteLine("Done!"); #endregion #region Checking account balance Console.Write("Checking account balance..."); uint creditsBalance = copyleaks.Credits; Console.WriteLine("Done ({0} credits)!", creditsBalance); if (creditsBalance == 0) { Console.WriteLine("ERROR: You do not have enough credits to complete this scan. Your current credit balance is {0}).", creditsBalance); Environment.Exit(2); } #endregion #region Submitting a new scan process to the server Console.Write("Creating process..."); createdProcess = copyleaks.CreateByUrl(new Uri(url), scanOptions); Console.WriteLine("Done (PID={0})!", createdProcess.PID); #endregion #region Waiting for server's process completion Console.Write("Scanning... "); ushort currentProgress; while (!createdProcess.IsCompleted(out currentProgress)) Thread.Sleep(5000); Console.WriteLine("Done."); #endregion #region Processing finished. Getting results ResultRecord[] results = createdProcess.GetResults(); if (results.Length == 0) { Console.WriteLine("No results."); } else { for (int i = 0; i < results.Length; ++i) { Console.WriteLine(); Console.WriteLine("Result {0}:", i + 1); Console.WriteLine("Url: {0}", results[i].URL); Console.WriteLine("Percents: {0}", results[i].Percents); Console.WriteLine("CopiedWords: {0}", results[i].NumberOfCopiedWords); } } #endregion } catch (UnauthorizedAccessException) { Console.WriteLine("Failed!"); Console.WriteLine("Authentication with the server failed!"); Console.WriteLine("Possible reasons:"); Console.WriteLine("* You did not log in to Copyleaks cloud"); Console.WriteLine("* Your login token has expired"); } catch (CommandFailedException theError) { Console.WriteLine("Failed!"); Console.WriteLine("*** Error {0}:", theError.CopyleaksErrorCode); Console.WriteLine("{0}", theError.Message); } }