Skip to content

Commit 281085a

Browse files
committed
修复趋势页面数据不显示问题
1 parent ef08bba commit 281085a

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

lib/bloc/trend_bloc.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ class TrendBloc {
4141
if (res.next != null) {
4242
var resNext = await res.next;
4343
if (resNext != null && resNext.result) {
44-
if (res != null && res.result) {
45-
_subject.add(res.data);
46-
}
44+
_subject.add(resNext.data);
4745
}
4846
}
4947
}

lib/common/net/trending/github_trending.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class GitHubTrending {
2323
}
2424

2525
const TAGS = {
26-
"meta": {"start": '<span class="d-inline-block float-sm-right">', "end": '</span>'},
26+
"meta": {"start": '<span class="d-inline-block', "end": '</span>'},
2727
"starCount": {"start": '<a class="muted-link d-inline-block mr-3"', "flag": '/stargazers">', "end": '</a>'},
2828
"forkCount": {"start": '<a class="muted-link d-inline-block mr-3"', "flag": '/network', "end": '</a>'}
2929
};
@@ -34,15 +34,15 @@ class TrendingUtil {
3434
responseData = responseData.replaceAll(new RegExp('\n'), '');
3535
} catch (e) {}
3636
var repos = new List();
37-
var splitWithH3 = responseData.split('<h3');
37+
var splitWithH3 = responseData.split('<article');
3838
splitWithH3.removeAt(0);
3939
for (var i = 0; i < splitWithH3.length; i++) {
4040
var repo = TrendingRepoModel.empty();
4141
var html = splitWithH3[i];
4242

4343
parseRepoBaseInfo(repo, html);
4444

45-
var metaNoteContent = parseContentWithNote(html, 'class="f6 text-gray mt-2">', '<\/li>');
45+
var metaNoteContent = parseContentWithNote(html, 'class="f6 text-gray mt-2">', '<\/div>');
4646
repo.meta = parseRepoLabelWithTag(repo, metaNoteContent, TAGS["meta"]);
4747
repo.starCount = parseRepoLabelWithTag(repo, metaNoteContent, TAGS["starCount"]);
4848
repo.forkCount = parseRepoLabelWithTag(repo, metaNoteContent, TAGS["forkCount"]);
@@ -77,7 +77,7 @@ class TrendingUtil {
7777
repo.reposName = repo.fullName.split('/')[1];
7878
}
7979

80-
String description = parseContentWithNote(htmlBaseInfo, '<p class="col-9 d-inline-block text-gray m-0 pr-4">', '</p>');
80+
String description = parseContentWithNote(htmlBaseInfo, '<p class="col-9 text-gray my-1 pr-4">', '</p>');
8181
if (description != null) {
8282
String reg = "<g-emoji.*?>.+?</g-emoji>";
8383
RegExp tag = new RegExp(reg);

0 commit comments

Comments
 (0)