[instagram] add 'api' option

pull/2979/head
Mike Fährmann 2 years ago
parent 6f77193a24
commit aa49bf13d2
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -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

@ -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":

@ -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)

Loading…
Cancel
Save