├── README.md ├── banner.png ├── bot.py ├── code.png ├── code.txt ├── code_editor.py ├── config.json ├── cookies.txt ├── ocr.py ├── requirements.txt ├── selenium_driver.py ├── stream.blacklist ├── stream.link └── youtube_stream.py /README.md: -------------------------------------------------------------------------------- 1 | # tapswap_tapper 2 | 3 | tapswap bot for auto click and bypass stream codes 4 | 5 | ![banner](banner.png) 6 | 7 | ## Install & Run 8 | 9 | ### Prerequisites 10 | 1. Install Python 3. 11 | 2. Install necessary libraries from `requirements.txt`. 12 | 3. Install google chome and setup selenium driver 13 | 4. tesseract-ocr 14 | 5. ffmpeg 15 | 16 | ### Steps 17 | 18 | 1. **Install Python 3** 19 | Ensure that you have Python 3 installed on your system. You can download and install it from the official Python website: [Python Downloads](https://www.python.org/downloads/). 20 | 21 | 2. **Install Libraries from `requirements.txt`** 22 | Open your terminal and navigate to the project directory. Run the following command to install the required libraries: 23 | ```sh 24 | pip3 install -r requirements.txt 25 | 26 | 27 | 3. **Install tesseract & ffmpeg in Debian (ubuntu)** 28 | ```sh 29 | sudo apt-get update 30 | sudo apt-get install tesseract-ocr 31 | sudo apt-get install ffmpeg 32 | 33 | 3. **Install tesseract in Debian (ubuntu)** 34 | ```sh 35 | sudo apt-get update 36 | sudo apt-get install tesseract-ocr 37 | 38 | 39 | 4. **Edit the Configuration File** 40 | - Open the `config.json` file and edit the necessary parameters. 41 | - Example `config.json`: 42 | - Get api key from [OCR](https://ocr.space) 43 | ```json 44 | { 45 | "url": "", 46 | "limit": 7000, 47 | "multitap_level": 9, 48 | "bot_token": "5355443512:AAFH1UigfirhfkwruhfowirufhoQ7Pw", 49 | "chat_id": 1979953056, 50 | "ocr_api_key": "Kiweygfieyiwe88957" 51 | } 52 | 53 | 54 | 5. **Install and setup google chrome driver** 55 | 56 | 6. **youtube login** 57 | - Add all youtube account login cookies in cookies.txt 58 | 59 | 8. **run** 60 | ```python 61 | python3 bot.py 62 | -------------------------------------------------------------------------------- /banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fploit/tapswap_tapper/db02d08270a5a4f6708027c790756a538e6efe1b/banner.png -------------------------------------------------------------------------------- /bot.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | from time import sleep 4 | from threading import Thread 5 | from selenium_driver import driver as ChromeDriver 6 | from code_editor import generate_all_variations 7 | from telebot import TeleBot 8 | 9 | 10 | config = json.loads(open("./config.json", "r").read()) 11 | bot = TeleBot(config['bot_token']) 12 | chat_id = config['chat_id'] 13 | 14 | def click(driver): 15 | print("======== Start Tapping ========") 16 | for _ in range(int(config['limit'] / config['multitap_level']) + 1): 17 | driver.find_element("xpath", '//*[@id="ex1-layer"]').click() 18 | 19 | 20 | def try_close_msg(driver): 21 | try: 22 | driver.find_element("xpath", '//*[@id="app"]/div[2]/div[3]/button').click() 23 | except: 24 | pass 25 | sleep(1) 26 | try: 27 | driver.find_element("xpath", '//*[@id="app"]/div[2]/div[1]/div/div').click() 28 | except: 29 | pass 30 | sleep(1) 31 | try: 32 | driver.find_element("xpath", '//*[@id="app"]/div[2]/div[1]/div/div').click() 33 | except: 34 | pass 35 | 36 | 37 | def get_stream_link(driver): 38 | try: 39 | driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/button[1]').click() 40 | link = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/div[1]/div[2]/div[2]/div[1]/a').get_attribute('href') 41 | sleep(1) 42 | driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/div[1]/div[1]/button').click() 43 | with open("stream.link", "w") as f: 44 | f.write(link) 45 | sleep(1) 46 | return link 47 | except: 48 | return "Error!" 49 | 50 | 51 | def try_stream_code(driver, code): 52 | try: 53 | before = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[2]/div[2]/div[1]/div[1]/h1').text 54 | driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[1]').click() 55 | sleep(1) 56 | driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/div[2]/div[2]/div[2]/input').send_keys(code) 57 | driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/button').click() 58 | sleep(12) 59 | 60 | btn = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/button') 61 | btn_text = btn.text 62 | try_code_list = True 63 | 64 | possible_cases = generate_all_variations(code) 65 | print(possible_cases) 66 | 67 | if btn_text == "Claim": 68 | btn.click() 69 | try_code_list = False 70 | sleep(2) 71 | after = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[2]/div[2]/div[1]/div[1]/h1').text 72 | bot.send_photo(chat_id, open("./code.png", "rb"), caption=f'{code}\n\nStream code entered successfully\nbefore apply code => {before}\nafter apply code => {after}') 73 | 74 | if try_code_list: 75 | bot.send_photo(chat_id, open("./code.png", "rb"), caption=f'try code list\n\n{str(possible_cases)}') 76 | for c in possible_cases: 77 | if try_code_list: 78 | driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/div[2]/div[2]/div[2]/input').clear() 79 | driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/div[2]/div[2]/div[2]/input').send_keys(c) 80 | driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/button').click() 81 | sleep(12) 82 | btn = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/button') 83 | btn_text = btn.text 84 | if btn_text == "Claim": 85 | btn.click() 86 | try_code_list = False 87 | sleep(2) 88 | after = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[2]/div[2]/div[1]/div[1]/h1').text 89 | bot.send_photo(chat_id, open("./code.png", "rb"), caption=f'{code}\n\nStream code entered successfully ==> {c}\nbefore apply code => {before}\nafter apply code => {after}') 90 | 91 | if try_code_list: 92 | bot.send_photo(chat_id, open("./code.png", "rb"), caption=f'try code list Unsuccessful\n\n{str(possible_cases)}') 93 | try: 94 | driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/div[1]/div/div').click() 95 | except: 96 | pass 97 | 98 | with open("./code.txt", "w") as f: 99 | f.write("0") 100 | print("stream code entered...") 101 | except: 102 | print("stream code apply error") 103 | 104 | def main(): 105 | driver = ChromeDriver() 106 | driver.get(config['url']) 107 | 108 | sleep(5) 109 | try_close_msg(driver) 110 | 111 | print(f'Stream Youtube Link ===> ', get_stream_link(driver)) 112 | 113 | refresh_time = 0 114 | 115 | while True: 116 | try: 117 | print("Check Energy ...") 118 | energy = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[1]/h4').text 119 | energy = energy.split("/")[0] 120 | energy = int(energy) 121 | print("energy: ", energy) 122 | if energy > config['limit'] - 10: 123 | click(driver) 124 | 125 | code = open("./code.txt", "r").read() 126 | if not code == "0": 127 | try_stream_code(driver, code) 128 | sleep(10) 129 | refresh_time = refresh_time + 1 130 | if refresh_time > 60: 131 | print("Refresh Page, Waiting ...") 132 | driver.get(config['url']) 133 | refresh_time = 0 134 | sleep(15) 135 | 136 | try_close_msg(driver) 137 | except: 138 | driver.get(config['url']) 139 | sleep(15) 140 | try_close_msg(driver) 141 | print("Check Energy or Tapping Proccess Error !!") 142 | 143 | 144 | 145 | driver.quit() 146 | 147 | 148 | 149 | Thread(target=main).start() 150 | Thread(target=os.system("python3 youtube_stream.py")) 151 | -------------------------------------------------------------------------------- /code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fploit/tapswap_tapper/db02d08270a5a4f6708027c790756a538e6efe1b/code.png -------------------------------------------------------------------------------- /code.txt: -------------------------------------------------------------------------------- 1 | 0 -------------------------------------------------------------------------------- /code_editor.py: -------------------------------------------------------------------------------- 1 | def generate_all_variations(code): 2 | def generate_cases(current, index): 3 | if index == len(current): 4 | cases.append(current) 5 | return 6 | char = current[index] 7 | if char in replace_dict: 8 | for replacement in replace_dict[char]: 9 | generate_cases(current[:index] + replacement + current[index+1:], index + 1) 10 | else: 11 | generate_cases(current, index + 1) 12 | 13 | cases = [] 14 | replace_dict = { 15 | 'W': ['W', 'w'], 16 | 'w': ['W', 'w'], 17 | 'S': ['S', 's'], 18 | 's': ['S', 's'], 19 | 'K': ['K', 'k'], 20 | 'k': ['K', 'k'], 21 | 'z': ['Z', 'z'], 22 | 'Z': ['Z', 'z'], 23 | 'X': ['X', 'x'], 24 | 'x': ['X', 'x'], 25 | 'C': ['C', 'c'], 26 | 'c': ['C', 'c'], 27 | 'V': ['V', 'v'], 28 | 'v': ['V', 'v'], 29 | 'O': ['O', 'o', '0'], 30 | '0': ['0', 'o', 'O'], 31 | 'o': ['o', 'O', '0'] 32 | } 33 | generate_cases(code, 0) 34 | return cases 35 | 36 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "url": "", 3 | "limit": 7000, 4 | "multitap_level": 9, 5 | "bot_token": "5355443512:AAFH1UigfirhfkwruhfowirufhoQ7Pw", 6 | "chat_id": 1979953056, 7 | "ocr_api_key": "Kiweygfieyiwe88957" 8 | } -------------------------------------------------------------------------------- /cookies.txt: -------------------------------------------------------------------------------- 1 | .youtube.com TRUE / FALSE 0 APISID tiHBhEO-RXaEw-RW/AOE_m3Uk3uheiu3hKPYH 2 | .youtube.com TRUE / FALSE 1691736178 GPS 1 3 | .youtube.com TRUE / FALSE 0 HSID ARN-JUCvpLS-u-ASB 4 | .youtube.com TRUE / FALSE 1757748289 LOGIN_INFO AFmmF2wyjrfgwie9feLoSGZ5IR6E_gB4nYTwtXu8Pc32eBgkeuhfweufkpMLWFoUTdMWW5mZzJKcTl6QXh2Nlp6Y0NKc2JSZW0wTTVSS2FOOEVkclVRb2tIbktuMUFqRDVBNDhIYVVHb1o1RlF0Wi1BUUJVRHNEU2lham5rb1NlX29peXZ6MGtkek4Ws2ajRB 5 | .youtube.com TRUE / FALSE 1757748298 PREF tz=Asia.Tehran&f4=4000000&f6=40000000 6 | -------------------------------------------------------------------------------- /ocr.py: -------------------------------------------------------------------------------- 1 | import json 2 | import requests 3 | import os 4 | from PIL import Image 5 | import cv2 6 | import pytesseract 7 | 8 | config = json.loads(open("./config.json", "r").read()) 9 | 10 | 11 | 12 | def resize_image(image_path, max_size_kb=1024): 13 | # Open the image file 14 | with Image.open(image_path) as img: 15 | # Get the current size in bytes 16 | current_size = os.path.getsize(image_path) 17 | # Convert to KB 18 | current_size_kb = current_size / 1024 19 | 20 | # Resize if the image is larger than max_size_kb 21 | if current_size_kb > max_size_kb: 22 | # Calculate the reduction factor 23 | reduction_factor = (max_size_kb / current_size_kb) ** 0.5 24 | new_width = int(img.width * reduction_factor) 25 | new_height = int(img.height * reduction_factor) 26 | 27 | # Resize the image 28 | img = img.resize((new_width, new_height), Image.Resampling.LANCZOS) 29 | 30 | # Save the resized image to a new file 31 | resized_image_path = os.path.basename(image_path) 32 | img.save(resized_image_path, optimize=True, quality=85) 33 | 34 | return resized_image_path 35 | else: 36 | return image_path 37 | 38 | 39 | def check_text_in_image(image_path): 40 | image = cv2.imread(image_path) 41 | 42 | gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) 43 | 44 | text = pytesseract.image_to_string(gray) 45 | 46 | has_digit = any(char.isdigit() for char in text) 47 | has_alpha = any(char.isalpha() for char in text) 48 | 49 | return has_digit, has_alpha 50 | 51 | 52 | def png_to_text(file_path): 53 | try: 54 | api_key = config['ocr_api_key'] 55 | url = "https://api8.ocr.space/parse/image" 56 | 57 | file_path = resize_image(file_path) 58 | 59 | payload = { 60 | "language": "eng", 61 | "isOverlayRequired": True, 62 | "FileType": ".Auto", 63 | "IsCreateSearchablePDF": False, 64 | "isSearchablePdfHideTextLayer": True, 65 | "detectOrientation": False, 66 | "isTable": False, 67 | "scale": True, 68 | "OCREngine": 1, 69 | "detectCheckbox": False, 70 | "checkboxTemplate": 0 71 | } 72 | 73 | with open(file_path, 'rb') as file: 74 | files = { 75 | 'file': (file_path, file, 'image/png') 76 | } 77 | headers = { 78 | 'apikey': api_key 79 | } 80 | response = requests.post(url, headers=headers, data=payload, files=files) 81 | 82 | return response.json()['ParsedResults'][0]['TextOverlay']['Lines'][0]['LineText'] 83 | except: 84 | return "0" 85 | 86 | 87 | def check_photo(): 88 | photo_path = './code.png' 89 | has_digit, has_alpha = check_text_in_image(photo_path) 90 | print(f"Contains digits: {has_digit}") 91 | print(f"Contains letters: {has_alpha}") 92 | if has_alpha or has_digit: 93 | return png_to_text(photo_path) 94 | else: 95 | return "0" 96 | 97 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pyTelegramBotAPI 2 | Telethon 3 | pillow 4 | selenium 5 | fake-useragent 6 | pytesseract 7 | opencv-python -------------------------------------------------------------------------------- /selenium_driver.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from selenium.webdriver.chrome.options import Options 3 | from fake_useragent import UserAgent 4 | 5 | 6 | def get_random_user_agent(): 7 | ua = UserAgent() 8 | return ua.random 9 | 10 | 11 | def driver(): 12 | chrome_options = Options() 13 | chrome_options.add_argument("--headless") 14 | chrome_options.add_argument("--no-sandbox") 15 | chrome_options.add_argument("--disable-dev-shm-usage") 16 | 17 | mobile_emulation = { 18 | "deviceMetrics": { "width": 360, "height": 640, "pixelRatio": 3.0 }, 19 | "userAgent": get_random_user_agent() 20 | } 21 | 22 | chrome_options.add_experimental_option("mobileEmulation", mobile_emulation) 23 | 24 | driver = webdriver.Chrome(options=chrome_options) 25 | return driver 26 | -------------------------------------------------------------------------------- /stream.blacklist: -------------------------------------------------------------------------------- 1 | 0t9UOv1W1 2 | t9UOv1W1 3 | .t9UOv1W1 4 | 0 5 | -------------------------------------------------------------------------------- /stream.link: -------------------------------------------------------------------------------- 1 | https://www.youtube.com/live/0Sfo3oBkfSU -------------------------------------------------------------------------------- /youtube_stream.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | from time import sleep 4 | from threading import Thread 5 | from selenium_driver import driver as ChromeDriver 6 | from code_editor import generate_all_variations 7 | from telebot import TeleBot 8 | 9 | 10 | config = json.loads(open("./config.json", "r").read()) 11 | bot = TeleBot(config['bot_token']) 12 | chat_id = config['chat_id'] 13 | 14 | def click(driver): 15 | print("======== Start Tapping ========") 16 | for _ in range(int(config['limit'] / config['multitap_level']) + 1): 17 | driver.find_element("xpath", '//*[@id="ex1-layer"]').click() 18 | 19 | 20 | def try_close_msg(driver): 21 | try: 22 | driver.find_element("xpath", '//*[@id="app"]/div[2]/div[3]/button').click() 23 | except: 24 | pass 25 | sleep(1) 26 | try: 27 | driver.find_element("xpath", '//*[@id="app"]/div[2]/div[1]/div/div').click() 28 | except: 29 | pass 30 | sleep(1) 31 | try: 32 | driver.find_element("xpath", '//*[@id="app"]/div[2]/div[1]/div/div').click() 33 | except: 34 | pass 35 | 36 | 37 | def get_stream_link(driver): 38 | try: 39 | driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/button[1]').click() 40 | link = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/div[1]/div[2]/div[2]/div[1]/a').get_attribute('href') 41 | sleep(1) 42 | driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/div[1]/div[1]/button').click() 43 | with open("stream.link", "w") as f: 44 | f.write(link) 45 | sleep(1) 46 | return link 47 | except: 48 | return "Error!" 49 | 50 | 51 | def try_stream_code(driver, code): 52 | try: 53 | before = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[2]/div[2]/div[1]/div[1]/h1').text 54 | driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[1]').click() 55 | sleep(1) 56 | driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/div[2]/div[2]/div[2]/input').send_keys(code) 57 | driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/button').click() 58 | sleep(12) 59 | 60 | btn = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/button') 61 | btn_text = btn.text 62 | try_code_list = True 63 | 64 | possible_cases = generate_all_variations(code) 65 | print(possible_cases) 66 | 67 | if btn_text == "Claim": 68 | btn.click() 69 | try_code_list = False 70 | sleep(2) 71 | after = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[2]/div[2]/div[1]/div[1]/h1').text 72 | bot.send_photo(chat_id, open("./code.png", "rb"), caption=f'{code}\n\nStream code entered successfully\nbefore apply code => {before}\nafter apply code => {after}') 73 | 74 | if try_code_list: 75 | bot.send_photo(chat_id, open("./code.png", "rb"), caption=f'try code list\n\n{str(possible_cases)}') 76 | for c in possible_cases: 77 | if try_code_list: 78 | driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/div[2]/div[2]/div[2]/input').clear() 79 | driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/div[2]/div[2]/div[2]/input').send_keys(c) 80 | driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/button').click() 81 | sleep(12) 82 | btn = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/button') 83 | btn_text = btn.text 84 | if btn_text == "Claim": 85 | btn.click() 86 | try_code_list = False 87 | sleep(2) 88 | after = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[2]/div[2]/div[1]/div[1]/h1').text 89 | bot.send_photo(chat_id, open("./code.png", "rb"), caption=f'{code}\n\nStream code entered successfully ==> {c}\nbefore apply code => {before}\nafter apply code => {after}') 90 | 91 | if try_code_list: 92 | bot.send_photo(chat_id, open("./code.png", "rb"), caption=f'try code list Unsuccessful\n\n{str(possible_cases)}') 93 | try: 94 | driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/div[1]/div/div').click() 95 | except: 96 | pass 97 | 98 | with open("./code.txt", "w") as f: 99 | f.write("0") 100 | print("stream code entered...") 101 | except: 102 | print("stream code apply error") 103 | 104 | def main(): 105 | driver = ChromeDriver() 106 | driver.get(config['url']) 107 | 108 | sleep(5) 109 | try_close_msg(driver) 110 | 111 | print(f'Stream Youtube Link ===> ', get_stream_link(driver)) 112 | 113 | refresh_time = 0 114 | 115 | while True: 116 | try: 117 | print("Check Energy ...") 118 | energy = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[1]/h4').text 119 | energy = energy.split("/")[0] 120 | energy = int(energy) 121 | print("energy: ", energy) 122 | if energy > config['limit'] - 10: 123 | click(driver) 124 | 125 | code = open("./code.txt", "r").read() 126 | if not code == "0": 127 | try_stream_code(driver, code) 128 | sleep(10) 129 | refresh_time = refresh_time + 1 130 | if refresh_time > 60: 131 | print("Refresh Page, Waiting ...") 132 | driver.get(config['url']) 133 | refresh_time = 0 134 | sleep(15) 135 | 136 | try_close_msg(driver) 137 | except: 138 | driver.get(config['url']) 139 | sleep(15) 140 | try_close_msg(driver) 141 | print("Check Energy or Tapping Proccess Error !!") 142 | 143 | 144 | 145 | driver.quit() 146 | 147 | 148 | 149 | Thread(target=main).start() 150 | Thread(target=os.system("python3 youtube_stream.py")) 151 | --------------------------------------------------------------------------------