File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -117,11 +117,16 @@ def _extract_stars(self, article) -> str:
117117
118118 def _extract_stars_today (self , article ) -> str :
119119 """Extract stars gained today."""
120- stars_today_element = article .find ('span' , class_ = 'd-inline-block' )
121- if stars_today_element and "stars today" in stars_today_element .get_text ():
122- stars_today_match = re .search (r'(\d+(?:,\d+)*)' , stars_today_element .get_text ())
123- if stars_today_match :
124- return stars_today_match .group (1 ).replace (',' , '' )
120+ # Look for the span that contains "stars today" text
121+ # The element has classes like "d-inline-block float-sm-right"
122+ spans = article .find_all ('span' )
123+ for span in spans :
124+ span_text = span .get_text ().strip ()
125+ if "stars today" in span_text :
126+ # Extract the number from text like "957 stars today"
127+ stars_today_match = re .search (r'(\d+(?:,\d+)*)\s+stars today' , span_text )
128+ if stars_today_match :
129+ return stars_today_match .group (1 ).replace (',' , '' )
125130 return "0"
126131
127132 def get_readme (self , repo_url : str ) -> str :
You can’t perform that action at this time.
0 commit comments