Add UserAgent
This commit is contained in:
parent
c77168b393
commit
6c6d69ee26
3 changed files with 249 additions and 228 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;
|
||||||
|
@ -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