DuckDuckGoDotNet 0.5.0

dotnet add package DuckDuckGoDotNet --version 0.5.0
                    
NuGet\Install-Package DuckDuckGoDotNet -Version 0.5.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DuckDuckGoDotNet" Version="0.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DuckDuckGoDotNet" Version="0.5.0" />
                    
Directory.Packages.props
<PackageReference Include="DuckDuckGoDotNet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DuckDuckGoDotNet --version 0.5.0
                    
#r "nuget: DuckDuckGoDotNet, 0.5.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DuckDuckGoDotNet@0.5.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DuckDuckGoDotNet&version=0.5.0
                    
Install as a Cake Addin
#tool nuget:?package=DuckDuckGoDotNet&version=0.5.0
                    
Install as a Cake Tool

MIT license

DuckDuckGo

جستجو برای متن، اخبار، تصاویر و ویدیوها با استفاده از موتور جستجوی DuckDuckGo.com، پیاده‌سازی شده در سی شارپ.

طراحی این کتاب خانه از کتاب خانه duckduckgo_search الگو برداری شده.

درصورت داشتن هر گونه پیشنهاد یا مشکل حتما ایشو درست کنید.

English version

فهرست مطالب

نصب

برای نصب این کتابخانه در پروژه خود باید از نوگت این کتاب خانه را دانلود کنید.

dotnet add DuckDuckGoDotNet

پروکسی

پکیج از پروکسی‌های http/https/socks پشتیبانی می‌کند. مثال: http://user:pass@example.com:3128. از یک پروکسی چرخشی استفاده کنید. در غیر این صورت، با هر بار مقداردهی اولیه کلاس DuckDuckGoSearch از یک پروکسی جدید استفاده کنید.

جستوجو

عملیات جست و جو رو با دستور TextAsync میتوانید انجام دهید.

        /// <summary>
        /// DuckDuckGo text search. Query params: https://duckduckgo.com/params.
        /// </summary>
        /// <param name="keywords">Keywords for query.</param>
        /// <param name="region">wt-wt, us-en, uk-en, ru-ru, etc. Defaults to "wt-wt".</param>
        /// <param name="safesearch">on, moderate, off. Defaults to "moderate".</param>
        /// <param name="timelimit">d, w, m, y. Defaults to null.</param>
        /// <param name="backend">auto, html, lite. Defaults to "auto".
        ///     auto - try all backends in random order,
        ///     html - collect data from https://html.duckduckgo.com,
        ///     lite - collect data from https://lite.duckduckgo.com.
        /// </param>
        /// <param name="maxResults">Max number of results. If null, returns results only from the first response. Defaults to null.</param>
        /// <returns>List of search results.</returns>
        public async Task<IEnumerable<TextSearchItem>> TextAsync(
            string keywords,
            string region = "wt-wt",
            string safesearch = "moderate",
            string timelimit = null,
            string backend = "auto",
            int? maxResults = null)

نمونه

var search=await (new DuckDuckGoSearch()).Text("Iran");
foreach (var item in search)
{
    var a=item["title"];
    Console.WriteLine(a);
}

تصویر

عملیات جست و جو تصویر رو با دستور ImagesAsync میتوانید انجام دهید.

 /// <summary>
        /// DuckDuckGo images search. Query params: https://duckduckgo.com/params.
        /// </summary>
        /// <param name="keywords">Keywords for query.</param>
        /// <param name="region">wt-wt, us-en, uk-en, ru-ru, etc. Defaults to "wt-wt".</param>
        /// <param name="safesearch">on, moderate, off. Defaults to "moderate".</param>
        /// <param name="timelimit">Day, Week, Month, Year. Defaults to null.</param>
        /// <param name="size">Small, Medium, Large, Wallpaper. Defaults to null.</param>
        /// <param name="color">color, Monochrome, Red, Orange, Yellow, Green, Blue,
        ///     Purple, Pink, Brown, Black, Gray, Teal, White. Defaults to null.</param>
        /// <param name="typeImage">photo, clipart, gif, transparent, line.
        ///     Defaults to null.</param>
        /// <param name="layout">Square, Tall, Wide. Defaults to null.</param>
        /// <param name="licenseImage">any (All Creative Commons), Public (PublicDomain),
        ///     Share (Free to Share and Use), ShareCommercially (Free to Share and Use Commercially),
        ///     Modify (Free to Modify, Share, and Use), ModifyCommercially (Free to Modify, Share, and
        ///     Use Commercially). Defaults to null.</param>
        /// <param name="maxResults">Max number of results. If null, returns results only from the first response. Defaults to null.</param>
        /// <returns>List of image search results.</returns>
        public async Task<IEnumerable<ImageSearchItem>> ImagesAsync(
            string keywords,
            string region = "wt-wt",
            string safesearch = "moderate",
            string timelimit = null,
            string size = null,
            string color = null,
            string typeImage = null,
            string layout = null,
            string licenseImage = null,
            int? maxResults = null)

