Comments (4)
There actually should be an upper limit here, the fact that you can request 9001 is likely a bug. Pagination is required for our own performance.
The response object has pagination helper methods, so you can use them to get the next, last, first and previous pages. The pagination functions were previously always there, but I patched them so that they won't be set if they're set to null
/None
(this is in 2795110).
The code that would load all of the pages into a list is below, but bear in mind that this does mean that it's allocating memory for every one and won't be cleaned up. A more ideal way to do this would probably to process the data inside the same while loop and spare yourself that headache.
vc = vimeo.VimeoClient(**client_args)
all_videos = list()
resp = vc.me.videos(per_page=1)
all_videos = resp['body']['data']
while hasattr(resp, 'next') and resp.next:
resp = resp.next()
all_videos.extend(resp['body']['data'])
pprint(all_videos)
Sorry this does it one per page, but that's how I can test it since I don't quite have as many videos as you do.
from vimeo.py.
If paging is needed (which it is), then this solution seems good to me. I'll switch over my code to this method soon.
from vimeo.py.
I found that resp
always has a next()
method, and just loops round when it gets to the end. To solve this I just did
while resp.next()['body']['page'] == resp['body']['page'] + 1:
resp = resp.next()
all_my_videos.extend(resp['body']['data'])
for the loop instead.
from vimeo.py.
@nasfarley88 That was the bug that was corrected in my latest commit. We were always creating the helper methods for URIs in the paging object, even when the URI was none. The change performs a test for None
(or any false-y value) before binding the method onto the object.
from vimeo.py.
Related Issues (20)
- Push version 1.1.0 to PyPI HOT 1
- I try to upload a video got error "ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed" HOT 1
- Retrieving channel's metadatas HOT 1
- Video Subdomain embed not working HOT 1
- Any plans to update the requests version HOT 1
- Transcode status is 'complete' while upload status is 'in_progress' HOT 1
- Failed upload using Device Auth token HOT 4
- error importing vimeo: Python 3 HOT 6
- How to add chapters to videos? HOT 2
- Filename is set to "Unknown file name" when using v.upload()
- what is the proper format for uploading a video with a password?
- Here's a package for additional API support HOT 2
- URGENT!!!.....How to create a folder inside folder ? HOT 2
- How to create subfolder/nasted-folder inside parent folder with Vimeo API using python? HOT 3
- Location vs location
- "You have been banned" error when trying to post comment with token of another user. HOT 2
- NameError: name 'uri' is not defined HOT 2
- Uploading videos with vertical bar "|" character in video name/description HOT 1
- authenticateWithCodeGrant API is not working in 1.1.3
- emojis, U+10000 (F0, F1, F2, F3) unicode support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vimeo.py.