1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

[instagram] add 'api' option

This commit is contained in:
Mike Fährmann 2022-09-26 22:05:29 +02:00
parent 6f77193a24
commit aa49bf13d2
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
3 changed files with 25 additions and 3 deletions

View File

@ -1468,6 +1468,20 @@ Description
for details)
extractor.instagram.api
-----------------------
Type
``string``
Default
``"auto"``
Description
Selects which API endpoints to use.
* ``"rest"``: REST API - higher-resolution media, only usable when logged in
* ``"graphql"``: GraphQL API - lower-resolution media, partially accessible when not logged in
* ``"auto"``: Use REST API when logged in, GraphQL API otherwise
extractor.instagram.include
---------------------------
Type

View File

@ -156,8 +156,9 @@
{
"username": null,
"password": null,
"api": "auto",
"include": "posts",
"sleep-request": 8.0,
"sleep-request": [6.0, 12.0],
"videos": true
},
"khinsider":

View File

@ -43,8 +43,15 @@ class InstagramExtractor(Extractor):
def items(self):
self.login()
self.api = (InstagramRestAPI(self) if self._logged_in else
InstagramGraphqlAPI(self))
api = self.config("api")
if api is None or api == "auto":
api = InstagramRestAPI if self._logged_in else InstagramGraphqlAPI
elif api == "graphql":
api = InstagramGraphqlAPI
else:
api = InstagramRestAPI
self.api = api(self)
data = self.metadata()
videos = self.config("videos", True)