Skip to content

Commit

Permalink
改进歌词匹配逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhoucheng133 committed Nov 14, 2024
1 parent 9d658ca commit 8cf147a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/views/functions/requests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,9 @@ class HttpRequests{
final keyword="$title $artist";
final searchAPI="https://music.163.com/api/search/get/web?csrf_token=hlpretag=&hlposttag=&s=$keyword&type=1&offset=0&total=true&limit=1";
final response=await http.get(Uri.parse(searchAPI));
// print(searchAPI);

final firstRlt=json.decode(utf8.decode(response.bodyBytes))['result']['songs'][0];
// print("${firstRlt['name']} $title");
// print("ARTIST: ${firstRlt['artists']['name']}");
if(!(firstRlt['name'].contains(title))){
if(!(firstRlt['name'].contains(title) || title.contains(firstRlt['name']))){
return null;
}
id=json.decode(utf8.decode(response.bodyBytes))['result']['songs'][0]['id'].toString();
Expand Down

0 comments on commit 8cf147a

Please sign in to comment.