Class ScrapedData
A flexible dictionary of object values used to conveniently store scraped data of any Type in a key-value dictionary which can be saved as JSON using the Yield method. ScrapedData can hold data objects of any Type, including Classes.
E.g:var Data = new ScrapedData();
Data['title'] = "Page Title";
Data['date'] = DateTime.Now;
Inheritance
System.Object
ScrapedData
Namespace: IronWebScraper
Assembly: IronWebScraper.dll
Syntax
public class ScrapedData : Dictionary<string, object>
Constructors
ScrapedData()
Declaration
public ScrapedData()
Methods
FromJson(String)
Deserializes a ScrapedData object from JSON created using the toJson() method.
Declaration
public static ScrapedData FromJson(string json)
Parameters
Type | Name | Description |
---|---|---|
System.String | json |
Returns
Type | Description |
---|---|
ScrapedData |
Get<T>(String)
Returns the specified ScrapedData item cast as the appropriate type.
E.g:Get<string>("url");
Declaration
public T Get<T>(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T | Type |
Exceptions
Type | Condition |
---|---|
System.Collections.Generic.KeyNotFoundException |
ToJson()
Converts the ScrapedData to a JSON string.
Declaration
public string ToJson()
Returns
Type | Description |
---|---|
System.String |