فیلم

عملیات جست و جو فیلم رو با دستور VideosAsync میتوانید انجام دهید.

/// <summary>
        /// DuckDuckGo videos search. Query params: https://duckduckgo.com/params.
        /// </summary>
        /// <param name="keywords">Keywords for query.</param>
        /// <param name="region">wt-wt, us-en, uk-en, ru-ru, etc. Defaults to "wt-wt".</param>
        /// <param name="safesearch">on, moderate, off. Defaults to "moderate".</param>
        /// <param name="timelimit">d, w, m. Defaults to null.</param>
        /// <param name="resolution">high, standard. Defaults to null.</param>
        /// <param name="duration">short, medium, long. Defaults to null.</param>
        /// <param name="licenseVideos">creativeCommon, youtube. Defaults to null.</param>
        /// <param name="maxResults">Max number of results. If null, returns results only from the first response. Defaults to null.</param>
        /// <returns>List of dictionaries with video search results.</returns>
        public async Task<IEnumerable<NewsSearchItem>> VideosAsync(
            string keywords,
            string region = "wt-wt",
            string safesearch = "moderate",
            string timelimit = null,
            string resolution = null,
            string duration = null,
            string licenseVideos = null,
            int? maxResults = null)

اخبار

عملیات جست و جو اخبار رو با دستور NewsAsync میتوانید انجام دهید.

        /// <summary>
        /// DuckDuckGo news search. Query params: https://duckduckgo.com/params.
        /// </summary>
        /// <param name="keywords">Keywords for query.</param>
        /// <param name="region">wt-wt, us-en, uk-en, ru-ru, etc. Defaults to "wt-wt".</param>
        /// <param name="safesearch">on, moderate, off. Defaults to "moderate".</param>
        /// <param name="timelimit">d, w, m. Defaults to null.</param>
        /// <param name="maxResults">Max number of results. If null, returns results only from the first response. Defaults to null.</param>
        /// <returns>List of news search results.</returns>
        public async Task<IEnumerable<NewsSearchItem>> NewsAsync(
            string keywords,
            string region = "wt-wt",
            string safesearch = "moderate",
            string timelimit = null,
            int? maxResults = null)

سلب مسئولیت

این کتابخانه هیچ وابستگی به DuckDuckGo ندارد و صرفاً برای اهداف آموزشی طراحی شده است. این کتابخانه برای استفاده تجاری یا هر هدفی که نقض شرایط خدمات DuckDuckGo باشد در نظر گرفته نشده است. با استفاده از این کتابخانه، شما تأیید می‌کنید که از آن به شکلی که شرایط DuckDuckGo را نقض کند استفاده نخواهید کرد. وب‌سایت رسمی DuckDuckGo در آدرس https://duckduckgo.com قابل دسترسی است.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on DuckDuckGoDotNet:

Package Downloads
DuckDuckGoSearchSK

The plugin of Duck duck go search in Semantic Kernel

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.5.0 162 5/28/2025
0.4.0 102 5/23/2025
0.3.1 473 3/26/2025
0.3.0 464 3/24/2025
0.2.0 277 3/23/2025
0.1.0 151 3/17/2025