-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
David Robinson
committed
Oct 17, 2024
1 parent
59357ac
commit 0adedd1
Showing
16 changed files
with
193 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
using CocoCrawler.Job.PageBrowserActions; | ||
using CocoCrawler.Job.PageTasks; | ||
using CocoCrawler.Outputs; | ||
using Newtonsoft.Json.Linq; | ||
using System.Collections.Immutable; | ||
|
||
namespace CocoCrawler.Job; | ||
|
||
public record PageCrawlJob( | ||
string Url, | ||
ImmutableArray<IPageCrawlTask> Tasks, | ||
ImmutableArray<ICrawlOutput> Outputs, | ||
PageActions? BrowserActions = null); | ||
ImmutableArray<ICrawlOutput> Outputs, | ||
PageActions? BrowserActions = null, | ||
int PageLoadTimeoutInMs = 1000, | ||
string? PageName = null, | ||
string? Parent = null); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
CocoCrawler/CrawlOutputs/ConsoleCrawlHierarchicalOutput.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using CocoCrawler.Job; | ||
using CocoCrawler.Outputs; | ||
using Newtonsoft.Json.Linq; | ||
|
||
namespace CocoCrawler.CrawlOutputs; | ||
|
||
public class ConsoleCrawlHierarchicalOutput : IHierarchicalCrawlOutput | ||
{ | ||
public Task Initialize(CancellationToken cancellationToken) => Task.CompletedTask; | ||
|
||
public Task WriteAsync(JObject obj, CancellationToken _) => throw new NotImplementedException(); | ||
|
||
|
||
public Task WriteAsync(JObject jObject, PageCrawlJob job, CancellationToken cancellationToken) | ||
{ | ||
|
||
Console.WriteLine(JToken.FromObject(new { job.PageName, job.Parent, job.Url, children = jObject})); | ||
|
||
return Task.CompletedTask; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using CocoCrawler.Job; | ||
using Newtonsoft.Json.Linq; | ||
|
||
namespace CocoCrawler.Outputs; | ||
|
||
public interface IHierarchicalCrawlOutput: ICrawlOutput | ||
{ | ||
Task WriteAsync(JObject jObject, PageCrawlJob job, CancellationToken cancellationToken); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.