parent
caf26ed17f
commit
d174130c6b
|
@ -9,6 +9,9 @@
|
|||
- Update `xml` dependency.
|
||||
- Fixed closed caption api.
|
||||
|
||||
## 1.0.2-beta
|
||||
|
||||
- Fix video likes and dislikes count. #30
|
||||
<hr>
|
||||
|
||||
## 0.0.1
|
||||
|
|
|
@ -22,6 +22,10 @@ class Engagement extends Equatable {
|
|||
return 1 + 4.0 * likeCount / (likeCount + dislikeCount);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() =>
|
||||
'$viewCount views, $likeCount likes, $dislikeCount dislikes';
|
||||
|
||||
@override
|
||||
List<Object> get props => [viewCount, likeCount, dislikeCount];
|
||||
}
|
||||
|
|
|
@ -14,7 +14,8 @@ import 'stream_info_provider.dart';
|
|||
|
||||
class WatchPage {
|
||||
final RegExp _videoLikeExp = RegExp(r'"label"\s*:\s*"([\d,\.]+) likes"');
|
||||
final RegExp _videoDislikeExp = RegExp(r'"label"\s*:\s*"([\d,\.]+) dislikes');
|
||||
final RegExp _videoDislikeExp =
|
||||
RegExp(r'"label"\s*:\s*"([\d,\.]+) dislikes"');
|
||||
|
||||
final Document _root;
|
||||
|
||||
|
@ -26,7 +27,12 @@ class WatchPage {
|
|||
_root.querySelector('meta[property="og:url"]') != null;
|
||||
|
||||
//TODO: Update this to the new "parsing method" w/ regex "label"\s*:\s*"([\d,\.]+) likes"
|
||||
int get videoLikeCount => int.parse(_root
|
||||
int get videoLikeCount => int.parse(_videoLikeExp
|
||||
.firstMatch(_root.outerHtml)
|
||||
?.group(1)
|
||||
?.stripNonDigits()
|
||||
?.nullIfWhitespace ??
|
||||
_root
|
||||
.querySelector('.like-button-renderer-like-button')
|
||||
?.text
|
||||
?.stripNonDigits()
|
||||
|
@ -34,7 +40,12 @@ class WatchPage {
|
|||
'0');
|
||||
|
||||
//TODO: Update this to the new "parsing method" w/ regex "label"\s*:\s*"([\d,\.]+) dislikes"
|
||||
int get videoDislikeCount => int.parse(_root
|
||||
int get videoDislikeCount => int.parse(_videoDislikeExp
|
||||
.firstMatch(_root.outerHtml)
|
||||
?.group(1)
|
||||
?.stripNonDigits()
|
||||
?.nullIfWhitespace ??
|
||||
_root
|
||||
.querySelector('.like-button-renderer-dislike-button')
|
||||
?.text
|
||||
?.stripNonDigits()
|
||||
|
|
|
@ -8,7 +8,7 @@ class YoutubeHttpClient {
|
|||
|
||||
final Map<String, String> _userAgent = const {
|
||||
'user-agent':
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36'
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36'
|
||||
};
|
||||
|
||||
/// Throws if something is wrong with the response.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: youtube_explode_dart
|
||||
description: A port in dart of the youtube explode library. Supports several API functions without the need of Youtube API Key.
|
||||
version: 1.0.1-beta
|
||||
version: 1.0.2-beta
|
||||
homepage: https://github.com/Hexer10/youtube_explode_dart
|
||||
|
||||
environment:
|
||||
|
|
Loading…
Reference in New Issue