Untitled

 avatar
unknown
python
a year ago
7.0 kB
20
Indexable
import requests
from time import time as timestamp
from datetime import datetime
from time import sleep
from json_minify import json_minify
from concurrent.futures import ThreadPoolExecutor
from os import urandom
from pytz import timezone
from base64 import b64encode
from hashlib import sha1
from itertools import cycle
from pymongo import MongoClient
import json
import os
import hmac

import heroku3
import random
import concurrent.futures
import aminofix
c=aminofix.Client()



PREFIX = bytes.fromhex("19")
SIG_KEY = bytes.fromhex("DFA5ED192DDA6E88A12FE12130DC6206B1251E44")
DEVICE_KEY = bytes.fromhex("E7309ECC0953C6FA60005B2765F99DBBC965C8E9")
links = ['https://ff6.ncm5okz.workers.dev/proxy?url=', 'https://ff7.sv6gyb.workers.dev/proxy?url=', 'https://hello-world-bold-night-7d31.rrl1gzecjbcr.workers.dev/proxy?url=', 'https://ff8.grkkdg.workers.dev/proxy?url=', 'https://hello-world-twilight-base-79df.oi5oj6y8cw.workers.dev/proxy?url=', 'https://ff2.f9rebc6p.workers.dev/proxy?url=', 'https://ff.gj2f5cs.workers.dev/proxy?url=', 'https://ff8.tpq7724.workers.dev/proxy?url=', 'https://hello-world-withered-recipe-2d20.2o8bynlc5s.workers.dev/proxy?url=', 'https://ff6.f8xvyjrmwdt4.workers.dev/proxy?url=', 'https://ff3.unco1pzdvma.workers.dev/proxy?url=', 'https://e22.1v0lqdxcl.workers.dev/proxy?proxyUrl=', 'https://e2233.hfsw6vwek.workers.dev/proxy?proxyUrl=', 'https://e367.txa7zwnqx1.workers.dev/proxy?proxyUrl=', 'https://ff2.f81xgy4ivl7m.workers.dev/proxy?url=', 'https://ff8.3j83jgc8ppd.workers.dev/proxy?url=', 'https://e223.7yggfjd0.workers.dev/proxy?proxyUrl=', 'https://ff3.jp3rpu1el4s.workers.dev/proxy?url=', 'https://e3611.txa7zwnqx1.workers.dev/proxy?proxyUrl=', 'https://ff7.dbnofc.workers.dev/proxy?url=', 'https://e3ykjkj.d1raqj85x.workers.dev/proxy?proxyUrl=', 'https://ff0.n9zm1upl.workers.dev/proxy?url=', 'https://e3yk.bisnsl9x.workers.dev/proxy?proxyUrl=', 'https://e3y.lm0s91u1wrv.workers.dev/proxy?proxyUrl=', 'https://ff4.25fxw7.workers.dev/proxy?url=', 'https://newr.grkkdg.workers.dev/proxy?proxyUrl=', 'https://ff5.gdn708wqrij2.workers.dev/proxy?url=', 'https://yes.trl0z2le.workers.dev/proxy?proxyUrl=']

interestId=['716a3918-c879-4ecd-bf64-2d3e19e8f05d', '77abcedf-65b9-4001-8bfc-6d250a67cac5', '271b74a8-f488-4b8f-9e2e-6acc8be6760c', '19900a39-8b0d-40ff-8dcf-f0881566c347', '31715d35-ea4f-409b-b1ca-e48c2cb67731', 'b44b02f9-a915-4c9f-935d-30c0711e02fb', 'd15ea6c4-a965-4dee-8fe1-e0d4eeaf7982', '6ea19e78-8721-409f-8a0a-cbfef18512b6', '722207e7-4971-4e15-9f4d-84af08d94d6a', '922ffc28-437e-42ff-a420-5cf611852cdd', '74d434ce-d4d2-4a02-931f-98a715c87609', '3445c682-d05c-4f4b-bfc5-ad5f649072b0', 'de5a7bfa-8ea2-4a92-a419-fc721c7e8c3e', 'c0889c2f-6ebd-45fa-9a07-ab1042aaaf74', 'a377fca4-004c-4b69-b63a-05393dd0c029', 'b1f95923-8415-4f9d-9387-353d892521e4', '39b92e2e-e894-4ed3-a55c-84ec56e72fce', 'ec3f93ba-7ce6-4376-979d-9b6aa52b715b', 'fe253e7b-ca9b-4a27-b0a0-1b248e804eb7', '18418685-c81e-41ac-af0c-02f8cececae9', 'f9cc905d-9018-462d-b1bc-7530ea56e5af', '689fb4a6-8e8a-45d6-989c-257198ce7ea7', 'f5c6c78d-cbed-4aec-b53c-a49308072803', 'a6ba892b-2541-49a9-a84c-e171f6e7e508']

