Skip to content

Commit

Permalink
修复趋势页面数据不显示问题
Browse files Browse the repository at this point in the history
  • Loading branch information
CarGuo committed Jun 12, 2019
1 parent ef08bba commit 281085a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions lib/bloc/trend_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ class TrendBloc {
if (res.next != null) {
var resNext = await res.next;
if (resNext != null && resNext.result) {
if (res != null && res.result) {
_subject.add(res.data);
}
_subject.add(resNext.data);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions lib/common/net/trending/github_trending.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class GitHubTrending {
}

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

parseRepoBaseInfo(repo, html);

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

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

0 comments on commit 281085a

Please sign in to comment.