diff --git a/README.md b/README.md index 2aacef6..686561d 100644 --- a/README.md +++ b/README.md @@ -60,8 +60,7 @@ > It will ask you to choose pyrogram version. Select 2. * LOG_CHAT: Create A Log Channel and add it's id along with -100 at the beginning. - * API_KEYS: Optional Instagram scrapping keys from API. recommended to add if you wanna reduce Instagram dl failures. - + *
Tap here for The Message IDs : Send 2 messages in your log channel, message text is an empty list : [] diff --git a/app/social_dl/api/instagram.py b/app/social_dl/api/instagram.py index 97a1011..2960864 100755 --- a/app/social_dl/api/instagram.py +++ b/app/social_dl/api/instagram.py @@ -6,29 +6,28 @@ from app.social_dl.scraper_config import ScraperConfig from app.utils import aiohttp_tools as aio from app.utils.media_helper import MediaType, get_type - -class ApiKeys: - def __init__(self): - self.API2_KEYS: list = Config.API_KEYS - self.api_2 = 0 - - # Rotating Key function to avoid hitting limit on single Key - def get_key(self, func: str) -> str: - keys = self.API2_KEYS - count = getattr(self, func) + 1 - if count >= len(keys): - count = 0 - setattr(self, func, count) - return keys[count] - - # def switch(self) -> int: - # self.switch_val += 1 - # if self.switch_val >= 3: - # self.switch_val = 0 - # return self.switch_val - - -api_keys: ApiKeys = ApiKeys() +# class ApiKeys: +# def __init__(self): +# self.API2_KEYS: list = Config.API_KEYS +# self.api_2 = 0 +# +# # Rotating Key function to avoid hitting limit on single Key +# def get_key(self, func: str) -> str: +# keys = self.API2_KEYS +# count = getattr(self, func) + 1 +# if count >= len(keys): +# count = 0 +# setattr(self, func, count) +# return keys[count] +# +# def switch(self) -> int: +# self.switch_val += 1 +# if self.switch_val >= 3: +# self.switch_val = 0 +# return self.switch_val +# +# +# api_keys: ApiKeys = ApiKeys() class Instagram(ScraperConfig): @@ -36,7 +35,6 @@ class Instagram(ScraperConfig): self.APIS = ( "check_dump", "no_api_dl", - "api_2", ) super().__init__(url=url) @@ -72,29 +70,29 @@ class Instagram(ScraperConfig): return return await self.parse_ghraphql(response["data"]["shortcode_media"]) - async def api_2(self) -> bool | None: - if not Config.API_KEYS: - return - # "/?__a=1&__d=1" - response: dict | None = await aio.get_json( - url="https://api.webscraping.ai/html", - timeout=30, - params={ - "api_key": api_keys.get_key("api_2"), - "url": self.api_url, - "proxy": "residential", - "js": "false", - }, - ) - if ( - not response - or "data" not in response.keys() - or not response["data"]["shortcode_media"] - ): - LOGGER.error(response) - return - self.caption = ".." - return await self.parse_ghraphql(response["data"]["shortcode_media"]) + # async def api_2(self) -> bool | None: + # if not Config.API_KEYS: + # return + # # "/?__a=1&__d=1" + # response: dict | None = await aio.get_json( + # url="https://api.webscraping.ai/html", + # timeout=30, + # params={ + # "api_key": api_keys.get_key("api_2"), + # "url": self.api_url, + # "proxy": "residential", + # "js": "false", + # }, + # ) + # if ( + # not response + # or "data" not in response.keys() + # or not response["data"]["shortcode_media"] + # ): + # LOGGER.error(response) + # return + # self.caption = ".." + # return await self.parse_ghraphql(response["data"]["shortcode_media"]) async def parse_ghraphql(self, json_: dict) -> str | list | None: type_check: str | None = json_.get("__typename", None) diff --git a/app/social_dl/media_handler.py b/app/social_dl/media_handler.py index 517f8e8..29cbe95 100644 --- a/app/social_dl/media_handler.py +++ b/app/social_dl/media_handler.py @@ -22,7 +22,6 @@ from app.social_dl.api.gallery_dl import GalleryDL from app.social_dl.api.instagram import Instagram from app.social_dl.api.reddit import Reddit from app.social_dl.api.threads import Threads - from app.social_dl.api.tiktok import Tiktok from app.social_dl.api.ytdl import YouTubeDL from app.utils import aiohttp_tools, shell diff --git a/sample-config.env b/sample-config.env index 25451cb..a02dd57 100644 --- a/sample-config.env +++ b/sample-config.env @@ -1,13 +1,15 @@ API_ID=12345678 # You API ID -API_HASH="abf12395nskfns" +API_HASH=abf12395nskfns # HASH -API_KEYS=[] -# Your https://api.webscraping.ai/ Keys -# Multiple values are separated by , -# so [122456, 78990] +#STRING_SESSION= +#BOT_TOKEN= +# Uncomment the mode you wanna use it on and add value. +# Only a Single Mode is supported at a time so dont add both. + + BLOCKED_USERS_MESSAGE_ID = 0 @@ -16,7 +18,6 @@ BLOCKED_USERS_MESSAGE_ID = 0 # 69 in the end of the list so Value is 69 # Blocked users list - DEV_MODE=0 # Change to 1 if you want exec, sh, shell commands @@ -38,11 +39,7 @@ AUTO_DL_MESSAGE_ID=0 # For Auto DL chat List -TRIGGER="." - - -STRING_SESSION="Aq0dj......" -# Your session +TRIGGER=. USERS_MESSAGE_ID = 0