diff --git a/.sphinx/conf.py b/.sphinx/conf.py index 2be5ec2b..add85f2d 100644 --- a/.sphinx/conf.py +++ b/.sphinx/conf.py @@ -16,7 +16,7 @@ project = "TikTokAPI" copyright = "2023, David Teather" author = "David Teather" -release = "v6.2.2" +release = "v6.3.0" # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/main/usage/configuration.html#general-configuration diff --git a/CITATION.cff b/CITATION.cff index 66875e50..73aed307 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -5,5 +5,5 @@ authors: orcid: "https://orcid.org/0000-0002-9467-4676" title: "TikTokAPI" url: "https://github.com/davidteather/tiktok-api" -version: 6.2.2 -date-released: 2024-03-11 +version: 6.3.0 +date-released: 2024-04-12 diff --git a/TikTokApi/api/hashtag.py b/TikTokApi/api/hashtag.py index 4bbe5709..49e9728b 100644 --- a/TikTokApi/api/hashtag.py +++ b/TikTokApi/api/hashtag.py @@ -111,7 +111,7 @@ async def videos(self, count=30, cursor=0, **kwargs) -> Iterator[Video]: while found < count: params = { "challengeID": self.id, - "count": count, + "count": 35, "cursor": cursor, } diff --git a/TikTokApi/tiktok.py b/TikTokApi/tiktok.py index 893e342e..86d29b41 100644 --- a/TikTokApi/tiktok.py +++ b/TikTokApi/tiktok.py @@ -212,6 +212,8 @@ async def create_sessions( override_browser_args: list[dict] = None, cookies: list[dict] = None, suppress_resource_load_types: list[str] = None, + browser: str = "chromium", + executable_path: str = None ): """ Create sessions for use within the TikTokApi class. @@ -230,6 +232,8 @@ async def create_sessions( override_browser_args (list[dict]): A list of dictionaries containing arguments to pass to the browser. cookies (list[dict]): A list of cookies to use for the sessions, you can get these from your cookies after visiting TikTok. suppress_resource_load_types (list[str]): Types of resources to suppress playwright from loading, excluding more types will make playwright faster.. Types: document, stylesheet, image, media, font, script, textrack, xhr, fetch, eventsource, websocket, manifest, other. + browser (str): specify either firefox or chromium, default is chromium + executable_path (str): Path to the browser executable Example Usage: .. code-block:: python @@ -239,12 +243,19 @@ async def create_sessions( await api.create_sessions(num_sessions=5, ms_tokens=['msToken1', 'msToken2']) """ self.playwright = await async_playwright().start() - if headless and override_browser_args is None: - override_browser_args = ["--headless=new"] - headless = False # managed by the arg - self.browser = await self.playwright.chromium.launch( - headless=headless, args=override_browser_args, proxy=random_choice(proxies) - ) + if browser == "chromium": + if headless and override_browser_args is None: + override_browser_args = ["--headless=new"] + headless = False # managed by the arg + self.browser = await self.playwright.chromium.launch( + headless=headless, args=override_browser_args, proxy=random_choice(proxies), executable_path=executable_path + ) + elif browser == "firefox": + self.browser = await self.playwright.firefox.launch( + headless=headless, args=override_browser_args, proxy=random_choice(proxies), executable_path=executable_path + ) + else: + raise ValueError("Invalid browser argument passed") await asyncio.gather( *( @@ -417,7 +428,7 @@ async def make_request( signed_url = await self.sign_url(encoded_params, session_index=i) retry_count = 0 - while i < retries: + while retry_count < retries: retry_count += 1 result = await self.run_fetch_script( signed_url, headers=headers, session_index=i diff --git a/setup.py b/setup.py index 7623b11b..f1518018 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name="TikTokApi", packages=setuptools.find_packages(), - version="6.2.2", + version="6.3.0", license="MIT", description="The Unofficial TikTok API Wrapper in Python 3.", author="David Teather",