@@ -74,10 +74,10 @@ private async Task<NewsStorage> ParseLink(NewsStorage newsStorage)
7474
7575 if ( ! String . IsNullOrEmpty ( pageBody ) )
7676 {
77- Match titleMatch = Regex . Match ( pageBody , "page-title\" >(.*)<" , RegexOptions . IgnoreCase | RegexOptions . RightToLeft ) ;
78- Match calendarMatch = Regex . Match ( pageBody , "fa fa-calendar\" ><\\ /i> (.*)" , RegexOptions . IgnoreCase | RegexOptions . RightToLeft ) ;
79- Match userMatch = Regex . Match ( pageBody , "fa fa-user\" ><\\ /i>(.*) " , RegexOptions . IgnoreCase | RegexOptions . RightToLeft ) ;
80- Match categoryMatch = Regex . Match ( pageBody , "category tag\" >(.*)<" , RegexOptions . IgnoreCase | RegexOptions . RightToLeft ) ;
77+ Match titleMatch = Regex . Match ( pageBody , "page-title\" >(.*)<" , RegexOptions . RightToLeft ) ;
78+ Match calendarMatch = Regex . Match ( pageBody , "fa fa-calendar\" ><\\ /i> (.*)" , RegexOptions . RightToLeft ) ;
79+ Match userMatch = Regex . Match ( pageBody , "fa fa-user\" ><\\ /i>(.*) " , RegexOptions . RightToLeft ) ;
80+ Match categoryMatch = Regex . Match ( pageBody , "category tag\" >(.*)<" , RegexOptions . RightToLeft ) ;
8181
8282 if ( titleMatch . Success && titleMatch . Groups [ 1 ] . Success )
8383 {
@@ -117,24 +117,24 @@ 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 . IgnoreCase | RegexOptions . RightToLeft ) ;
120+ Match thumbnailMatchOne = Regex . Match ( pageBody , "\" src=\" (.*)\" class=\" attachment" , RegexOptions . RightToLeft ) ;
121121
122- if ( thumbnailMatchOne . Success && thumbnailMatchOne . Groups [ 1 ] . Success )
122+ if ( pageBody . Contains ( "blog-video-player" ) ) // This usually happens when there is a video link instead of a thumbnail.
123123 {
124- newsStorage . ThumbnailUrl = thumbnailMatchOne . Groups [ 1 ] . Value ;
125- }
126- else if ( pageBody . Contains ( "blog-video-player" ) ) // This usually happens when there is a video link instead of a thumbnail.
127- {
128- Match thumbnailMatchAlt = Regex . Match ( pageBody , "<img src=\" (.*)\" alt=\" [^article]" , RegexOptions . IgnoreCase | RegexOptions . RightToLeft ) ;
124+ Match thumbnailMatchAlt = Regex . Match ( pageBody , "<img src=\" (.*)\" data-id" , RegexOptions . RightToLeft ) ;
129125
130126 if ( thumbnailMatchAlt . Success && thumbnailMatchAlt . Groups [ 1 ] . Success )
131127 {
132128 newsStorage . ThumbnailUrl = thumbnailMatchAlt . Groups [ 1 ] . Value ;
133129 }
134130 }
131+ else if ( thumbnailMatchOne . Success && thumbnailMatchOne . Groups [ 1 ] . Success )
132+ {
133+ newsStorage . ThumbnailUrl = thumbnailMatchOne . Groups [ 1 ] . Value ;
134+ }
135135 else if ( newsStorage . Category . ToLower ( ) . Contains ( "community" ) ) // This usually happens with community spotlights.
136136 {
137- Match thumbnailMatchAlt = Regex . Match ( pageBody , "<p dir=\" ltr\" ><img src=\" (.*)\" data-id=\" " , RegexOptions . IgnoreCase | RegexOptions . RightToLeft ) ;
137+ Match thumbnailMatchAlt = Regex . Match ( pageBody , "<p dir=\" ltr\" ><img src=\" (.*)\" data-id=\" " , RegexOptions . RightToLeft ) ;
138138
139139 if ( thumbnailMatchAlt . Success && thumbnailMatchAlt . Groups [ 1 ] . Success )
140140 {
0 commit comments