@@ -117,24 +117,15 @@ private async Task<NewsStorage> ParseLink(NewsStorage newsStorage)
117117
118118 if ( String . IsNullOrEmpty ( newsStorage . ThumbnailUrl ) )
119119 {
120- Match thumbnailMatchOne = Regex . Match ( pageBody , "\" src =\" (.*)\" class= \" attachment" , RegexOptions . RightToLeft ) ;
120+ Match thumbnailMatch = Regex . Match ( pageBody , "og:image:url \" content =\" (.*)\" /><meta property=" , RegexOptions . RightToLeft ) ; // This can change a lot...
121121
122- if ( pageBody . Contains ( "blog-video-player" ) ) // This usually happens when there is a video link instead of a thumbnail.
122+ if ( thumbnailMatch . Success && thumbnailMatch . Groups [ 1 ] . Success )
123123 {
124- Match thumbnailMatchAlt = Regex . Match ( pageBody , "<img src=\" (.*)\" data-id" , RegexOptions . RightToLeft ) ;
125-
126- if ( thumbnailMatchAlt . Success && thumbnailMatchAlt . Groups [ 1 ] . Success )
127- {
128- newsStorage . ThumbnailUrl = thumbnailMatchAlt . Groups [ 1 ] . Value ;
129- }
130- }
131- else if ( thumbnailMatchOne . Success && thumbnailMatchOne . Groups [ 1 ] . Success )
132- {
133- newsStorage . ThumbnailUrl = thumbnailMatchOne . Groups [ 1 ] . Value ;
124+ newsStorage . ThumbnailUrl = thumbnailMatch . Groups [ 1 ] . Value ;
134125 }
135- else if ( newsStorage . Category . ToLower ( ) . Contains ( "community" ) ) // This usually happens with community spotlights.
126+ else
136127 {
137- Match thumbnailMatchAlt = Regex . Match ( pageBody , "<p dir=\" ltr\" ><img src=\" (.*)\" data-id=\" " , RegexOptions . RightToLeft ) ;
128+ Match thumbnailMatchAlt = Regex . Match ( pageBody , "<p dir=\" ltr\" ><img src=\" (.*)\" data-id=\" " , RegexOptions . RightToLeft ) ; // This usually happens with community spotlights.
138129
139130 if ( thumbnailMatchAlt . Success && thumbnailMatchAlt . Groups [ 1 ] . Success )
140131 {
@@ -178,16 +169,13 @@ public async void ParseArticles(string url)
178169 {
179170 ResetArticles ( ) ;
180171 MatchCollection articleLinks = Regex . Matches ( pageBody , "<a class=\" news-tile-wrap\" href=\" (.*)\" >" ) ;
181- //MatchCollection thumbnailLinks = Regex.Matches(pageBody, "<img src=\"(.*)\" alt=\"article-image\"\\/>");
182172
183173 for ( Int32 i = 0 ; i < articleLinks . Count ; i ++ )
184174 {
185175 Match link = articleLinks [ i ] ;
186- //Match thumbnail = thumbnailLinks[i];
187176
188177 if ( link . Success && link . Groups [ 1 ] . Success )
189178 {
190- //NewsArticles.Add(new NewsStorage("https://www.rocketleague.com" + link.Groups[1].Value, thumbnail.Groups[1].Value));
191179 NewsArticles . Add ( new NewsStorage ( "https://www.rocketleague.com" + link . Groups [ 1 ] . Value ) ) ;
192180 }
193181 }
0 commit comments