AngleSharp.Js
1.0.0-beta.27
See the version list below for details.
dotnet add package AngleSharp.Js --version 1.0.0-beta.27
NuGet\Install-Package AngleSharp.Js -Version 1.0.0-beta.27
<PackageReference Include="AngleSharp.Js" Version="1.0.0-beta.27" />
paket add AngleSharp.Js --version 1.0.0-beta.27
#r "nuget: AngleSharp.Js, 1.0.0-beta.27"
// Install AngleSharp.Js as a Cake Addin #addin nuget:?package=AngleSharp.Js&version=1.0.0-beta.27&prerelease // Install AngleSharp.Js as a Cake Tool #tool nuget:?package=AngleSharp.Js&version=1.0.0-beta.27&prerelease
AngleSharp.Js
AngleSharp.Js extends the core AngleSharp library with a .NET-based JavaScript engine.
Basic Configuration
If you just want a configuration that works you should use the following code:
var config = Configuration.Default
.WithJs(); // from AngleSharp.Js
This will register a scripting engine for JS files. The JS parsing options and more could be set with parameters of the WithJs
method.
You can also use this part with a console for logging. The call for this is WithConsoleLogger
, e.g.,
var config = Configuration.Default
.WithJs()
.WithConsoleLogger(ctx => new MyConsoleLogger(ctx));
in the previous example MyConsoleLogger
refers to a class implementing the IConsoleLogger
interface. Examples of classes implementing this interface are available in our samples repository.
Extension Methods
This plugin also delivers some extension methods to be used together with elements from AngleSharp, e.g., IDocument
or IElement
.
For instance, the following waits until a stable point has been reached (and the document is fully available):
var context = BrowsingContext.New(config);
var document = await context.OpenAsync(address)
.WaitUntilAvailable();
Scripts can also be run in the context of the document, where the result of the last expression is returned:
var numEntries = document.ExecuteScript("document.querySelectorAll('div').length");
Vision and Status
The repository contains DOM bindings for the Jint JavaScript engine. Jint is fully ECMAScript 5 compatible and provides the basis for evaluating JavaScripts in the context of the AngleSharp DOM representation.
The library comes with a service that exposes WithJs
to IConfiguration
. This enables automatic evaluation of script
elements that have a valid JavaScript type (or without any explicit type, since JavaScript is the default one). The DOM bindings are generated on the fly via reflection. Since Jint is interpreting JavaScript, the library can be published in compatibility with .NET Standard (2.0). The downside is that the performance is definitely worse than any compiled JavaScript engine would deliver. For most scripts that should not be a big issue.
Features
- Support of ES5 through Jint
- Connection to the DOM
- Evaluation of simple scripts (incl. jQuery)
Participating
Participation in the project is highly welcome. For this project the same rules as for the AngleSharp core project may be applied.
If you have any question, concern, or spot an issue then please report it before opening a pull request. An initial discussion is appreciated regardless of the nature of the problem.
Live discussions can take place in our Gitter chat, which supports using GitHub accounts.
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community.
For more information see the .NET Foundation Code of Conduct.
.NET Foundation
This project is supported by the .NET Foundation.
License
The MIT License (MIT)
Copyright (c) 2015 - 2024 AngleSharp
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- AngleSharp (>= 1.0.0 && < 2.0.0)
- Jint (>= 3.0.0 && < 4.0.0)
-
.NETFramework 4.7.2
- AngleSharp (>= 1.0.0 && < 2.0.0)
- Jint (>= 3.0.0 && < 4.0.0)
-
.NETStandard 2.0
- AngleSharp (>= 1.0.0 && < 2.0.0)
- Jint (>= 3.0.0 && < 4.0.0)
-
net6.0
- AngleSharp (>= 1.0.0 && < 2.0.0)
- Jint (>= 3.0.0 && < 4.0.0)
-
net7.0
- AngleSharp (>= 1.0.0 && < 2.0.0)
- Jint (>= 3.0.0 && < 4.0.0)
-
net8.0
- AngleSharp (>= 1.0.0 && < 2.0.0)
- Jint (>= 3.0.0 && < 4.0.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on AngleSharp.Js:
Package | Downloads |
---|---|
Jsonize.Parser
Parser engine for the package Jsonize |
|
ErinaScraper
Libreria para obtener informacion de varios sitios de manga |
|
JackWFinlay.Jsonize.Parser.AngleSharp
Package Description |
|
pkhmelyov.InstagramDownloader
Package Description |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on AngleSharp.Js:
Repository | Stars |
---|---|
CodeMazeBlog/CodeMazeGuides
The main repository for all the Code Maze guides
|
|
Decimation/SmartImage
Reverse image search tool (SauceNao, IQDB, Ascii2D, trace.moe, and more)
|
Version | Downloads | Last updated |
---|---|---|
1.0.0-beta.36 | 382 | 7/24/2024 |
1.0.0-beta.34 | 248 | 4/13/2024 |
1.0.0-beta.31 | 67 | 4/13/2024 |
1.0.0-beta.27 | 97 | 3/25/2024 |
1.0.0-beta.25 | 74 | 3/18/2024 |
1.0.0-beta.20 | 160 | 3/1/2024 |
0.15.0 | 160,359 | 6/13/2021 |
0.15.0-beta.16 | 74 | 3/1/2024 |
0.15.0-alpha-8 | 3,360 | 11/25/2021 |
0.15.0-alpha-4 | 241 | 6/12/2021 |
0.15.0-alpha-3 | 226 | 6/12/2021 |
0.15.0-alpha-2 | 239 | 6/12/2021 |
0.14.0 | 87,279 | 4/1/2020 |
0.14.0-alpha-134 | 398 | 4/1/2020 |
0.14.0-alpha-132 | 418 | 4/1/2020 |
0.14.0-alpha-130 | 479 | 3/31/2020 |
0.14.0-alpha-128 | 467 | 3/31/2020 |
0.14.0-alpha-1 | 242 | 4/22/2021 |
0.13.0 | 11,657 | 9/24/2019 |
0.13.0-alpha-124 | 421 | 9/24/2019 |
0.13.0-alpha-122 | 462 | 9/24/2019 |
0.13.0-alpha-114 | 568 | 5/23/2019 |
0.13.0-alpha-113 | 497 | 5/21/2019 |
0.13.0-alpha-112 | 514 | 5/20/2019 |
0.13.0-alpha-111 | 519 | 5/18/2019 |
0.13.0-alpha-110 | 463 | 5/16/2019 |
0.12.1 | 23,239 | 5/14/2019 |
0.12.0 | 690 | 5/14/2019 |