social-dl/app/api/tiktok.py
anonymousx97 490d972ee3 Social-DL V2
New Banner.
Added Credits and Disclaimer.

Refactored the bot into modules.
switched to Latest Pyrogram.
Switched to Custom Client Object.
switched to Custom Message Object.
Switched to Custom decorators.
Switched to Custom filters.
Switched to Classes for media extractors.
Droped Wget
Switched to native In_Memory_DL

Added Gallery-dl Library.
Added Twitter Image support.
Added Threads Support.
Added YouTube Videos up to 5 Minutes.
Added Tiktok Pics Support.

Added .help command.
Added .shell command with Live shell output.
Added Add-Del Sudo commands.
Added Add-Del Chat commands.
Added Block-Unblock Commands.
Added Banner In About message.
Added .reply as Echo command.
Added restart confirmation.
Catch Exceptions and log in the Log Channel.
2023-07-09 23:11:11 +05:30

24 lines
865 B
Python
Executable File

from app.api.tiktok_scraper import Scraper as Tiktok_Scraper
from app.core.scraper_config import ScraperConfig
tiktok_scraper = Tiktok_Scraper(quiet=True)
class Tiktok(ScraperConfig):
def __init__(self, url):
super().__init__()
self.url = url
self.set_sauce(url)
async def download_or_extract(self):
media = await tiktok_scraper.hybrid_parsing(self.url)
if not media or "status" not in media or media["status"] == "failed":
return
if "video_data" in media:
self.link = media["video_data"]["nwm_video_url_HQ"]
self.thumb = media["cover_data"]["dynamic_cover"]["url_list"][0]
self.video = self.success = True
if "image_data" in media:
self.link = media["image_data"]["no_watermark_image_list"]
self.group = self.success = True