@@ -17,15 +17,17 @@ public class RSSFeedAggregator
17
17
string _userAgent ;
18
18
string _paywallRemover ;
19
19
int _connectionTimeout ;
20
+ int _ArticleKeepAge ;
20
21
Dictionary < string , int > StarBotKeywords ;
21
22
22
23
#region "Initialization"
23
24
public void Initialize ( )
24
25
{
25
26
_connectionString = "ConnectionStringGoesHere" ;
26
27
_userAgent = "UserAgentGoesHere" ;
27
- _connectionTimeout = 5000 ;
28
+ _connectionTimeout = 5000 ; //(milliseconds) 5 second timeout
28
29
_paywallRemover = "https://PaywallRemoverWebsite/proxy?q=" ;
30
+ _ArticleKeepAge = - 14 ; //(days) fetch articles with an age of 2 weeks maximum
29
31
StarBotKeywords = InitKeywordTable ( ) ;
30
32
}
31
33
#endregion
@@ -236,17 +238,13 @@ public void ReadTheFeed(string feedname, string feedurl, bool compareall, bool r
236
238
linkuri = _paywallRemover + linkuri ;
237
239
}
238
240
if ( linkList . Contains ( linkuri ) ) continue ;
239
- if ( ! IsValidLastTwoWeeksDateTime ( pubDateTime ) ||
241
+ if ( ! IsValidDateKeepRange ( pubDateTime ) ||
240
242
linkuri . Length >= 451 ) continue ;
241
243
string titletext = "" ;
242
244
string summarytext = "" ;
243
245
if ( i . Title . Text != null )
244
246
{
245
247
titletext = i . Title . Text ;
246
- if ( feedname == "Substack" )
247
- {
248
- titletext = feed . Title . Text + " - " + titletext ;
249
- }
250
248
if ( titletext . Length > 250 )
251
249
{
252
250
titletext = titletext [ ..250 ] ;
@@ -283,11 +281,11 @@ public void ReadTheFeed(string feedname, string feedurl, bool compareall, bool r
283
281
}
284
282
}
285
283
286
- public static bool IsValidLastTwoWeeksDateTime ( DateTime ? dateTime )
284
+ public bool IsValidDateKeepRange ( DateTime ? dateTime )
287
285
{
288
286
if ( dateTime == null ) return false ;
289
287
290
- DateTime minValue = DateTime . Now . ToUniversalTime ( ) . AddDays ( - 14 ) ;
288
+ DateTime minValue = DateTime . Now . ToUniversalTime ( ) . AddDays ( _ArticleKeepAge ) ;
291
289
DateTime maxValue = DateTime . Now . ToUniversalTime ( ) ;
292
290
293
291
return minValue <= dateTime . Value && maxValue >= dateTime . Value ;
0 commit comments