diff --git a/LICENSE b/LICENSE index fa24a6d..282a8f0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021-2022 MShawon +Copyright (c) 2021-2023 MShawon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 7067953..613c70a 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Simple program to increase YouTube views written in Python. Works with live stre # Requirements - * **Python 3.7.x-3.9.x** + * **Python 3.7.x-3.11.x** * High speed Internet Connection * Good proxy list (http, https, socks4, socks5) * Google Chrome installed on your OS (not Chromium) @@ -105,7 +105,7 @@ Simple program to increase YouTube views written in Python. Works with live stre * [Windows from source code](https://github.com/MShawon/YouTube-Viewer#installation) * [Linux / Mac from source code](https://github.com/MShawon/YouTube-Viewer#linux--mac) 2) Then put your video links in the [urls.txt](https://github.com/MShawon/YouTube-Viewer#urls) file - 3) To search your video on YouTube and then play it put the search keywords and video title in the [search.txt](https://github.com/MShawon/YouTube-Viewer#search) file + 3) To search for your video on YouTube and then play it, put the search keywords and video title in the [search.txt](https://github.com/MShawon/YouTube-Viewer#search) file 4) Get your [proxy](https://github.com/MShawon/YouTube-Viewer#proxies) list 5) Run the script and follow the instructions from there. @@ -146,9 +146,9 @@ Simple program to increase YouTube views written in Python. Works with live stre 2) If you have any external link which will redirect to your youtube video you can use that too. Example : when you post a YouTube video link in **twitter** and you hit play on twitter, you will get a link like this `https://t.co/xxxxxxxxxx?amp=1`. This is helpful because YouTube will see that views are coming from External Source like twitter in this example. # Search - Program can search youtube with the keyword you want and find video with video title. To do this you need to know what keyword can find your video on youtube search engine. Also you need to provide **exact** video title. Put keyword and title like this format `keyword :::: video title` in **search.txt**. You can use same `video title` for multiple `keyword` too. + Program can search youtube with the keyword you want and find the video with video title or video id. To do this you need to know what keyword can find your video on youtube search engine. Also you need to provide **exact** video title or video id. Put keyword and title like this format `keyword :::: video title` or `keyword :::: video id` in **search.txt**. Always use multiple `keyword` for the same `video title` or `video id`. - *If you don't know any keyword just put your `video title :::: video title` in search.txt* + *If you don't know any keyword just put your `video title :::: video title` or `video title :::: video id` in search.txt* # Live Stream @@ -171,7 +171,7 @@ Simple program to increase YouTube views written in Python. Works with live stre * ## Installation - First, make sure you have installed git and Python version between 3.7.x to 3.9.x + First, make sure you have installed git and Python version between 3.7.x to 3.11.x Open command prompt and type ``` @@ -210,7 +210,7 @@ Simple program to increase YouTube views written in Python. Works with live stre # Linux / Mac * ## Installation - First, make sure you have installed git and Python version between 3.7.x to 3.9.x + First, make sure you have installed git and Python version between 3.7.x to 3.11.x Open your favourite terminal and run ``` @@ -252,7 +252,8 @@ Simple program to increase YouTube views written in Python. Works with live stre To get the most out of this script you should maintain these things. * Don't use HEADLESS mode. Because no IP leak prevention, fingerprint defending, etc. can be done in headless mode. * Youtube doesn't count views from the same IP after a certain time. Like, don't expect to get 100 views from 10 proxies. If you want more views, try to use a lot of premium proxies(free proxies are flagged by most websites). DO NOT use TOR proxies. - * It seems Rotating proxy gives the best result. But the IP MUST NOT change on each request. Set the sticky session or TTL to 5 to 15 minutes. + * In a nutshell, you need Rotating proxies to get the best result. But the IP MUST NOT change on each request. Set the sticky session or TTL to 5 to 15 minutes. + * For IPRoyal it would be *Royal Residential Proxies*, not Static Residential proxies * Use both [urls.txt](https://github.com/MShawon/YouTube-Viewer#urls) and [search.txt](https://github.com/MShawon/YouTube-Viewer#search) * And use as many [urls](https://github.com/MShawon/YouTube-Viewer#urls) and [keyword::::title](https://github.com/MShawon/YouTube-Viewer#search) as you can. Don't use just one video. diff --git a/extension/spoof_timezone.zip b/extension/spoof_timezone.zip deleted file mode 100644 index fc9c23f..0000000 Binary files a/extension/spoof_timezone.zip and /dev/null differ diff --git a/proxy_check.py b/proxy_check.py index 0489b0d..aa4443b 100644 --- a/proxy_check.py +++ b/proxy_check.py @@ -1,7 +1,7 @@ """ MIT License -Copyright (c) 2021-2022 MShawon +Copyright (c) 2021-2023 MShawon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/requirements.txt b/requirements.txt index 257a8ec..4364684 100644 Binary files a/requirements.txt and b/requirements.txt differ diff --git a/search.txt b/search.txt index da9eed5..2b7bb35 100644 --- a/search.txt +++ b/search.txt @@ -1,4 +1,6 @@ keyword 1 :::: exact video title 1 keyword 2 :::: exact video title 2 keyword 3 :::: exact video title 2 +keyword 1 :::: video_id 1 +keyword 2 :::: video_id 2 keyword 4 :::: exact video title 3 \ No newline at end of file diff --git a/youtube_viewer.py b/youtube_viewer.py index b142691..edb2224 100644 --- a/youtube_viewer.py +++ b/youtube_viewer.py @@ -1,7 +1,7 @@ """ MIT License -Copyright (c) 2021-2022 MShawon +Copyright (c) 2021-2023 MShawon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -31,6 +31,7 @@ import psutil from fake_headers import Headers, browsers +from faker import Faker from requests.exceptions import RequestException from tabulate import tabulate from undetected_chromedriver.patcher import Patcher @@ -46,7 +47,7 @@ log = logging.getLogger('werkzeug') log.disabled = True -SCRIPT_VERSION = '1.7.6' +SCRIPT_VERSION = '1.8.0' print(bcolors.OKGREEN + """ @@ -96,6 +97,7 @@ threads = 0 views = 100 +fake = Faker() cwd = os.getcwd() patched_drivers = os.path.join(cwd, 'patched_drivers') config_path = os.path.join(cwd, 'config.json') @@ -148,10 +150,10 @@ def clean_exe_temp(folder): if hasattr(sys, '_MEIPASS'): temp_name = sys._MEIPASS.split('\\')[-1] else: - if sys.version_info.minor < 7 or sys.version_info.minor > 9: + if sys.version_info.minor < 7 or sys.version_info.minor > 11: print( f'Your current python version is not compatible : {sys.version}') - print(f'Install Python version between 3.7.x to 3.9.x to run this script') + print(f'Install Python version between 3.7.x to 3.11.x to run this script') input("") sys.exit() @@ -171,23 +173,27 @@ def update_chrome_version(): def check_update(): api_url = 'https://api.github.com/repos/MShawon/YouTube-Viewer/releases/latest' - response = requests.get(api_url, timeout=30) + try: + response = requests.get(api_url, timeout=30) - RELEASE_VERSION = response.json()['tag_name'] + RELEASE_VERSION = response.json()['tag_name'] - if RELEASE_VERSION > SCRIPT_VERSION: - print(bcolors.OKCYAN + '#'*100 + bcolors.ENDC) - print(bcolors.OKCYAN + 'Update Available!!! ' + - f'YouTube Viewer version {SCRIPT_VERSION} needs to update to {RELEASE_VERSION} version.' + bcolors.ENDC) + if RELEASE_VERSION > SCRIPT_VERSION: + print(bcolors.OKCYAN + '#'*100 + bcolors.ENDC) + print(bcolors.OKCYAN + 'Update Available!!! ' + + f'YouTube Viewer version {SCRIPT_VERSION} needs to update to {RELEASE_VERSION} version.' + bcolors.ENDC) - try: - notes = response.json()['body'].split('SHA256')[0].split('\r\n') - for note in notes: - if note: - print(bcolors.HEADER + note + bcolors.ENDC) - except Exception: - pass - print(bcolors.OKCYAN + '#'*100 + '\n' + bcolors.ENDC) + try: + notes = response.json()['body'].split( + 'SHA256')[0].split('\r\n') + for note in notes: + if note: + print(bcolors.HEADER + note + bcolors.ENDC) + except Exception: + pass + print(bcolors.OKCYAN + '#'*100 + '\n' + bcolors.ENDC) + except Exception: + pass def create_html(text_dict): @@ -358,7 +364,7 @@ def youtube_music(driver): return view_stat, output -def spoof_geolocation(proxy_type, proxy, driver): +def spoof_timezone_geolocation(proxy_type, proxy, driver): try: proxy_dict = { "http": f"{proxy_type}://{proxy}", @@ -369,17 +375,37 @@ def spoof_geolocation(proxy_type, proxy, driver): if resp.status_code == 200: location = resp.json() - params = { + tz_params = {'timezoneId': location['timezone']} + latlng_params = { "latitude": location['lat'], "longitude": location['lon'], "accuracy": randint(20, 100) } - driver.execute_cdp_cmd( - "Emulation.setGeolocationOverride", params) + info = f"ip-api.com | Lat : {location['lat']} | Lon : {location['lon']} | TZ: {location['timezone']}" + else: + raise RequestException + + except RequestException: + location = fake.location_on_land() + tz_params = {'timezoneId': location[-1]} + latlng_params = { + "latitude": location[0], + "longitude": location[1], + "accuracy": randint(20, 100) + } + info = f"Random | Lat : {location[0]} | Lon : {location[1]} | TZ: {location[-1]}" - except (RequestException, WebDriverException): + try: + driver.execute_cdp_cmd('Emulation.setTimezoneOverride', tz_params) + + driver.execute_cdp_cmd( + "Emulation.setGeolocationOverride", latlng_params) + + except WebDriverException: pass + return info + def control_player(driver, output, position, proxy, youtube, collect_id=True): current_url = driver.current_url @@ -402,6 +428,9 @@ def control_player(driver, output, position, proxy, youtube, collect_id=True): video_len = video_len*uniform(minimum, maximum) duration = strftime("%Hh:%Mm:%Ss", gmtime(video_len)).lstrip("0h:0m:") + if len(output) == 11: + output = driver.title[:-10] + summary[position] = [position, output, f'{duration} / {actual_duration}'] website.summary_table = tabulate( summary.values(), headers=headers_1, numalign='center', stralign='center', tablefmt="html") @@ -683,7 +712,15 @@ def main_viewer(proxy_type, proxy, position): sleep(2) - spoof_geolocation(proxy_type, proxy, driver) + info = spoof_timezone_geolocation(proxy_type, proxy, driver) + + isdetected = driver.execute_script('return navigator.webdriver') + + print(timestamp() + bcolors.OKBLUE + f"Worker {position} | " + bcolors.OKGREEN + + f"{proxy} | {proxy_type.upper()} | " + bcolors.OKCYAN + f"{info} | Detected? : {isdetected}" + bcolors.ENDC) + + create_html({"#3b8eea": f"Worker {position} | ", + "#23d18b": f"{proxy.split('@')[-1]} | {proxy_type.upper()} | ", "#29b2d3": f"{info} | Detected? : {isdetected}"}) if width == 0: width = driver.execute_script('return screen.width') @@ -981,11 +1018,11 @@ def main(): print(json.dumps(config, indent=4)) print(bcolors.OKCYAN + 'Config file exists! Program will start automatically after 20 seconds...' + bcolors.ENDC) print(bcolors.FAIL + 'If you want to create a new config file PRESS CTRL+C within 20 seconds!' + bcolors.ENDC) - start = time() + start = time() + 20 try: i = 0 while i < 96: - print(bcolors.OKBLUE + f"{time() - start:.0f} seconds remaining " + + print(bcolors.OKBLUE + f"{start - time():.0f} seconds remaining " + animation[i % len(animation)] + bcolors.ENDC, end="\r") i += 1 sleep(0.2) diff --git a/youtubeviewer/__init__.py b/youtubeviewer/__init__.py index 49d37fb..e3cde6d 100644 --- a/youtubeviewer/__init__.py +++ b/youtubeviewer/__init__.py @@ -1,7 +1,7 @@ """ MIT License -Copyright (c) 2021-2022 MShawon +Copyright (c) 2021-2023 MShawon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/youtubeviewer/basics.py b/youtubeviewer/basics.py index 3eb83cb..17b9940 100644 --- a/youtubeviewer/basics.py +++ b/youtubeviewer/basics.py @@ -29,7 +29,6 @@ WEBRTC = os.path.join('extension', 'webrtc_control.zip') ACTIVE = os.path.join('extension', 'always_active.zip') FINGERPRINT = os.path.join('extension', 'fingerprint_defender.zip') -TIMEZONE = os.path.join('extension', 'spoof_timezone.zip') CUSTOM_EXTENSIONS = glob(os.path.join('extension', 'custom_extension', '*.zip')) + \ glob(os.path.join('extension', 'custom_extension', '*.crx')) @@ -122,7 +121,6 @@ def get_driver(background, viewports, agent, auth_required, path, proxy, proxy_t if not background: options.add_extension(WEBRTC) options.add_extension(FINGERPRINT) - options.add_extension(TIMEZONE) options.add_extension(ACTIVE) if CUSTOM_EXTENSIONS: @@ -210,8 +208,14 @@ def scroll_search(driver, video_title): if driver.find_element(By.XPATH, f'//ytd-item-section-renderer[{i}]').text == 'No more results': msg = 'failed' break - find_video = section.find_element( - By.XPATH, f'//*[@title="{video_title}"]') + + if len(video_title) == 11: + find_video = section.find_element( + By.XPATH, f'//a[@id="video-title" and contains(@href, "{video_title}")]') + else: + find_video = section.find_element( + By.XPATH, f'//*[@title="{video_title}"]') + driver.execute_script( "arguments[0].scrollIntoViewIfNeeded();", find_video) sleep(1) @@ -239,14 +243,14 @@ def search_video(driver, keyword, video_title): type_keyword(driver, keyword, retry=True) except WebDriverException: raise Exception( - "Slow internet speed or Stuck at recaptcha! Can't perfrom search keyword") + "Slow internet speed or Stuck at recaptcha! Can't perform search keyword") msg = scroll_search(driver, video_title) if msg == 'failed': bypass_popup(driver) - filters = driver.find_element(By.CSS_SELECTOR, '#filter-menu a') + filters = driver.find_element(By.CSS_SELECTOR, '#filter-menu button') driver.execute_script('arguments[0].scrollIntoViewIfNeeded()', filters) sleep(randint(1, 3)) ensure_click(driver, filters) diff --git a/youtubeviewer/bypass.py b/youtubeviewer/bypass.py index f709d94..041f2f4 100644 --- a/youtubeviewer/bypass.py +++ b/youtubeviewer/bypass.py @@ -1,7 +1,7 @@ """ MIT License -Copyright (c) 2021-2022 MShawon +Copyright (c) 2021-2023 MShawon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/youtubeviewer/colors.py b/youtubeviewer/colors.py index 2cf3c46..6c0c597 100644 --- a/youtubeviewer/colors.py +++ b/youtubeviewer/colors.py @@ -1,7 +1,7 @@ """ MIT License -Copyright (c) 2021-2022 MShawon +Copyright (c) 2021-2023 MShawon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/youtubeviewer/config.py b/youtubeviewer/config.py index 126aeeb..40e7cf6 100644 --- a/youtubeviewer/config.py +++ b/youtubeviewer/config.py @@ -1,7 +1,7 @@ """ MIT License -Copyright (c) 2021-2022 MShawon +Copyright (c) 2021-2023 MShawon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/youtubeviewer/database.py b/youtubeviewer/database.py index 00fcd20..d5039e9 100644 --- a/youtubeviewer/database.py +++ b/youtubeviewer/database.py @@ -1,7 +1,7 @@ """ MIT License -Copyright (c) 2021-2022 MShawon +Copyright (c) 2021-2023 MShawon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/youtubeviewer/download_driver.py b/youtubeviewer/download_driver.py index 6da8323..230eba1 100644 --- a/youtubeviewer/download_driver.py +++ b/youtubeviewer/download_driver.py @@ -1,7 +1,7 @@ """ MIT License -Copyright (c) 2021-2022 MShawon +Copyright (c) 2021-2023 MShawon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/youtubeviewer/features.py b/youtubeviewer/features.py index 8ffa397..fcdd6d5 100644 --- a/youtubeviewer/features.py +++ b/youtubeviewer/features.py @@ -1,7 +1,7 @@ """ MIT License -Copyright (c) 2021-2022 MShawon +Copyright (c) 2021-2023 MShawon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -216,7 +216,7 @@ def play_from_channel(driver, actual_channel): driver.refresh() videos = WebDriverWait(driver, 10).until( - EC.presence_of_all_elements_located((By.XPATH, "//a[@id='video-title']"))) + EC.presence_of_all_elements_located((By.XPATH, "//a[@id='video-title-link']"))) video = choice(videos) driver.execute_script("arguments[0].scrollIntoViewIfNeeded();", video) sleep(randint(2, 5)) diff --git a/youtubeviewer/load_files.py b/youtubeviewer/load_files.py index c8b40f2..4e16da1 100644 --- a/youtubeviewer/load_files.py +++ b/youtubeviewer/load_files.py @@ -1,7 +1,7 @@ """ MIT License -Copyright (c) 2021-2022 MShawon +Copyright (c) 2021-2023 MShawon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/youtubeviewer/proxies.py b/youtubeviewer/proxies.py index d320125..9ac4a3a 100644 --- a/youtubeviewer/proxies.py +++ b/youtubeviewer/proxies.py @@ -1,7 +1,7 @@ """ MIT License -Copyright (c) 2021-2022 MShawon +Copyright (c) 2021-2023 MShawon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/youtubeviewer/website.py b/youtubeviewer/website.py index 0381bf9..715b41b 100644 --- a/youtubeviewer/website.py +++ b/youtubeviewer/website.py @@ -1,7 +1,7 @@ """ MIT License -Copyright (c) 2021-2022 MShawon +Copyright (c) 2021-2023 MShawon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal