File tree Expand file tree Collapse file tree 4 files changed +17
-7
lines changed Expand file tree Collapse file tree 4 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -82,4 +82,8 @@ public override string ToString()
82
82
{
83
83
return Convert . ToBase64String ( strm . ToArray ( ) ) ;
84
84
}
85
+
86
+ public string Decode ( ) {
87
+ return new StreamReader ( strm ) . ReadToEnd ( ) ;
88
+ }
85
89
}
Original file line number Diff line number Diff line change 1
- namespace Totletheyn . Core ;
1
+ using System ;
2
+
3
+ namespace Totletheyn . Core ;
2
4
3
5
public record Issue ( string Title , string PdfUrl ) ;
Original file line number Diff line number Diff line change @@ -12,13 +12,17 @@ public class FrauenhoferCrawler : ICrawler
12
12
public const string Name = "frauenhofer" ;
13
13
14
14
private readonly RestTemplate template = new ( ) ;
15
- private HtmlDocument document = new ( ) ;
15
+ private readonly HtmlDocument document = new ( ) ;
16
16
17
17
18
18
public FrauenhoferCrawler ( )
19
19
{
20
- Base64 content = template . Exchange ( "https://www.fraunhofer.de/de/mediathek/publikationen/fraunhofer-magazin.html" ) . Body ;
21
- document . LoadHtml ( content . Decode ( ) ) ;
20
+ var content = template
21
+ . Exchange ( "https://www.fraunhofer.de/de/mediathek/publikationen/fraunhofer-magazin.html" )
22
+ . Body
23
+ . ReadString ( ) ;
24
+
25
+ document . LoadHtml ( content ) ;
22
26
}
23
27
24
28
public bool IsNewIssueAvailable ( )
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ public override void Init()
25
25
26
26
inboxId = MossConfig . Get < string > ( "inbox" ) ;
27
27
28
- foreach ( var crawler in Options . providers )
28
+ foreach ( var crawler in ( string [ ] ) Options . providers )
29
29
{
30
30
_crawlers . Add ( _activator . Create ( crawler ) ) ;
31
31
}
@@ -49,9 +49,9 @@ public override void Run()
49
49
Logger . Info ( $ "CrawlerJob has { issues . Count } new issues") ;
50
50
foreach ( var issue in issues )
51
51
{
52
- Logger . Info ( $ "downloading { issue } ") ;
52
+ Logger . Info ( $ "downloading { issue . Title } ") ;
53
53
Base64 content = template . Exchange ( issue . PdfUrl ) . Body ;
54
- Logger . Info ( $ "uploading { issue } ") ;
54
+ Logger . Info ( $ "uploading { issue . Title } ") ;
55
55
56
56
var pdf = new PdfNotebook ( issue . Title , content , inboxId ) ;
57
57
pdf . Upload ( ) ;
You can’t perform that action at this time.
0 commit comments