make user agent a public property in PocketReader
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
using PocketSharp.Ports.NReadability;
|
||||
using PocketSharp.Models;
|
||||
using PocketSharp.Ports.NReadability;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using PocketSharp.Models;
|
||||
|
||||
namespace PocketSharp
|
||||
{
|
||||
@@ -12,6 +12,12 @@ namespace PocketSharp
|
||||
/// </summary>
|
||||
public class PocketReader
|
||||
{
|
||||
/// <summary>
|
||||
/// Used UserAgent for HTTP request
|
||||
/// </summary>
|
||||
public string userAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.4 Safari/537.36 OPR/18.0.1284.2";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// REST client used for HTML retrieval
|
||||
/// </summary>
|
||||
@@ -36,8 +42,8 @@ namespace PocketSharp
|
||||
// add accepted encodings
|
||||
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Accept-Encoding", "gzip,deflate");
|
||||
|
||||
// add user agent (default for Opera with PocketSharp identifier appended)
|
||||
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.4 Safari/537.36 OPR/18.0.1284.2 PocketSharp/2.2");
|
||||
// add user agent
|
||||
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", userAgent + " PocketSharp / 3.0");
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +107,7 @@ namespace PocketSharp
|
||||
|
||||
// process/transcode HTML
|
||||
TranscodingResult transcodingResult = transcoder.Transcode(transcodingInput);
|
||||
|
||||
|
||||
return new PocketArticle()
|
||||
{
|
||||
Content = transcodingResult.ExtractedContent,
|
||||
|
||||
Reference in New Issue
Block a user