1
1
using System . Collections . Generic ;
2
+ using System . Linq ;
2
3
using System . Threading . Tasks ;
3
4
using Microsoft . AspNetCore . Mvc ;
4
5
using SSCMS . Gather . Core ;
@@ -17,25 +18,10 @@ public async Task<ActionResult<GetResult>> Get([FromQuery] GetRequest request)
17
18
}
18
19
19
20
var rule = await _ruleRepository . GetAsync ( request . RuleId ) ;
21
+ var items = GatherUtils . GetItems ( request . ListUrl , rule ) ;
22
+ var item = items . FirstOrDefault ( x => StringUtils . EqualsIgnoreCase ( x . Url , request . ContentUrl ) ) ;
20
23
21
- var regexContentExclude = GatherUtils . GetRegexString ( rule . ContentExclude ) ;
22
- var regexChannel = GatherUtils . GetRegexChannel ( rule . ContentChannelStart , rule . ContentChannelEnd ) ;
23
- var regexContent = GatherUtils . GetRegexContent ( rule . ContentContentStart , rule . ContentContentEnd ) ;
24
- var regexContent2 = string . Empty ;
25
- if ( ! string . IsNullOrEmpty ( rule . ContentContentStart2 ) && ! string . IsNullOrEmpty ( rule . ContentContentEnd2 ) )
26
- {
27
- regexContent2 = GatherUtils . GetRegexContent ( rule . ContentContentStart2 , rule . ContentContentEnd2 ) ;
28
- }
29
- var regexContent3 = string . Empty ;
30
- if ( ! string . IsNullOrEmpty ( rule . ContentContentStart3 ) && ! string . IsNullOrEmpty ( rule . ContentContentEnd3 ) )
31
- {
32
- regexContent3 = GatherUtils . GetRegexContent ( rule . ContentContentStart3 , rule . ContentContentEnd3 ) ;
33
- }
34
- var regexNextPage = GatherUtils . GetRegexUrl ( rule . ContentNextPageStart , rule . ContentNextPageEnd ) ;
35
- var regexTitle = GatherUtils . GetRegexTitle ( rule . ContentTitleStart , rule . ContentTitleEnd ) ;
36
- var contentAttributes = ListUtils . GetStringList ( rule . ContentAttributes ) ;
37
-
38
- var attributes = GatherUtils . GetContentNameValueCollection ( rule . Charset , request . ContentUrl , rule . CookieString , regexContentExclude , rule . ContentHtmlClearCollection , rule . ContentHtmlClearTagCollection , regexTitle , regexContent , regexContent2 , regexContent3 , regexNextPage , regexChannel , contentAttributes , rule ) ;
24
+ var attributes = GatherUtils . GetContentNameValueCollection ( rule , item ) ;
39
25
40
26
var list = new List < KeyValuePair < string , string > > ( ) ;
41
27
0 commit comments