-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
701 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
|
||
# ⚙️ tapswap_tapper (تپ سواپ کلیکر) | ||
|
||
A bot for auto-clicking and bypassing stream codes using Selenium and OCR. | ||
ربات برای کلیک خودکار و دور زدن کدهای استریم با استفاده از Selenium و OCR. | ||
|
||
--- | ||
|
||
 | ||
*Banner for tapswap_tapper* | ||
|
||
--- | ||
|
||
## English | ||
|
||
### Project Title | ||
**tapswap_tapper** | ||
A powerful automation bot designed to click on streams and bypass codes with ease, utilizing Selenium for browser automation, Tesseract OCR for text recognition, and ffmpeg for media processing. | ||
|
||
### Table of Contents | ||
1. [Install & Run](#install--run) | ||
2. [Features](#features) | ||
3. [Contributing](#contributing) | ||
4. [License](#license) | ||
|
||
### Install & Run | ||
|
||
#### Prerequisites | ||
1. Install **Python 3**. | ||
2. Install required libraries from `requirements.txt`. | ||
3. Install **Google Chrome** and set up the **Selenium driver**. | ||
4. Install **tesseract-ocr**. | ||
5. Install **ffmpeg**. | ||
|
||
#### Steps | ||
|
||
1. **Install Python 3** | ||
Ensure that Python 3 is installed on your system. You can download it from [Python Downloads](https://www.python.org/downloads/). | ||
|
||
2. **Install Required Libraries** | ||
Navigate to the project directory and run the following command to install the required Python libraries: | ||
```bash | ||
pip3 install -r requirements.txt | ||
``` | ||
|
||
3. **Install tesseract & ffmpeg on Debian (Ubuntu)** | ||
```bash | ||
sudo apt-get update | ||
sudo apt-get install tesseract-ocr | ||
sudo apt-get install ffmpeg | ||
``` | ||
|
||
4. **Edit the Configuration File** | ||
Modify the `config.json` file with necessary parameters like bot token and API keys: | ||
```json | ||
{ | ||
"url": "", | ||
"limit": 7000, | ||
"multitap_level": 9, | ||
"bot_token": "YOUR_BOT_TOKEN", | ||
"chat_id": YOUR_CHAT_ID, | ||
"ocr_api_key": "YOUR_OCR_API_KEY" | ||
} | ||
``` | ||
|
||
5. **Set Up Chrome Driver** | ||
Download and set up the **Chrome driver** compatible with your browser version. Place it in the project directory. | ||
|
||
6. **YouTube Login Setup** | ||
Add YouTube account login cookies to the `cookies.txt` file to allow the bot to bypass login. | ||
|
||
7. **Run the Bot** | ||
Start the bot by running: | ||
```bash | ||
python3 bot.py | ||
``` | ||
|
||
### Features | ||
- 🔄 **Auto-clicking**: Automatically clicks through streams, saving time and effort. | ||
- 📸 **OCR Integration**: Uses Tesseract OCR for text recognition to bypass code verifications. | ||
- 🔄 **Selenium Automation**: Controls Chrome to automate YouTube interactions and bypass streams. | ||
- ⚙️ **Easy Configuration**: Customizable settings through `config.json`, including API keys and multitap levels. | ||
- 🔒 **Cookie-based Authentication**: Uses stored YouTube login cookies for seamless login. | ||
|
||
--- | ||
|
||
## فارسی (Persian) | ||
|
||
### عنوان پروژه | ||
**تپسواپ تپر** | ||
یک ربات قدرتمند برای کلیک خودکار در استریمها و دور زدن کدهای تایید با استفاده از Selenium و OCR. | ||
|
||
--- | ||
|
||
 | ||
*بنر برای tapswap_tapper* | ||
|
||
--- | ||
|
||
### فهرست مطالب | ||
1. [نصب و اجرا](#نصب-و-اجرا) | ||
2. [ویژگیها](#ویژگیها) | ||
3. [مشارکت](#مشارکت) | ||
4. [مجوز](#مجوز) | ||
|
||
### نصب و اجرا | ||
|
||
#### پیشنیازها | ||
1. نصب **پایتون ۳**. | ||
2. نصب کتابخانههای مورد نیاز از `requirements.txt`. | ||
3. نصب **Google Chrome** و تنظیم **Selenium driver**. | ||
4. نصب **tesseract-ocr**. | ||
5. نصب **ffmpeg**. | ||
|
||
#### مراحل | ||
|
||
1. **نصب پایتون ۳** | ||
مطمئن شوید که پایتون ۳ روی سیستم شما نصب شده است. میتوانید آن را از [Python Downloads](https://www.python.org/downloads/) دانلود کنید. | ||
|
||
2. **نصب کتابخانهها** | ||
به دایرکتوری پروژه بروید و کتابخانههای مورد نیاز را نصب کنید: | ||
```bash | ||
pip3 install -r requirements.txt | ||
``` | ||
|
||
3. **نصب tesseract و ffmpeg در Debian (اوبونتو)** | ||
```bash | ||
sudo apt-get update | ||
sudo apt-get install tesseract-ocr | ||
sudo apt-get install ffmpeg | ||
``` | ||
|
||
4. **ویرایش فایل پیکربندی** | ||
فایل `config.json` را با پارامترهای لازم مثل توکن ربات و کلیدهای API ویرایش کنید: | ||
```json | ||
{ | ||
"url": "", | ||
"limit": 7000, | ||
"multitap_level": 9, | ||
"bot_token": "توکن_ربات_شما", | ||
"chat_id": شناسه_چت_شما, | ||
"ocr_api_key": "کلید_API_OCR_شما" | ||
} | ||
``` | ||
|
||
5. **تنظیم درایور کروم** | ||
درایور **کروم** را مطابق با نسخه مرورگر خود دانلود کرده و در دایرکتوری پروژه قرار دهید. | ||
|
||
6. **راهاندازی ورود به یوتیوب** | ||
کوکیهای ورود حساب یوتیوب خود را در فایل `cookies.txt` قرار دهید تا ربات بتواند بدون ورود مجدد عمل کند. | ||
|
||
7. **اجرای ربات** | ||
برای اجرای ربات دستور زیر را اجرا کنید: | ||
```bash | ||
python3 bot.py | ||
``` | ||
|
||
### ویژگیها | ||
- 🔄 **کلیک خودکار**: به صورت خودکار استریمها را کلیک میکند و در زمان و تلاش صرفهجویی میکند. | ||
- 📸 **یکپارچهسازی OCR**: از Tesseract برای شناسایی متن استفاده میکند تا کدهای تایید را دور بزند. | ||
- 🔄 **اتوماسیون Selenium**: با استفاده از کروم برای تعاملات خودکار یوتیوب و دور زدن استریمها. | ||
- ⚙️ **پیکربندی آسان**: تنظیمات قابل سفارشیسازی از طریق `config.json` شامل کلیدهای API و سطوح چندکلیک. | ||
- 🔒 **احراز هویت بر اساس کوکی**: از کوکیهای ورود یوتیوب برای ورود بدون نیاز به تکرار استفاده میکند. | ||
|
||
--- | ||
|
||
### Contributing (مشارکت) | ||
1. Fork the repository. | ||
ریپوزیتوری را فورک کنید. | ||
|
||
2. Create a new branch: `git checkout -b feature-branch`. | ||
یک شاخه جدید بسازید: `git checkout -b feature-branch`. | ||
|
||
3. Make your changes and commit: `git commit -m 'Add new feature'`. | ||
تغییرات خود را اعمال کنید و کامیت بزنید: `git commit -m 'افزودن ویژگی جدید'`. | ||
|
||
4. Push to the branch: `git push origin feature-branch`. | ||
به شاخه مربوطه پوش کنید: `git push origin feature-branch`. | ||
|
||
5. Submit a pull request. | ||
درخواست Pull Request ارسال کنید. | ||
|
||
--- | ||
|
||
### License (مجوز) | ||
This project is licensed under the MIT License. | ||
این پروژه تحت مجوز MIT ارائه شده است. | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
# Watermark: https://t.me/mizegerddev & https://github.com/mizegerd-tech | ||
|
||
import json | ||
import os | ||
from time import sleep | ||
from threading import Thread | ||
from selenium_driver import driver as ChromeDriver | ||
from code_editor import generate_all_variations | ||
from telebot import TeleBot | ||
|
||
# Load configuration from the config.json file | ||
config = json.loads(open("./config.json", "r").read()) | ||
|
||
# Initialize the Telegram bot with the provided token | ||
bot = TeleBot(config['bot_token']) | ||
chat_id = config['chat_id'] | ||
|
||
def click(driver): | ||
""" | ||
Simulate clicks on the specified element to perform the tapping action. | ||
Args: | ||
driver: The Selenium WebDriver instance. | ||
""" | ||
print("======== Start Tapping ========") | ||
for _ in range(int(config['limit'] / config['multitap_level']) + 1): | ||
driver.find_element("xpath", '//*[@id="ex1-layer"]').click() | ||
|
||
def try_close_msg(driver): | ||
""" | ||
Attempt to close any pop-up messages that may appear on the page. | ||
Args: | ||
driver: The Selenium WebDriver instance. | ||
""" | ||
try: | ||
driver.find_element("xpath", '//*[@id="app"]/div[2]/div[3]/button').click() | ||
except: | ||
pass | ||
sleep(1) | ||
try: | ||
driver.find_element("xpath", '//*[@id="app"]/div[2]/div[1]/div/div').click() | ||
except: | ||
pass | ||
sleep(1) | ||
try: | ||
driver.find_element("xpath", '//*[@id="app"]/div[2]/div[1]/div/div').click() | ||
except: | ||
pass | ||
|
||
def get_stream_link(driver): | ||
""" | ||
Retrieve the stream link from the page and save it to a file. | ||
Args: | ||
driver: The Selenium WebDriver instance. | ||
Returns: | ||
str: The stream link or "Error!" if an error occurs. | ||
""" | ||
try: | ||
driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/button[1]').click() | ||
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') | ||
sleep(1) | ||
driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/div[1]/div[1]/button').click() | ||
with open("stream.link", "w") as f: | ||
f.write(link) | ||
sleep(1) | ||
return link | ||
except: | ||
return "Error!" | ||
|
||
def try_stream_code(driver, code): | ||
""" | ||
Attempt to apply the stream code and handle the result. | ||
Args: | ||
driver: The Selenium WebDriver instance. | ||
code: The stream code to apply. | ||
""" | ||
try: | ||
before = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[2]/div[2]/div[1]/div[1]/h1').text | ||
driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[1]').click() | ||
sleep(1) | ||
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) | ||
driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/button').click() | ||
sleep(12) | ||
|
||
btn = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/button') | ||
btn_text = btn.text | ||
try_code_list = True | ||
|
||
possible_cases = generate_all_variations(code) | ||
print(possible_cases) | ||
|
||
if btn_text == "Claim": | ||
btn.click() | ||
try_code_list = False | ||
sleep(2) | ||
after = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[2]/div[2]/div[1]/div[1]/h1').text | ||
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}') | ||
|
||
if try_code_list: | ||
bot.send_photo(chat_id, open("./code.png", "rb"), caption=f'try code list\n\n{str(possible_cases)}') | ||
for c in possible_cases: | ||
if try_code_list: | ||
driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/div[2]/div[2]/div[2]/input').clear() | ||
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) | ||
driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/button').click() | ||
sleep(12) | ||
btn = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/button') | ||
btn_text = btn.text | ||
if btn_text == "Claim": | ||
btn.click() | ||
try_code_list = False | ||
sleep(2) | ||
after = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[2]/div[2]/div[1]/div[1]/h1').text | ||
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}') | ||
|
||
if try_code_list: | ||
bot.send_photo(chat_id, open("./code.png", "rb"), caption=f'try code list Unsuccessful\n\n{str(possible_cases)}') | ||
try: | ||
driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[2]/div[1]/div/div').click() | ||
except: | ||
pass | ||
|
||
with open("./code.txt", "w") as f: | ||
f.write("0") | ||
print("stream code entered...") | ||
except: | ||
print("stream code apply error") | ||
|
||
def main(): | ||
""" | ||
Main function to initialize the WebDriver, perform actions, and handle the main loop. | ||
""" | ||
driver = ChromeDriver() | ||
driver.get(config['url']) | ||
|
||
sleep(5) | ||
try_close_msg(driver) | ||
|
||
print(f'Stream Youtube Link ===> ', get_stream_link(driver)) | ||
|
||
refresh_time = 0 | ||
|
||
while True: | ||
try: | ||
print("Check Energy ...") | ||
energy = driver.find_element("xpath", '//*[@id="app"]/div[1]/div[3]/div/div[1]/div[1]/h4').text | ||
energy = energy.split("/")[0] | ||
energy = int(energy) | ||
print("energy: ", energy) | ||
if energy > config['limit'] - 10: | ||
click(driver) | ||
|
||
code = open("./code.txt", "r").read() | ||
if not code == "0": | ||
try_stream_code(driver, code) | ||
sleep(10) | ||
refresh_time = refresh_time + 1 | ||
if refresh_time > 60: | ||
print("Refresh Page, Waiting ...") | ||
driver.get(config['url']) | ||
refresh_time = 0 | ||
sleep(15) | ||
|
||
try_close_msg(driver) | ||
except: | ||
driver.get(config['url']) | ||
sleep(15) | ||
try_close_msg(driver) | ||
print("Check Energy or Tapping Process Error !!") | ||
|
||
driver.quit() | ||
|
||
# Start the main function in a new thread | ||
Thread(target=main).start() | ||
|
||
# Start the youtube_stream.py script in a new thread | ||
Thread(target=os.system, args=("python3 youtube_stream.py",)).start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0 |
Oops, something went wrong.