Skip to content

Commit 7036d0d

Browse files
committed
bugfix
1 parent 6b053bd commit 7036d0d

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

Changelog.md

+4
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ Init
115115

116116
# Sloader.Engine
117117

118+
## Version 1.4.1
119+
120+
* FeedCrawler bugfix for publish date
121+
118122
## Version 1.4.0
119123

120124
* FeedCrawler detects Thumbnail images

src/Sloader.Engine/Crawler/Feed/FeedCrawler.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,17 @@ private async Task ParseAtomFeed(FeedCrawlerConfig config, XDocument doc, FeedRe
170170
}
171171
}
172172

173-
var updateDateValue = atomItem.Elements().FirstOrDefault(i => i.Name.LocalName == "updated")?.Value;
174-
if (DateTime.TryParse(updateDateValue, out DateTime updateDateDateTime))
173+
var pubDateValue = atomItem.Elements().FirstOrDefault(i => i.Name.LocalName == "published")?.Value;
174+
if (DateTime.TryParse(pubDateValue, out DateTime pubDateDateTime))
175175
{
176-
crawlerResultItem.PublishedOn = updateDateDateTime;
176+
crawlerResultItem.PublishedOn = pubDateDateTime;
177177
}
178178
else
179179
{
180-
var pubDateValue = atomItem.Elements().FirstOrDefault(i => i.Name.LocalName == "published")?.Value;
181-
if (DateTime.TryParse(pubDateValue, out DateTime pubDateDateTime))
180+
var updateDateValue = atomItem.Elements().FirstOrDefault(i => i.Name.LocalName == "updated")?.Value;
181+
if (DateTime.TryParse(updateDateValue, out DateTime updateDateDateTime))
182182
{
183-
crawlerResultItem.PublishedOn = pubDateDateTime;
183+
crawlerResultItem.PublishedOn = updateDateDateTime;
184184
}
185185
}
186186

src/Sloader.Engine/Sloader.Engine.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<RepositoryUrl>https://github.com/Code-Inside/Sloader</RepositoryUrl>
1111
<RepositoryType>git</RepositoryType>
1212
<PublishRepositoryUrl>true</PublishRepositoryUrl>
13-
<Version>1.4.0</Version>
13+
<Version>1.4.1</Version>
1414
<PackageReleaseNotes>See Changelog.md</PackageReleaseNotes>
1515
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1616
</PropertyGroup>

tests/Sloader.Engine.Tests/FeedCrawlerTests/FeedCrawlerTests.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ public async Task Crawler_Can_Read_Media_Thumbnail()
212212
var result = await sut.DoWorkAsync(config);
213213

214214
Assert.True(result.FeedItems.Count == 6);
215-
Assert.True(result.FeedItems[0].Thumbnail == "https://i3.ytimg.com/vi/27yknlB8xeg/hqdefault.jpg");
215+
Assert.True(result.FeedItems[0].Thumbnail == "https://i1.ytimg.com/vi/dNaIOGQj15M/hqdefault.jpg");
216+
Assert.True(result.FeedItems[5].Thumbnail == "https://i3.ytimg.com/vi/27yknlB8xeg/hqdefault.jpg");
216217
}
217218

218219
[Fact]

0 commit comments

Comments
 (0)