Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from ..utils.gorgon import Xgorgon
- import requests, urllib.parse, time, random, uuid, hashlib
- class Viewbot:
- def __init__(self, item_id):
- self.item_id = item_id
- self.sdk_version = "2"
- self.passport_sdk_version = "19"
- self.xtt_dm_status = "login=0;ct=0"
- self.host = "api16-va.tiktokv.com"
- self.user_agent = "okhttp/3.10.0.1"
- self.app_version = "19.1.3"
- self.devices = [
- "SM-E426B",
- "SM-M326B",
- "SM-A528B",
- "SM-F711B",
- "SM-F926B",
- "SM-A037G",
- "SM-A225F",
- "SM-A226B",
- "SM-M426B",
- "SM-A525F",
- ]
- def unix(self, spoof: int = 0) -> str:
- if spoof == 0:
- _unix = str(int(time.time()))
- else:
- _unix = str(round(time.time(), spoof)).replace(".", "")
- return _unix
- def params(self):
- params = {
- "passport-sdk-version": self.passport_sdk_version,
- "os_api": "25",
- "device_type": random.choices(self.devices),
- "ssmix": "a",
- "manifest_version_code": "2021901030",
- "dpi": "320",
- "carrier_region": "IE",
- "uoo": "0",
- "region": "US",
- "carrier_region_v2": "310",
- "app_name": "musical_ly",
- "version_name": self.app_version,
- "timezone_offset": "7200",
- "ts": self.unix(),
- "ab_version": self.app_version,
- "cpu_support64": "false",
- "ac2": "wifi",
- "ac": "wifi",
- "app_type": "normal",
- "host_abi": "armeabi-v7a",
- "channel": "googleplay",
- "update_version_code": "2021901030",
- "_rticket": self.unix(spoof=3),
- "device_platform": "android",
- "iid": random.randint(1000000000000000000, 9999999999999999999),
- "build_number": self.app_version,
- "locale": "en",
- "op_region": "IE",
- "version_code": str(self.app_version).replace(".", "0"),
- "timezone_name": "Africa/Harare",
- "cdid": str(uuid.uuid4()),
- "openudid": "0e96eaebc0c2e44f",
- "device_id": random.randint(1000000000000000000, 9999999999999999999),
- "sys_region": "US",
- "app_language": "en",
- "resolution": "900*1600",
- "device_brand": "samsung",
- "language": "en",
- "os_version": "7.1.2",
- "aid": "1233",
- "mcc_mnc": "31002",
- }
- return str(urllib.parse.urlencode(params))
- def data(self):
- payload = (
- f"item_id={self.item_id}"
- + "&sync_origin=false"
- + "&first_install_time=1653681371"
- + "&pre_item_playtime=2968"
- + "&follower_status=0"
- + "&pre_hot_sentence="
- # +"&pre_item_id=7120300037371989254"
- + "&play_delta=1"
- + f"&action_time={self.unix()}"
- + "&aweme_type=0"
- + "&tab_type=1"
- + "&follow_status=1"
- )
- return payload
- def stub(self, data: str):
- _stub = str(hashlib.md5(data.encode()).hexdigest()).upper()
- return _stub
- def headers(self, params: str, data: str):
- headers = {
- "x-ss-stub": self.stub(data = data),
- "accept-encoding": "gzip",
- "passport-sdk-version": self.passport_sdk_version,
- #"x-tt-token": "0315b7d97b63b1a54be355352b21a58431007e64e9ff02986394452a0883bd19ca69f584032c0b141496d5903389d64eb707a588dca52a71aaf54a8b1b3469416d2fd3d9ddcfe84c2c65d220a825384c0eaa90683d5e3440c1118fcf1785f3c39d1d8-1.0.1",
- "sdk-version": "2",
- "x-ss-req-ticket": self.unix(spoof=3),
- "x-tt-dm-status": self.xtt_dm_status,
- "x-tt-cmpl-token": "AgQQAPObF-RPsI8CtPIKJt0_xfZsL4wdv4BpYMYuRA",
- #"cookie": "passport_csrf_token=c8ab7ab8f0bfe9eb1e1e2f8eaaab5aba; passport_csrf_token_default=c8ab7ab8f0bfe9eb1e1e2f8eaaab5aba; d_ticket=f4cea49a3aeec80297f50ee07cfa97fe07649; multi_sids=6862459255506863110%3A15b7d97b63b1a54be355352b21a58431; odin_tt=0c0e829a67df59990bd7535a5d4e8f1767b07c6a01875c967010fc90bbc083cd6589088714205a5a42861a7bbe6fd9ea1914c5bb490d2cbfd79ae69947cc3595074b93c1e8262159948dab261eb2e405; cmpl_token=AgQQAPObF-RPsI8CtPIKJt0_xfZsL4wdv4AQYMYr9A; sid_guard=15b7d97b63b1a54be355352b21a58431%7C1658188812%7C15552000%7CSun%2C+15-Jan-2023+00%3A00%3A12+GMT; uid_tt=e3b2ee40c76dc2b3ba5cdaef5dfa151e54bf33436d47c2b74e4f18ce4c532f13; uid_tt_ss=e3b2ee40c76dc2b3ba5cdaef5dfa151e54bf33436d47c2b74e4f18ce4c532f13; sid_tt=15b7d97b63b1a54be355352b21a58431; sessionid=15b7d97b63b1a54be355352b21a58431; sessionid_ss=15b7d97b63b1a54be355352b21a58431; store-idc=maliva; store-country-code=fr; tt-target-idc=useast1a; install_id=7121866431746524933; ttreq=1$f5f02d84a48df26a5e69335d07d1b9787aebdb3a; msToken=h2FGrgD2vEz_s6GrKKO8rjL8LiSGePBNKMbqmTaqkuEuG4uBTD4BnxfzaPTCNb-dVElJ_JoX2ch_miTwgLK-3K-rdgLX5p01VPLqQSw-h66YCXODbkmbdw==",
- "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
- "host": self.host,
- "connection": "Keep-Alive",
- "user-agent": self.user_agent,
- }
- xg = Xgorgon(
- params=params,
- data=data,
- cookies=None
- ).get_value()
- headers["x-gorgon"] = xg["X-Gorgon"]
- headers["x-khronos"] = xg["X-Khronos"]
- return headers
- def __main__(self):
- params = self.params()
- data = self.data()
- url = (
- "https://"
- + "api16-va.tiktokv.com"
- + "/aweme/v1/aweme/stats/?"
- + params
- )
- req = requests.get(
- url = url,
- headers = self.headers(params, data),
- data = data
- )
- if __name__ == "__main__":
- Viewbot(item_id="")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement