After spending the better half of 2 hours trying to get my code to download a certain number of posts from a Sidecar post using the Instaloader module, I can't seem to find a good solution.
I have come up with a needlessly complex way to do this, which I haven't implemented yet, and I'm hoping I can save that as a last resort.
A snippet of my code so far
def _download_post(self, post, source, sidecar_limit):
# Get the @sidecar_limit of posts in a sidecar
if post.typename == 'GraphSidecar':
nodes = post.get_sidecar_nodes(end=sidecar_limit)
return self.loader.posts_download_loop(nodes, target='downloads')
# Otherwise download post normally
self.loader.download_post(post, source)
My problem comes from the iterable nodes which contains namedtuples that don't contain many needed attributes that normal post Classes would have. Such as date_utc
Finally it would be nice to specify that I want to only download videos or images only from the Sidecar. I do have function which does this for me already, and the posts_download_loop function does accept a callable which when returning False will cancel the download and return. However I don't want the function to return, I'd like it to continue and skip to the next posts. But I'm not sure if there is a way to do this. It's alright if there isn't as this isn't my main problem.
Any help with finding the correct Instaloader function would be very helpful. Thanks.