[devscripts/show-downloads-statistics] Add support for paging
This commit is contained in:
parent
dcbb07c35a
commit
7935926baa
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import itertools
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
@ -21,10 +22,15 @@ def format_size(bytes):
|
||||||
|
|
||||||
total_bytes = 0
|
total_bytes = 0
|
||||||
|
|
||||||
releases = json.loads(compat_urllib_request.urlopen(
|
for page in itertools.count(1):
|
||||||
'https://api.github.com/repos/rg3/youtube-dl/releases').read().decode('utf-8'))
|
releases = json.loads(compat_urllib_request.urlopen(
|
||||||
|
'https://api.github.com/repos/rg3/youtube-dl/releases?page=%s' % page
|
||||||
|
).read().decode('utf-8'))
|
||||||
|
|
||||||
for release in releases:
|
if not releases:
|
||||||
|
break
|
||||||
|
|
||||||
|
for release in releases:
|
||||||
compat_print(release['name'])
|
compat_print(release['name'])
|
||||||
for asset in release['assets']:
|
for asset in release['assets']:
|
||||||
asset_name = asset['name']
|
asset_name = asset['name']
|
||||||
|
|
Loading…
Reference in New Issue