[instagram] add 'api' option

This commit is contained in:
Mike Fährmann
2022-09-26 22:05:29 +02:00
parent 6f77193a24
commit aa49bf13d2
3 changed files with 25 additions and 3 deletions

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)