fix: star and fork count 0 case

This commit is contained in:
Rongjian Zhang 2019-03-02 19:05:22 +08:00
parent c06179e109
commit ec1d995660
1 changed files with 9 additions and 6 deletions

View File

@ -60,17 +60,20 @@ class _TrendingScreenState extends State<TrendingScreen> {
?.replaceAll(RegExp(r'</g-emoji>'), ''),
'stargazers': {
'totalCount': item.children[3]
.querySelectorAll('a')[0]
.querySelector('.octicon-star')
?.parent
?.innerHtml
?.replaceFirst(RegExp(r'^[\s\S]*svg>'), '')
?.trim()
},
'forks': {
'totalCount': item.children[3]
.querySelectorAll('a')[1]
?.innerHtml
?.replaceFirst(RegExp(r'^[\s\S]*svg>'), '')
?.trim(),
'totalCount': item
.querySelector('.octicon-repo-forked')
?.parent
?.innerHtml
?.replaceFirst(RegExp(r'^[\s\S]*svg>'), '')
?.trim() ??
0,
},
'primaryLanguage': lang,
'isPrivate': false,