invert HasNoHeadline; better NextPage parser;
This commit is contained in:
@@ -94,6 +94,9 @@ namespace ReadSharp
|
||||
// treat paragraphs as crlf
|
||||
outText.Write("\r\n");
|
||||
break;
|
||||
case "br":
|
||||
outText.Write("\r\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (node.HasChildNodes)
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace ReadSharp
|
||||
/// <value>
|
||||
/// <c>true</c> if [has no headline]; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
public bool HasNoHeadline { get; set; }
|
||||
public bool HasHeadline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Are deep links with hashes not transformed to absolute URIs (default: false).
|
||||
@@ -52,7 +52,7 @@ namespace ReadSharp
|
||||
return new ReadOptions()
|
||||
{
|
||||
HasHeaderTags = false,
|
||||
HasNoHeadline = false,
|
||||
HasHeadline = false,
|
||||
UseDeepLinks = false,
|
||||
PrettyPrint = false,
|
||||
MultipageDownload = false
|
||||
|
||||
+9
-2
@@ -214,7 +214,7 @@ namespace ReadSharp
|
||||
DomSerializationParams = new DomSerializationParams()
|
||||
{
|
||||
BodyOnly = !options.HasHeaderTags,
|
||||
NoHeadline = options.HasNoHeadline,
|
||||
NoHeadline = !options.HasHeadline,
|
||||
PrettyPrint = options.PrettyPrint,
|
||||
DontIncludeContentTypeMetaElement = true,
|
||||
DontIncludeMobileSpecificMetaElements = true,
|
||||
@@ -352,6 +352,14 @@ namespace ReadSharp
|
||||
Encoding = encoding
|
||||
};
|
||||
|
||||
// in same special cases their are multiple pages, which are only comments or do not contain new content.
|
||||
// if this is the case we will break here and return the first page only.
|
||||
if (previousResponse != null && previousResponse.TranscodingResult.ExtractedContent == transcodingResult.ExtractedContent)
|
||||
{
|
||||
previousResponse.TranscodingResult.NextPageUrl = null;
|
||||
return previousResponse;
|
||||
}
|
||||
|
||||
// multiple pages are available
|
||||
try
|
||||
{
|
||||
@@ -359,7 +367,6 @@ namespace ReadSharp
|
||||
{
|
||||
return await Request(new Uri(transcodingResult.NextPageUrl), new ReadOptions()
|
||||
{
|
||||
HasNoHeadline = true,
|
||||
PrettyPrint = options.PrettyPrint,
|
||||
UseDeepLinks = options.UseDeepLinks,
|
||||
MultipageDownload = true
|
||||
|
||||
Reference in New Issue
Block a user