api = "https://service.aminoapps.com/api/v1"



def gen_deviceId(data: bytes = None) -> str:
    if isinstance(data, str):
        data = bytes(data, 'utf-8')
    identifier = PREFIX + (data or os.urandom(20))
    mac = hmac.new(DEVICE_KEY, identifier, sha1)
    return f"{identifier.hex()}{mac.hexdigest()}".upper()

def sig(data: str) -> str:
    signature = hmac.new(SIG_KEY, data.encode("utf-8"), sha1)
    return b64encode(PREFIX + signature.digest()).decode("utf-8")

def get_comId(dev):
    return requests.get(f"https://noisy-scene-4fbf.2o8bynlc5s.workers.dev/?dev={dev}").json()

def get_headers(sid=None, data=None):
    headers = {
        'Accept-Language': 'en-US',
        'Content-Type': 'application/x-www-form-urlencoded',
        'User-Agent': 'Apple iPhone12,1 iOS v15.5 Main/3.12.2',
        'Accept-Encoding': 'gzip',
        'Connection': 'Upgrade',
        'NDCDEVICEID': gen_deviceId()
    }
    if sid:
        headers['NDCAUTH'] = f"sid={sid}"
    if data:
        headers["NDC-MSG-SIG"] = sig(data)
        headers["Content-Length"] = str(len(data))
    return headers

def get_interest(id):
    r = requests.get(f"https://service.aminoapps.com/api/v1/g/s/interest/{id}/topics?pagingType=t&size=25t", headers=get_headers())
    return r.json()["topicList"]

def get_coms(topicId):
    r = requests.get(f"https://service.aminoapps.com/api/v1/g/s/topic/{topicId}/feed/community?language=en&size=20&pagingType=t", headers=get_headers()).json()
    return r["communityList"]

def get_random_ndcId(interestId):
    listt = []
    with concurrent.futures.ThreadPoolExecutor(max_workers=100) as executor:
        # Use concurrent.futures.ThreadPoolExecutor to parallelize the requests
        future_to_id = {executor.submit(get_interest, id): id for id in interestId}
        for future in concurrent.futures.as_completed(future_to_id):
            id = future_to_id[future]
            try:
                res = future.result()
                for topic_id in res:
                    comm = get_coms(topic_id["topicId"])
                    filtered_list = [item for item in comm if item["joinType"] == 0 and item.get("communityHeat", 0) >= 0.8]
                    if filtered_list:
                        random_element = random.choice(filtered_list)
                        random_ndcId = random_element["ndcId"]
                        print("Random ndcId where joinType is 0:", random_ndcId)
                        listt.append(random_ndcId)
            except Exception as e:
                print(f"Error fetching data for interest ID {id}: {e}")

    if not listt:
        print("No element with joinType 0 and communityHeat >= 0.6 found in the list.")
    return listt

# Assuming interestId is defined somewhere
result = get_random_ndcId(interestId)
print(result)
# if result is not None:
#     print(result)
#     c.login_secret("31 mdZOkzzG 25d8e76b-b940-4b5c-a9bd-d0516e968355 172.70.175.183 43f95dc58223af0570e4e3069541b6fb6040370b 1 1702570683 beI6-g-vN_DBb3dWtkn1o5xAlNg")
#     c.join_community(result)
#     sub=aminofix.SubClient(comId=result,profile=c.profile)
#     p=sub.get_online_users(size=25).profile.userId
#     mess="""
#     1. Hey, I'd like you to join my friend community; it's a new one. There will be lots of chances to earn coins and many more opportunities. You can earn coins daily and also by leveling up.
#     2. There are also bots for everything, including RP and music.
#     3. community chat link: http://aminoapps.com/p/8t5rza9"""
#     sub.start_chat(userId=p,message=mess,title="Not advertising chat",content="http://aminoapps.com/p/8t5rza9",)

# # for idds in p:
# #     try: sub.start_chat(userId=idds,message="hellp?")
# #     except Exception as e:
# #         print(e)
Editor is loading...
Leave a Comment