Skip to content

Commit

Permalink
resolves issue #298 , #299 , #319 , #322 , #335 , #336 , #337 , #358,…
Browse files Browse the repository at this point in the history
… discount code, graceful ctrl+c
  • Loading branch information
MShawon committed May 1, 2022
1 parent 7cff31d commit 421dc04
Show file tree
Hide file tree
Showing 22 changed files with 1,560 additions and 833 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
48 changes: 48 additions & 0 deletions .github/ISSUE_TEMPLATE/issue_form.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Issue/Feature request
description: Submit your issue/feature request here
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: checkboxes
attributes:
label: I'm submitting a ...
options:
- label: bug report
- label: feature request
- label: support request --> Contact me over mail for support https://github.com/MShawon
- type: textarea
attributes:
label: Description
description: |
A concise description of what you're experiencing and what you expected to happen.
If applicable, include terminal logs or screenshots!
validations:
required: true
- type: textarea
attributes:
label: Environment
description: |
examples:
- **OS** : Ubuntu 20.04
- **Python** : 3.9.10 / EXE without Python
- **Script version** : 1.7.1
value: |
- OS :
- Python :
- Script version :
render: markdown
validations:
required: true
- type: textarea
attributes:
label: config.json
description: If applicable, attach your config.json to resolve the issue
placeholder: Before posting, make sure to remove information like proxy username and password or private API
render: markdown
validations:
required: true
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 MShawon
Copyright (c) 2021-2022 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
Expand Down
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ Simple program to increase YouTube views written in Python. Works with live stre
[Urls](https://github.com/MShawon/YouTube-Viewer#urls)
[Search](https://github.com/MShawon/YouTube-Viewer#search)
[Live Stream](https://github.com/MShawon/YouTube-Viewer#live-stream)
[YouTube Music](https://github.com/MShawon/YouTube-Viewer#youtube-music)
[Fast VPS](https://github.com/MShawon/YouTube-Viewer#fast-vps-with-unlimited-traffic)
[YouTube Music](https://github.com/MShawon/YouTube-Viewer#youtube-music)
[Fast VPS](https://github.com/MShawon/YouTube-Viewer#fast-vps-with-unlimited-traffic)
[Windows](https://github.com/MShawon/YouTube-Viewer#windows)
  [Binary Release](https://github.com/MShawon/YouTube-Viewer#binary-release)
  [Installation](https://github.com/MShawon/YouTube-Viewer#installation)
Expand All @@ -68,12 +68,6 @@ Simple program to increase YouTube views written in Python. Works with live stre
* Good proxy list (http, https, socks4, socks5)
* Google Chrome installed on your OS (not Chromium)

# New Update
Update from v1.7.0 include a feature to get views as suggested videos which can decrease the view drops issue. To get the must out of it, one must run the bot on multiple videos. However this is still an experimental feature. If you face any major issue, roll back to previous version.

If you are not using the release version, don't forget to update the dependency by
`pip install -r requirements.txt`


# Features
* YouTube default, live streaming and YouTube Music support
Expand All @@ -86,12 +80,12 @@ Simple program to increase YouTube views written in Python. Works with live stre
* format : `ip:port`, `user:pass@ip:port`, `ip:port:user:pass`
* proxy refresh after a certain time specified by the user
* rotating proxy support
* chrome v70+ randomized user agent based on platform
* chrome v80+ randomized user agent based on platform
* canvas,audio,font,webgl fingerprint defender and IP leak prevent by webrtc control
* geolocation, timezone, referer spoofing
* can add extra extensions in the `extension/custom_extension/` folder
* direct link or search *keyword* on YouTube then watch the video by matching exact video *title*
* modify urls.txt and search.txt on the fly without restarting program
* modify **urls.txt, search.txt and config.json** on the fly without restarting program
* HTTP api on localhost and a database to store view count
* config.json to save settings
* bypass consent page and several other pop up
Expand All @@ -101,8 +95,19 @@ Simple program to increase YouTube views written in Python. Works with live stre
* YouTube Search
* Suggested Videos
* External (Google, Yahoo, DuckDuckGo, Bing, Twitter)
* End Screens
* Channel Pages
* Direct or unknown

# How to get started
1) First, install the script following any one of these
* [Windows without installing python](https://github.com/MShawon/YouTube-Viewer#binary-release)
* [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
4) Get your [proxy](https://github.com/MShawon/YouTube-Viewer#proxies) list
5) Run the script and follow the instructions from there.


# Proxies
Expand All @@ -129,10 +134,11 @@ Simple program to increase YouTube views written in Python. Works with live stre

# HTTP API
Live logs fetched every 10 seconds and statistics in graphs are available on http://localhost:5000/ .Or [http://ip_of_your_pc:5000/](http://ip_of_your_pc:5000/) use this to access from another device under same network. A SQLite Database is being used to store your generated views from this script.
Last 20 logs from scripts are fetched every 10 seconds to show on website and graph is updated every 5 minutes.
Last 200 logs from scripts are fetched every 10 seconds to show on website and graph is updated every 5 minutes.

# Config.json
No need to type everything everytime you run the script. A config file will be created automatically to save and use your preferences.
You can modify it on the fly without restarting the program.

# Urls
Put video links in the urls.txt. For multiple videos place urls in multple lines.
Expand All @@ -157,7 +163,7 @@ Simple program to increase YouTube views written in Python. Works with live stre
For YouTube Music use version 1.6.2 or earlier until the bug is fixed in the latest releases.

# Fast VPS with Unlimited Traffic
*[PetroSky](https://petrosky.io/mshawon) is one of the various CloudHosting services with the fastest and most convenient cloud technology. Their servers are powered by the latest **AMD RYZEN/EPYC CPUs** with High-Performance **NVMe SSD Hard Drives** that will let your application run faster than ever. You can get 2 vCPU with 4 GB ECC RAM for as low as 11.99€/month which will work very well for YouTube-Viewer script for 2 threads. Visit [PetroSky](https://petrosky.io/mshawon) to get the fastest VPS with unlimited traffic at the lowest price.*
*[PetroSky](https://petrosky.io/mshawon) is one of the various CloudHosting services with the fastest and most convenient cloud technology. Their servers are powered by the latest **AMD RYZEN/EPYC CPUs** with High-Performance **NVMe SSD Hard Drives** that will let your application run faster than ever. You can get 2 vCPU with 4 GB ECC RAM for as low as 11.99€/month which will work very well for YouTube-Viewer script for 2 threads. Visit [PetroSky](https://petrosky.io/mshawon) to get the fastest VPS with unlimited traffic at the lowest price. Use this code `mshawon25` to get **25% discount** on your purchase*

# Windows
* ## Binary Release
Expand Down Expand Up @@ -186,7 +192,7 @@ Simple program to increase YouTube views written in Python. Works with live stre
```

* ## Important
* If you've got a large proxy collection, you should run this command to filter Good proxies. Then use **GoodProxy.txt** for proxy in **youtube_viewer.py**
* If you've got a large free proxies collection, you should run this command to filter Good proxies. Then use **GoodProxy.txt** for proxy in **youtube_viewer.py**
```
python proxy_check.py
```
Expand Down Expand Up @@ -225,7 +231,7 @@ Simple program to increase YouTube views written in Python. Works with live stre
```
* ## Important
* If you've got a large proxy collection, you should run this command to filter Good proxies. Then use **GoodProxy.txt** for proxy in **youtube_viewer.py**
* If you've got a large free proxies collection, you should run this command to filter Good proxies. Then use **GoodProxy.txt** for proxy in **youtube_viewer.py**
```
python3 proxy_check.py
```
Expand All @@ -251,8 +257,5 @@ Simple program to increase YouTube views written in Python. Works with live stre
* 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.
# Issues
Before opening an issue, please read this page thoroughly. Maybe someone already faced the same problem you have right now. So it's always a good idea to check the answer to issues first. If your problem isn't there, feel free to open an issue. Also, don't forget to give as many details as you can. config.json and a screenshot of terminal output provide a handful of information to resolve your problem.
# Credits
I want to thank all of you who have opened an issue or shared your code snippets or ideas with me!
Binary file modified extension/always_active.zip
Binary file not shown.
132 changes: 81 additions & 51 deletions proxy_check.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
MIT License
Copyright (c) 2022 MShawon
Copyright (c) 2021-2022 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
Expand All @@ -21,12 +21,12 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
import concurrent.futures.thread
import os
import shutil
import sys
from concurrent.futures import ThreadPoolExecutor, as_completed
from concurrent.futures import ThreadPoolExecutor, wait
from glob import glob
from time import sleep

import requests
from fake_headers import Headers
Expand Down Expand Up @@ -64,25 +64,25 @@ class bcolors:
""" + bcolors.ENDC)


try:
os.remove('ProxyBackup.txt')
except:
pass
checked = {}
cancel_all = False

try:
shutil.copy('GoodProxy.txt', 'ProxyBackup.txt')
print(bcolors.WARNING + 'GoodProxy.txt backed up in ProxyBackup.txt' + bcolors.ENDC)
os.remove('GoodProxy.txt')
except:
pass

checked = {}
def backup():
try:
shutil.copy('GoodProxy.txt', 'ProxyBackup.txt')
print(bcolors.WARNING +
'GoodProxy.txt backed up in ProxyBackup.txt' + bcolors.ENDC)
except Exception:
pass

print('', file=open('GoodProxy.txt', 'w'))


def clean_exe_temp(folder):
try:
temp_name = sys._MEIPASS.split('\\')[-1]
except:
except Exception:
temp_name = None

for f in glob(os.path.join('temp', folder, '*')):
Expand All @@ -99,8 +99,13 @@ def load_proxy():
if not os.path.isfile(filename) and filename[-4:] != '.txt':
filename = f'{filename}.txt'

with open(filename, encoding="utf-8") as fh:
loaded = [x.strip() for x in fh if x.strip() != '']
try:
with open(filename, encoding="utf-8") as fh:
loaded = [x.strip() for x in fh if x.strip() != '']
except Exception as e:
print(bcolors.FAIL + str(e) + bcolors.ENDC)
input('')
sys.exit()

for lines in loaded:
if lines.count(':') == 3:
Expand All @@ -112,15 +117,16 @@ def load_proxy():


def main_checker(proxy_type, proxy, position):
if cancel_all:
raise KeyboardInterrupt

checked[position] = None

proxyDict = {
"http": f"{proxy_type}://{proxy}",
"https": f"{proxy_type}://{proxy}",
}

try:
proxy_dict = {
"http": f"{proxy_type}://{proxy}",
"https": f"{proxy_type}://{proxy}",
}

header = Headers(
headers=False
Expand All @@ -132,64 +138,88 @@ def main_checker(proxy_type, proxy, position):
}

response = requests.get(
'https://www.youtube.com/', headers=headers, proxies=proxyDict, timeout=30)
'https://www.youtube.com/', headers=headers, proxies=proxy_dict, timeout=30)
status = response.status_code

if status != 200:
raise Exception
raise Exception(status)

print(bcolors.OKBLUE + f"Tried {position+1} |" + bcolors.OKGREEN +
f' {proxy} | GOOD | Type : {proxy_type} | Response : {status}' + bcolors.ENDC)
print(bcolors.OKBLUE + f"Worker {position+1} | " + bcolors.OKGREEN +
f'{proxy} | GOOD | Type : {proxy_type} | Response : {status}' + bcolors.ENDC)

print(proxy, file=open('GoodProxy.txt', 'a'))
print(f'{proxy}|{proxy_type}', file=open('GoodProxy.txt', 'a'))

except:
print(bcolors.OKBLUE + f"Tried {position+1} |" + bcolors.FAIL +
f' {proxy} | {proxy_type} | BAD ' + bcolors.ENDC)
except Exception as e:
try:
e = int(e.args[0])
except Exception:
e = ''
print(bcolors.OKBLUE + f"Worker {position+1} | " + bcolors.FAIL +
f'{proxy} | {proxy_type} | BAD | {e}' + bcolors.ENDC)
checked[position] = proxy_type
pass


def proxy_check(position):

sleep(2)
proxy = proxy_list[position]

main_checker('http', proxy, position)
if checked[position] == 'http':
main_checker('socks4', proxy, position)
if checked[position] == 'socks4':
main_checker('socks5', proxy, position)
if '|' in proxy:
splitted = proxy.split('|')
main_checker(splitted[-1], splitted[0], position)
else:
main_checker('http', proxy, position)
if checked[position] == 'http':
main_checker('socks4', proxy, position)
if checked[position] == 'socks4':
main_checker('socks5', proxy, position)


def main():
global cancel_all

cancel_all = False
pool_number = [i for i in range(total_proxies)]

with ThreadPoolExecutor(max_workers=threads) as executor:
futures = [executor.submit(proxy_check, position)
for position in pool_number]

done, not_done = wait(futures, timeout=0)
try:
for future in as_completed(futures):
future.result()
while not_done:
freshly_done, not_done = wait(not_done, timeout=5)
done |= freshly_done
except KeyboardInterrupt:
executor._threads.clear()
concurrent.futures.thread._threads_queues.clear()
print(bcolors.WARNING +
'Hold on!!! Allow me a moment to finish the running threads' + bcolors.ENDC)
cancel_all = True
for future in not_done:
_ = future.cancel()
_ = wait(not_done, timeout=None)
raise KeyboardInterrupt
except IndexError:
print(bcolors.WARNING + 'Number of proxies are less than threads. Provide more proxies or less threads.' + bcolors.ENDC)
pass
print(bcolors.WARNING + 'Number of proxies are less than threads. Provide more proxies or less threads. ' + bcolors.ENDC)


if __name__ == '__main__':

clean_exe_temp(folder='proxy_check')
threads = int(
input(bcolors.OKBLUE+'Threads (recommended = 100): ' + bcolors.ENDC))
backup()

try:
threads = int(
input(bcolors.OKBLUE+'Threads (recommended = 100): ' + bcolors.ENDC))
except Exception:
threads = 100

proxy_list = load_proxy()
proxy_list = list(set(proxy_list)) # removing duplicate proxies
proxy_list = list(filter(None, proxy_list)) # removing empty proxies
# removing empty & duplicate proxies
proxy_list = list(set(filter(None, proxy_list)))

total_proxies = len(proxy_list)
print(bcolors.OKCYAN + f'Total proxies : {total_proxies}' + bcolors.ENDC)
print(bcolors.OKCYAN +
f'Total unique proxies : {total_proxies}' + bcolors.ENDC)

main()
try:
main()
except KeyboardInterrupt:
sys.exit()
Binary file modified requirements.txt
Binary file not shown.
5 changes: 4 additions & 1 deletion search.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
keyword :::: exact video title
keyword 1 :::: exact video title 1
keyword 2 :::: exact video title 2
keyword 3 :::: exact video title 2
keyword 4 :::: exact video title 3
Loading

0 comments on commit 421dc04

Please sign in to comment.