add second NuGet package for PocketReader; allow user agent in PocketReader constructor

This commit is contained in:
2013-11-15 13:43:27 +01:00
parent f5c8d45013
commit ff4fae1d35
5 changed files with 48 additions and 18 deletions
+9 -3
View File
@@ -15,7 +15,7 @@ namespace PocketSharp
/// <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";
protected 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
@@ -26,8 +26,14 @@ namespace PocketSharp
/// <summary>
/// Initializes a new instance of the <see cref="PocketReader"/> class.
/// </summary>
public PocketReader()
public PocketReader(string userAgent = null)
{
// override user agent
if (!string.IsNullOrEmpty(userAgent))
{
_userAgent = userAgent;
}
// initialize HTTP client
_httpClient = new HttpClient(new HttpClientHandler()
{
@@ -42,7 +48,7 @@ namespace PocketSharp
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Accept-Encoding", "gzip,deflate");
// add user agent
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", userAgent + " PocketSharp / 3.0");
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", _userAgent + " PocketSharp / 3.0");
}
@@ -0,0 +1,28 @@
<?xml version="1.0"?>
<package >
<metadata>
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<licenseUrl>https://raw.github.com/ceee/PocketSharp/master/LICENSE-MIT</licenseUrl>
<projectUrl>https://github.com/ceee/PocketSharp</projectUrl>
<iconUrl>https://raw.github.com/ceee/PocketSharp/master/Assets/pocketsharp.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>
<![CDATA[
PocketSharp is a C#.NET portable class library that integrates the Pocket API v3.
PocketSharp.Reader contains the reader which extracts readable content from websites.
]]>
</description>
<language>en-US</language>
<releaseNotes>
<![CDATA[
For full release notes see https://github.com/ceee/PocketSharp/blob/master/CHANGELOG.md
]]>
</releaseNotes>
<copyright>Copyright by cee, 2013</copyright>
<tags>PocketAPI Pocket API PocketSharp Tobias Klika cee NReadability SgmlReader Reader Article SDK Pockem</tags>
</metadata>
</package>
+9 -13
View File
@@ -1,30 +1,26 @@
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Reflection;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PocketSharp.Reader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("Custom Article View API for PocketSharp")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("cee")]
[assembly: AssemblyProduct("PocketSharp.Reader")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyCopyright("Copyright © cee 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("3.0.0")]
[assembly: AssemblyFileVersion("3.0.0 RC2")]
+1 -1
View File
@@ -18,6 +18,6 @@
]]>
</releaseNotes>
<copyright>Copyright by cee, 2013</copyright>
<tags>PocketAPI Pocket API PocketSharp Tobias Klika cee NReadability Reader Article SDK Pockem</tags>
<tags>PocketAPI Pocket API PocketSharp Tobias Klika cee NReadability SgmlReader Reader Article SDK Pockem</tags>
</metadata>
</package>
+1 -1
View File
@@ -23,4 +23,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.0.0")]
[assembly: AssemblyFileVersion("3.0.0 RC1")]
[assembly: AssemblyFileVersion("3.0.0 RC2")]