mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-10 09:07:58 +01:00
[youtube] Fix likes/dislike extraction
This commit is contained in:
parent
507683780e
commit
c93d53f5e3
1 changed files with 6 additions and 6 deletions
|
@ -29,6 +29,7 @@
|
||||||
get_element_by_id,
|
get_element_by_id,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
orderedSet,
|
orderedSet,
|
||||||
|
str_to_int,
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
uppercase_escape,
|
uppercase_escape,
|
||||||
|
@ -1005,12 +1006,11 @@ def _real_extract(self, url):
|
||||||
video_description = ''
|
video_description = ''
|
||||||
|
|
||||||
def _extract_count(count_name):
|
def _extract_count(count_name):
|
||||||
count = self._search_regex(
|
return str_to_int(self._search_regex(
|
||||||
r'id="watch-%s"[^>]*>.*?([\d,]+)\s*</span>' % re.escape(count_name),
|
r'-%s-button[^>]+><span[^>]+class="yt-uix-button-content"[^>]*>([\d,]+)</span>'
|
||||||
video_webpage, count_name, default=None)
|
% re.escape(count_name),
|
||||||
if count is not None:
|
video_webpage, count_name, default=None))
|
||||||
return int(count.replace(',', ''))
|
|
||||||
return None
|
|
||||||
like_count = _extract_count('like')
|
like_count = _extract_count('like')
|
||||||
dislike_count = _extract_count('dislike')
|
dislike_count = _extract_count('dislike')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue