Skip to content

Commit 902aec7

Browse files
committed
v1.2.0
- Fixed news articles not being parsed correctly.
1 parent 564547c commit 902aec7

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

Controls/CRNewsPanel.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,11 @@ private async Task<NewsStorage> ParseLink(NewsStorage newsStorage)
7575

7676
if (!String.IsNullOrEmpty(pageBody))
7777
{
78-
Match titleMatch = Regex.Match(pageBody, "page-title\">(.*)<", RegexOptions.RightToLeft);
79-
Match calendarMatch = Regex.Match(pageBody, "fa fa-calendar\"><\\/i> (.*)", RegexOptions.RightToLeft);
80-
Match userMatch = Regex.Match(pageBody, "fa fa-user\"><\\/i>(.*) ", RegexOptions.RightToLeft);
81-
Match categoryMatch = Regex.Match(pageBody, "category tag\">(.*)<", RegexOptions.RightToLeft);
78+
Match titleMatch = Regex.Match(pageBody, "\"headline\": \"(.*)\"");
79+
Match calendarMatch = Regex.Match(pageBody.Replace("\r", "").Replace(" ", "").Replace("\n", ""), "<p class=\"is-5 is-uppercase\">(.*?)<");
80+
Match userMatch = Regex.Match(pageBody, "\"author\": \"(.*)\"");
81+
Match categoryMatch = Regex.Match(pageBody, "\"category tag\">(.*)<\\/a><\\/p>");
82+
Clipboard.SetText(pageBody.Replace("\r", "").Replace(" ", "").Replace("\n", ""));
8283

8384
if (titleMatch.Success && titleMatch.Groups[1].Success)
8485
{
@@ -142,6 +143,15 @@ private async Task<NewsStorage> ParseLink(NewsStorage newsStorage)
142143
{
143144
newsStorage.ThumbnailUrl_Alt = thumbnailMatchAlt.Groups[1].Value;
144145
}
146+
else
147+
{
148+
thumbnailMatchAlt = Regex.Match(pageBody, "\"image\": \"(.*)\"");
149+
150+
if (thumbnailMatchAlt.Success && thumbnailMatchAlt.Groups[1].Success)
151+
{
152+
newsStorage.ThumbnailUrl_Alt = thumbnailMatchAlt.Groups[1].Value;
153+
}
154+
}
145155
}
146156

147157
newsStorage.Parsed = true;

Framework/Assembly.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static class Assembly
1111
private static readonly string Product = "CodeRed Launcher";
1212
private static readonly string Copyright = "Rocket Planet Services Inc.";
1313
private static readonly string License = "MIT License";
14-
private static readonly string Version = "1.1.9";
14+
private static readonly string Version = "1.2.0";
1515

1616
public static string GetTitle() { return Title; }
1717
public static string GetDescription() { return Description; }

Properties/PublishProfiles/FolderProfile.pubxml.user

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
44
-->
55
<Project>
66
<PropertyGroup>
7-
<History>True|2023-06-02T18:20:34.8667609Z;True|2023-06-02T14:19:16.9938932-04:00;True|2023-05-17T17:31:36.2391578-04:00;True|2023-05-13T13:56:01.0765277-04:00;True|2023-04-26T17:18:01.3003846-04:00;True|2023-04-17T18:09:22.0218857-04:00;True|2023-04-15T08:12:25.4751548-04:00;True|2023-02-23T17:42:55.3711325-05:00;True|2023-01-26T05:55:54.7338406-05:00;True|2023-01-14T16:37:43.9661254-05:00;True|2023-01-11T15:04:57.9184587-05:00;True|2023-01-01T06:51:43.9653309-05:00;True|2022-12-29T03:28:57.5161186-05:00;True|2022-12-25T20:55:07.0626032-05:00;True|2022-12-24T18:45:18.2492814-05:00;True|2022-12-24T17:58:05.8108440-05:00;True|2022-12-23T00:36:55.2356565-05:00;True|2022-12-22T20:46:31.3667454-05:00;True|2022-12-22T20:36:59.8978942-05:00;True|2022-12-22T20:32:40.9627042-05:00;True|2022-12-22T20:27:45.7845417-05:00;True|2022-12-22T20:08:26.4442830-05:00;True|2022-12-22T20:07:06.2254198-05:00;True|2022-12-22T20:01:04.3986967-05:00;True|2022-12-22T19:57:34.6741553-05:00;True|2022-12-22T19:46:09.3566048-05:00;True|2022-12-22T19:45:03.2884935-05:00;True|2022-12-22T19:36:42.2434776-05:00;True|2022-12-22T19:31:21.4738973-05:00;True|2022-12-22T19:27:34.9406205-05:00;False|2022-12-22T19:27:27.7152676-05:00;True|2022-12-22T19:14:05.9421852-05:00;True|2022-12-22T18:02:42.2130135-05:00;</History>
7+
<History>True|2023-06-07T20:19:33.2384233Z;True|2023-06-02T14:20:34.8667609-04:00;True|2023-06-02T14:19:16.9938932-04:00;True|2023-05-17T17:31:36.2391578-04:00;True|2023-05-13T13:56:01.0765277-04:00;True|2023-04-26T17:18:01.3003846-04:00;True|2023-04-17T18:09:22.0218857-04:00;True|2023-04-15T08:12:25.4751548-04:00;True|2023-02-23T17:42:55.3711325-05:00;True|2023-01-26T05:55:54.7338406-05:00;True|2023-01-14T16:37:43.9661254-05:00;True|2023-01-11T15:04:57.9184587-05:00;True|2023-01-01T06:51:43.9653309-05:00;True|2022-12-29T03:28:57.5161186-05:00;True|2022-12-25T20:55:07.0626032-05:00;True|2022-12-24T18:45:18.2492814-05:00;True|2022-12-24T17:58:05.8108440-05:00;True|2022-12-23T00:36:55.2356565-05:00;True|2022-12-22T20:46:31.3667454-05:00;True|2022-12-22T20:36:59.8978942-05:00;True|2022-12-22T20:32:40.9627042-05:00;True|2022-12-22T20:27:45.7845417-05:00;True|2022-12-22T20:08:26.4442830-05:00;True|2022-12-22T20:07:06.2254198-05:00;True|2022-12-22T20:01:04.3986967-05:00;True|2022-12-22T19:57:34.6741553-05:00;True|2022-12-22T19:46:09.3566048-05:00;True|2022-12-22T19:45:03.2884935-05:00;True|2022-12-22T19:36:42.2434776-05:00;True|2022-12-22T19:31:21.4738973-05:00;True|2022-12-22T19:27:34.9406205-05:00;False|2022-12-22T19:27:27.7152676-05:00;True|2022-12-22T19:14:05.9421852-05:00;True|2022-12-22T18:02:42.2130135-05:00;</History>
88
<LastFailureDetails />
99
</PropertyGroup>
1010
</Project>

0 commit comments

Comments
 (0)