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

[instagram] Fix extraction after `rhx_gis' field removal #266

Merged
merged 1 commit into from
May 17, 2019
Merged

[instagram] Fix extraction after `rhx_gis' field removal #266

merged 1 commit into from
May 17, 2019

Conversation

iamleot
Copy link
Contributor

@iamleot iamleot commented May 17, 2019

Instagram has recently removed the `rhx_gis' in sharedData JSON
leading to extraction failures for tags and profiles.

Adjust `X-Instagram-GIS' header generation accordingly.

For completeness here the failure of the tests:

% env PYTHONPATH=. python3.7 test/test_results.py instagram

https://www.instagram.com/p/BqvsDleB3lV/
.
https://www.instagram.com/p/BoHk1haB5tM/
.
https://www.instagram.com/p/Bqxp0VSBgJg/
.
https://www.instagram.com/p/BtOvDOfhvRr/
.
https://www.instagram.com/explore/tags/instagram/
E
https://www.instagram.com/instagram/
E
======================================================================
ERROR: test_InstagramTagExtractor_1 (__main__.TestExtractorResults)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_results.py", line 259, in test
    self._run_test(extr, url, result)
  File "test/test_results.py", line 62, in _run_test
    tjob.run()
  File "test/test_results.py", line 153, in run
    for msg in self.extractor:
  File ".../gallery_dl/extractor/instagram.py", line 32, in items
    for data in self.instagrams():
  File ".../gallery_dl/extractor/instagram.py", line 162, in _extract_tagpage
    yield from self._extract_page(url, 'TagPage')
  File ".../gallery_dl/extractor/instagram.py", line 124, in _extract_page
    rhx_gis = shared_data['rhx_gis']
KeyError: 'rhx_gis'

======================================================================
ERROR: test_InstagramUserExtractor_1 (__main__.TestExtractorResults)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_results.py", line 259, in test
    self._run_test(extr, url, result)
  File "test/test_results.py", line 62, in _run_test
    tjob.run()
  File "test/test_results.py", line 153, in run
    for msg in self.extractor:
  File ".../gallery_dl/extractor/instagram.py", line 32, in items
    for data in self.instagrams():
  File ".../gallery_dl/extractor/instagram.py", line 159, in _extract_profilepage
    yield from self._extract_page(url, 'ProfilePage')
  File ".../gallery_dl/extractor/instagram.py", line 124, in _extract_page
    rhx_gis = shared_data['rhx_gis']
KeyError: 'rhx_gis'

----------------------------------------------------------------------
Ran 6 tests in 5.687s

FAILED (errors=2)

@mikf
Copy link
Owner

mikf commented May 17, 2019

Thank you

@mikf mikf merged commit fb09dd9 into mikf:master May 17, 2019
@iamleot
Copy link
Contributor Author

iamleot commented May 17, 2019

Thanks for quickly applying it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants