Compare commits
2 commits
c77168b393
...
a9f1838fd6
Author | SHA1 | Date | |
---|---|---|---|
a9f1838fd6 | |||
6c6d69ee26 |
3 changed files with 250 additions and 229 deletions
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using AngleSharp;
|
using AngleSharp;
|
||||||
|
@ -57,6 +58,12 @@ public class RouteScraper {
|
||||||
httpClient = new HttpClient(httpClientHandler) {
|
httpClient = new HttpClient(httpClientHandler) {
|
||||||
BaseAddress = new Uri(BaseUrl),
|
BaseAddress = new Uri(BaseUrl),
|
||||||
DefaultRequestVersion = new Version(2, 0),
|
DefaultRequestVersion = new Version(2, 0),
|
||||||
|
DefaultRequestHeaders = {
|
||||||
|
UserAgent = {
|
||||||
|
new ProductInfoHeaderValue("new-infofer-scraper", "0.0.1"),
|
||||||
|
new ProductInfoHeaderValue("(developed by DC Dev as a hobby, get in touch at webmaster<at>dcdev.ro for any issues)"),
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using AngleSharp;
|
using AngleSharp;
|
||||||
|
@ -51,6 +52,12 @@ namespace InfoferScraper.Scrapers {
|
||||||
httpClient = new HttpClient(httpClientHandler) {
|
httpClient = new HttpClient(httpClientHandler) {
|
||||||
BaseAddress = new Uri(BaseUrl),
|
BaseAddress = new Uri(BaseUrl),
|
||||||
DefaultRequestVersion = new Version(2, 0),
|
DefaultRequestVersion = new Version(2, 0),
|
||||||
|
DefaultRequestHeaders = {
|
||||||
|
UserAgent = {
|
||||||
|
new ProductInfoHeaderValue("new-infofer-scraper", "0.0.1"),
|
||||||
|
new ProductInfoHeaderValue("(developed by DC Dev as a hobby, get in touch at webmaster<at>dcdev.ro for any issues)"),
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using AngleSharp;
|
using AngleSharp;
|
||||||
|
@ -25,7 +26,7 @@ namespace InfoferScraper.Scrapers {
|
||||||
|
|
||||||
private static readonly Regex SlRegex =
|
private static readonly Regex SlRegex =
|
||||||
new(
|
new(
|
||||||
@"^(?:Fără|([0-9]+)\smin)\s(întârziere|mai\sdevreme)\sla\s(trecerea\sfără\soprire\sprin|sosirea\sîn|plecarea\sdin)\s(.+)\.$");
|
@"^(?:Fără|([0-9]+)\smin)\s(întârziere|mai\sdevreme)\sla\s(trecerea\sfără\soprire\sprin|sosirea\sîn|plecarea\sdin)\s(.+)(?:\s\(Raportat\sla\s([0-9]+):([0-9]+)\))?\.");
|
||||||
|
|
||||||
private static readonly Dictionary<char, StatusKind> SlStateMap = new() {
|
private static readonly Dictionary<char, StatusKind> SlStateMap = new() {
|
||||||
{ 't', StatusKind.Passing },
|
{ 't', StatusKind.Passing },
|
||||||
|
@ -69,6 +70,12 @@ namespace InfoferScraper.Scrapers {
|
||||||
httpClient = new HttpClient(httpClientHandler) {
|
httpClient = new HttpClient(httpClientHandler) {
|
||||||
BaseAddress = new Uri(BaseUrl),
|
BaseAddress = new Uri(BaseUrl),
|
||||||
DefaultRequestVersion = new Version(2, 0),
|
DefaultRequestVersion = new Version(2, 0),
|
||||||
|
DefaultRequestHeaders = {
|
||||||
|
UserAgent = {
|
||||||
|
new ProductInfoHeaderValue("new-infofer-scraper", "0.0.1"),
|
||||||
|
new ProductInfoHeaderValue("(developed by DC Dev as a hobby, get in touch at webmaster<at>dcdev.ro for any issues)"),
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue