File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,26 @@ public void Execute(HtmlNode coreNode)
134134 }
135135 }
136136
137+ internal class FriendListParser : TargetableParser < User > , INodeParser
138+ {
139+ public FriendListParser ( User target ) :
140+ base ( target )
141+ { }
142+
143+ public void Execute ( HtmlNode coreNode )
144+ {
145+ if ( coreNode == null ) return ;
146+
147+ var friendCountNode = coreNode . SelectSingleNode ( "../div[1]" ) ;
148+ if ( friendCountNode != null )
149+ {
150+ var match = Regex . Match ( friendCountNode . InnerText , @"Showing [0-9]+ of ([0-9]+) Friend\(s\)" ) ;
151+ if ( match . Groups . Count > 1 )
152+ Target . Friends = match . Groups [ 1 ] . Value . To < double > ( ) . To < uint > ( ) ;
153+ }
154+ }
155+ }
156+
137157
138158 internal class LastActivityParser : TargetableParser < User > , INodeParser
139159 {
@@ -380,6 +400,7 @@ public void Execute(HtmlDocument document)
380400 new StatisticsParser ( Target , IsSessionUser ) . Execute ( document . GetElementbyId ( "collapseobj_stats" ) ) ;
381401 new MiniStatsParser ( Target ) . Execute ( document . GetElementbyId ( "collapseobj_stats_mini" ) ) ;
382402 new LastVisitorsParser ( Target ) . Execute ( document . GetElementbyId ( "collapseobj_visitors" ) ) ;
403+ new FriendListParser ( Target ) . Execute ( document . GetElementbyId ( "friends_list" ) ) ;
383404 }
384405 }
385406}
Original file line number Diff line number Diff line change @@ -370,6 +370,11 @@ public enum Status
370370 /// </summary>
371371 public Content Signature { get ; set ; }
372372
373+ /// <summary>
374+ /// Amount of friends the user has added
375+ /// </summary>
376+ public uint Friends { get ; set ; }
377+
373378
374379 public User ( uint id = 0 )
375380 : this ( null , id )
You can’t perform that action at this time.
0 commit comments