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

StoryVideo has no video_url field and thus causes KeyError when parsing #1320

Closed
fireattack opened this issue Oct 26, 2021 · 0 comments · Fixed by #1321
Closed

StoryVideo has no video_url field and thus causes KeyError when parsing #1320

fireattack opened this issue Oct 26, 2021 · 0 comments · Fixed by #1321
Labels
bug Bug

Comments

@fireattack
Copy link
Collaborator

fireattack commented Oct 26, 2021

Describe the bug
As mentioned in #1238, the StoryVideo returned by single post API doesn't behave like GraphStoryVideo returned by Stories timeline either. It has no self._node['video_url'] or self._node['video_resources']. So you can only get the video from self._iphone_struct['video_versions'].

Previously you can still parse it successfully if you logged in and does not disable iPhone API, because it can still pull the videos from the iPhone API. However, after changing the line at

version_urls = [self._field('video_url')]

it will errors out due to such key does not exist.

To Reproduce
Steps to reproduce the behavior:

  1. find any story video and copy the URL as url
import instaloader
url = "{put URL here}"
username = '{your username}'
if m := re.search(r'https://www.instagram.com/stories/[^/]+?/(\d+?)/', .url):
    shortcode = instaloader.Post.mediaid_to_shortcode(int(m[1])) 
else:
    raise Exception(f'Cannot parse URL {url}!')
L = instaloader.Instaloader()
L.load_session_from_file(username)
post = instaloader.Post.from_shortcode(L.context, shortcode)
L.download_post(post, target='')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant