Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Youtube - Like and Dislike counters inside JSON sometimes empty #25825

Closed
RomanEmelyanov opened this issue Jun 28, 2020 · 4 comments
Closed

Youtube - Like and Dislike counters inside JSON sometimes empty #25825

RomanEmelyanov opened this issue Jun 28, 2020 · 4 comments

Comments

@RomanEmelyanov
Copy link

@RomanEmelyanov RomanEmelyanov commented Jun 28, 2020

Youtube - Like and Dislike counter inside JSON sometimes empty:

$./youtube-dl --version
2020.06.16.1

Error with videos example:

$ ./youtube-dl -J https://www.youtube.com/watch?v=XSGBVzeBUbk | json_pp | grep -i count
"dislike_count" : null,
"view_count" : 16774885,
"like_count" : null,
$ ./youtube-dl -J https://www.youtube.com/watch?v=hzixp8s4pyg | json_pp | grep -i count
"like_count" : null,
"view_count" : 11937665,
"dislike_count" : null,

Good with videos example:

$ ./youtube-dl -J https://www.youtube.com/watch?v=rO0yXC0oyIA | json_pp | grep -i count
"dislike_count" : 625,
"view_count" : 2705803,
"like_count" : 31129,
$ ./youtube-dl -J https://www.youtube.com/watch?v=wTcNtgA6gHs | json_pp | grep -i count
"view_count" : 36788300,
"like_count" : 169235,
"dislike_count" : 3880,

@RomanEmelyanov
Copy link
Author

@RomanEmelyanov RomanEmelyanov commented Jul 2, 2020

Workaround diff for file youtube.py

def _extract_count(count_name):
            return str_to_int(self._search_regex(
                -r'-%s-button[^>]+><span[^>]+class="yt-uix-button-content"[^>]*>([\d,]+)</span>'
                +r'\\"%sCount\\":([\d,]+),'
                % re.escape(count_name),
                video_webpage, count_name, default=None))
@vootshiclone
Copy link

@vootshiclone vootshiclone commented Jul 12, 2020

def _extract_count(count_name):
return str_to_int(self._search_regex(
-r'-%s-button[^>]+><span[^>]+class="yt-uix-button-content"[^>]*>([\d,]+)'
+r'\"%sCount\":([\d,]+),'
% re.escape(count_name),
video_webpage, count_name, default=None))

Still empty for all the videos for me. Any advice?

@RomanEmelyanov
Copy link
Author

@RomanEmelyanov RomanEmelyanov commented Jul 12, 2020

Use this patch:

def _extract_count(count_name):
            return str_to_int(self._search_regex(
                r'([0-9,]+) %ss"}}'
                % re.escape(count_name),
                video_webpage, count_name, default=None))
@vootshiclone
Copy link

@vootshiclone vootshiclone commented Jul 12, 2020

Use this patch:

def _extract_count(count_name):
            return str_to_int(self._search_regex(
                r'([0-9,]+) %ss"}}'
                % re.escape(count_name),
                video_webpage, count_name, default=None))

It worked! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.