DuckDuckGoDotNet 0.5.0
dotnet add package DuckDuckGoDotNet --version 0.5.0
NuGet\Install-Package DuckDuckGoDotNet -Version 0.5.0
<PackageReference Include="DuckDuckGoDotNet" Version="0.5.0" />
<PackageVersion Include="DuckDuckGoDotNet" Version="0.5.0" />
<PackageReference Include="DuckDuckGoDotNet" />
paket add DuckDuckGoDotNet --version 0.5.0
#r "nuget: DuckDuckGoDotNet, 0.5.0"
#:package DuckDuckGoDotNet@0.5.0
#addin nuget:?package=DuckDuckGoDotNet&version=0.5.0
#tool nuget:?package=DuckDuckGoDotNet&version=0.5.0
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 | Versions 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. |
-
net9.0
- HtmlAgilityPack (>= 1.12.0)
- Microsoft.Extensions.Logging (>= 9.0.3)
- Microsoft.Extensions.Logging.Console (>= 9.0.3)
- System.Linq.Async (>= 6.0.1)
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.