diff --git a/Makefile b/Makefile index 7384d16..9b35d7e 100644 --- a/Makefile +++ b/Makefile @@ -34,5 +34,3 @@ logs: clean: stop @docker rm $(CONTAINER_NAME) || true - - diff --git a/main.py b/main.py index 58df8ab..7edb296 100644 --- a/main.py +++ b/main.py @@ -83,7 +83,7 @@ def get_media(self, pages=sys.maxsize, per_page=30): if resp.status_code != 200: err = self.parse_error(resp) print("failed to get media for page {}: {}. try renewing the auth token".format(current_page, err)) - return False + return [] content = resp.json() output_media += content["_embedded"]["media"] @@ -154,6 +154,10 @@ def main(): return -1 media = gpp.get_media(pages=args.pages, per_page=args.per_page) + if not media: + print('failed to get media') + return -1 + filenames = gpp.get_filenames_from_media(media) print("listing media: {}".format(filenames))