2021-01-06 23:41:05 -07:00
|
|
|
# Unused
|
|
|
|
|
2021-06-03 03:43:42 -06:00
|
|
|
#!/usr/bin/env python3
|
2016-07-03 09:20:14 -06:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2016-07-26 11:14:40 -06:00
|
|
|
import itertools
|
2016-07-03 09:20:14 -06:00
|
|
|
import json
|
|
|
|
import os
|
|
|
|
import re
|
|
|
|
import sys
|
|
|
|
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
|
2021-02-24 11:45:56 -07:00
|
|
|
from yt_dlp.compat import (
|
2016-07-03 09:20:14 -06:00
|
|
|
compat_print,
|
|
|
|
compat_urllib_request,
|
|
|
|
)
|
2021-02-24 11:45:56 -07:00
|
|
|
from yt_dlp.utils import format_bytes
|
2016-07-03 09:20:14 -06:00
|
|
|
|
|
|
|
|
|
|
|
def format_size(bytes):
|
|
|
|
return '%s (%d bytes)' % (format_bytes(bytes), bytes)
|
|
|
|
|
|
|
|
|
|
|
|
total_bytes = 0
|
|
|
|
|
2016-07-26 11:14:40 -06:00
|
|
|
for page in itertools.count(1):
|
|
|
|
releases = json.loads(compat_urllib_request.urlopen(
|
2019-03-09 05:14:41 -07:00
|
|
|
'https://api.github.com/repos/ytdl-org/youtube-dl/releases?page=%s' % page
|
2016-07-26 11:14:40 -06:00
|
|
|
).read().decode('utf-8'))
|
|
|
|
|
|
|
|
if not releases:
|
|
|
|
break
|
|
|
|
|
|
|
|
for release in releases:
|
|
|
|
compat_print(release['name'])
|
|
|
|
for asset in release['assets']:
|
|
|
|
asset_name = asset['name']
|
|
|
|
total_bytes += asset['download_count'] * asset['size']
|
|
|
|
if all(not re.match(p, asset_name) for p in (
|
2021-02-24 11:45:56 -07:00
|
|
|
r'^yt-dlp$',
|
|
|
|
r'^yt-dlp-\d{4}\.\d{2}\.\d{2}(?:\.\d+)?\.tar\.gz$',
|
|
|
|
r'^yt-dlp\.exe$')):
|
2016-07-26 11:14:40 -06:00
|
|
|
continue
|
|
|
|
compat_print(
|
|
|
|
' %s size: %s downloads: %d'
|
|
|
|
% (asset_name, format_size(asset['size']), asset['download_count']))
|
2016-07-03 09:20:14 -06:00
|
|
|
|
|
|
|
compat_print('total downloads traffic: %s' % format_size(total_bytes))
|