Skip to content

Commit 421dc04

Browse files
committed
resolves issue #298 , #299 , #319 , #322 , #335 , #336 , #337 , #358, discount code, graceful ctrl+c
1 parent 7cff31d commit 421dc04

File tree

22 files changed

+1560
-833
lines changed

22 files changed

+1560
-833
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Issue/Feature request
2+
description: Submit your issue/feature request here
3+
body:
4+
- type: checkboxes
5+
attributes:
6+
label: Is there an existing issue for this?
7+
description: Please search to see if an issue already exists for the bug you encountered.
8+
options:
9+
- label: I have searched the existing issues
10+
required: true
11+
- type: checkboxes
12+
attributes:
13+
label: I'm submitting a ...
14+
options:
15+
- label: bug report
16+
- label: feature request
17+
- label: support request --> Contact me over mail for support https://github.com/MShawon
18+
- type: textarea
19+
attributes:
20+
label: Description
21+
description: |
22+
A concise description of what you're experiencing and what you expected to happen.
23+
If applicable, include terminal logs or screenshots!
24+
validations:
25+
required: true
26+
- type: textarea
27+
attributes:
28+
label: Environment
29+
description: |
30+
examples:
31+
- **OS** : Ubuntu 20.04
32+
- **Python** : 3.9.10 / EXE without Python
33+
- **Script version** : 1.7.1
34+
value: |
35+
- OS :
36+
- Python :
37+
- Script version :
38+
render: markdown
39+
validations:
40+
required: true
41+
- type: textarea
42+
attributes:
43+
label: config.json
44+
description: If applicable, attach your config.json to resolve the issue
45+
placeholder: Before posting, make sure to remove information like proxy username and password or private API
46+
render: markdown
47+
validations:
48+
required: true

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 MShawon
3+
Copyright (c) 2021-2022 MShawon
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ Simple program to increase YouTube views written in Python. Works with live stre
4747
[Urls](https://github.com/MShawon/YouTube-Viewer#urls)
4848
[Search](https://github.com/MShawon/YouTube-Viewer#search)
4949
[Live Stream](https://github.com/MShawon/YouTube-Viewer#live-stream)
50-
[YouTube Music](https://github.com/MShawon/YouTube-Viewer#youtube-music)
51-
[Fast VPS](https://github.com/MShawon/YouTube-Viewer#fast-vps-with-unlimited-traffic)
50+
[YouTube Music](https://github.com/MShawon/YouTube-Viewer#youtube-music)
51+
[Fast VPS](https://github.com/MShawon/YouTube-Viewer#fast-vps-with-unlimited-traffic)
5252
[Windows](https://github.com/MShawon/YouTube-Viewer#windows)
5353
  [Binary Release](https://github.com/MShawon/YouTube-Viewer#binary-release)
5454
  [Installation](https://github.com/MShawon/YouTube-Viewer#installation)
@@ -68,12 +68,6 @@ Simple program to increase YouTube views written in Python. Works with live stre
6868
* Good proxy list (http, https, socks4, socks5)
6969
* Google Chrome installed on your OS (not Chromium)
7070

71-
# New Update
72-
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.
73-
74-
If you are not using the release version, don't forget to update the dependency by
75-
`pip install -r requirements.txt`
76-
7771

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

102+
# How to get started
103+
1) First, install the script following any one of these
104+
* [Windows without installing python](https://github.com/MShawon/YouTube-Viewer#binary-release)
105+
* [Windows from source code](https://github.com/MShawon/YouTube-Viewer#installation)
106+
* [Linux / Mac from source code](https://github.com/MShawon/YouTube-Viewer#linux--mac)
107+
2) Then put your video links in the [urls.txt](https://github.com/MShawon/YouTube-Viewer#urls) file
108+
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
109+
4) Get your [proxy](https://github.com/MShawon/YouTube-Viewer#proxies) list
110+
5) Run the script and follow the instructions from there.
106111

107112

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

130135
# HTTP API
131136
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.
132-
Last 20 logs from scripts are fetched every 10 seconds to show on website and graph is updated every 5 minutes.
137+
Last 200 logs from scripts are fetched every 10 seconds to show on website and graph is updated every 5 minutes.
133138

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

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

159165
# Fast VPS with Unlimited Traffic
160-
*[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.*
166+
*[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*
161167

162168
# Windows
163169
* ## Binary Release
@@ -186,7 +192,7 @@ Simple program to increase YouTube views written in Python. Works with live stre
186192
```
187193

188194
* ## Important
189-
* 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**
195+
* 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**
190196
```
191197
python proxy_check.py
192198
```
@@ -225,7 +231,7 @@ Simple program to increase YouTube views written in Python. Works with live stre
225231
```
226232
227233
* ## Important
228-
* 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**
234+
* 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**
229235
```
230236
python3 proxy_check.py
231237
```
@@ -251,8 +257,5 @@ Simple program to increase YouTube views written in Python. Works with live stre
251257
* 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.
252258
253259
254-
# Issues
255-
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.
256-
257260
# Credits
258261
I want to thank all of you who have opened an issue or shared your code snippets or ideas with me!

extension/always_active.zip

-5.06 KB
Binary file not shown.

proxy_check.py

Lines changed: 81 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
MIT License
33
4-
Copyright (c) 2022 MShawon
4+
Copyright (c) 2021-2022 MShawon
55
66
Permission is hereby granted, free of charge, to any person obtaining a copy
77
of this software and associated documentation files (the "Software"), to deal
@@ -21,12 +21,12 @@
2121
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
SOFTWARE.
2323
"""
24-
import concurrent.futures.thread
2524
import os
2625
import shutil
2726
import sys
28-
from concurrent.futures import ThreadPoolExecutor, as_completed
27+
from concurrent.futures import ThreadPoolExecutor, wait
2928
from glob import glob
29+
from time import sleep
3030

3131
import requests
3232
from fake_headers import Headers
@@ -64,25 +64,25 @@ class bcolors:
6464
""" + bcolors.ENDC)
6565

6666

67-
try:
68-
os.remove('ProxyBackup.txt')
69-
except:
70-
pass
67+
checked = {}
68+
cancel_all = False
7169

72-
try:
73-
shutil.copy('GoodProxy.txt', 'ProxyBackup.txt')
74-
print(bcolors.WARNING + 'GoodProxy.txt backed up in ProxyBackup.txt' + bcolors.ENDC)
75-
os.remove('GoodProxy.txt')
76-
except:
77-
pass
7870

79-
checked = {}
71+
def backup():
72+
try:
73+
shutil.copy('GoodProxy.txt', 'ProxyBackup.txt')
74+
print(bcolors.WARNING +
75+
'GoodProxy.txt backed up in ProxyBackup.txt' + bcolors.ENDC)
76+
except Exception:
77+
pass
78+
79+
print('', file=open('GoodProxy.txt', 'w'))
8080

8181

8282
def clean_exe_temp(folder):
8383
try:
8484
temp_name = sys._MEIPASS.split('\\')[-1]
85-
except:
85+
except Exception:
8686
temp_name = None
8787

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

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

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

113118

114119
def main_checker(proxy_type, proxy, position):
120+
if cancel_all:
121+
raise KeyboardInterrupt
115122

116123
checked[position] = None
117124

118-
proxyDict = {
119-
"http": f"{proxy_type}://{proxy}",
120-
"https": f"{proxy_type}://{proxy}",
121-
}
122-
123125
try:
126+
proxy_dict = {
127+
"http": f"{proxy_type}://{proxy}",
128+
"https": f"{proxy_type}://{proxy}",
129+
}
124130

125131
header = Headers(
126132
headers=False
@@ -132,64 +138,88 @@ def main_checker(proxy_type, proxy, position):
132138
}
133139

134140
response = requests.get(
135-
'https://www.youtube.com/', headers=headers, proxies=proxyDict, timeout=30)
141+
'https://www.youtube.com/', headers=headers, proxies=proxy_dict, timeout=30)
136142
status = response.status_code
137143

138144
if status != 200:
139-
raise Exception
145+
raise Exception(status)
140146

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

144-
print(proxy, file=open('GoodProxy.txt', 'a'))
150+
print(f'{proxy}|{proxy_type}', file=open('GoodProxy.txt', 'a'))
145151

146-
except:
147-
print(bcolors.OKBLUE + f"Tried {position+1} |" + bcolors.FAIL +
148-
f' {proxy} | {proxy_type} | BAD ' + bcolors.ENDC)
152+
except Exception as e:
153+
try:
154+
e = int(e.args[0])
155+
except Exception:
156+
e = ''
157+
print(bcolors.OKBLUE + f"Worker {position+1} | " + bcolors.FAIL +
158+
f'{proxy} | {proxy_type} | BAD | {e}' + bcolors.ENDC)
149159
checked[position] = proxy_type
150-
pass
151160

152161

153162
def proxy_check(position):
154-
163+
sleep(2)
155164
proxy = proxy_list[position]
156165

157-
main_checker('http', proxy, position)
158-
if checked[position] == 'http':
159-
main_checker('socks4', proxy, position)
160-
if checked[position] == 'socks4':
161-
main_checker('socks5', proxy, position)
166+
if '|' in proxy:
167+
splitted = proxy.split('|')
168+
main_checker(splitted[-1], splitted[0], position)
169+
else:
170+
main_checker('http', proxy, position)
171+
if checked[position] == 'http':
172+
main_checker('socks4', proxy, position)
173+
if checked[position] == 'socks4':
174+
main_checker('socks5', proxy, position)
162175

163176

164177
def main():
178+
global cancel_all
179+
180+
cancel_all = False
165181
pool_number = [i for i in range(total_proxies)]
166182

167183
with ThreadPoolExecutor(max_workers=threads) as executor:
168184
futures = [executor.submit(proxy_check, position)
169185
for position in pool_number]
170-
186+
done, not_done = wait(futures, timeout=0)
171187
try:
172-
for future in as_completed(futures):
173-
future.result()
188+
while not_done:
189+
freshly_done, not_done = wait(not_done, timeout=5)
190+
done |= freshly_done
174191
except KeyboardInterrupt:
175-
executor._threads.clear()
176-
concurrent.futures.thread._threads_queues.clear()
192+
print(bcolors.WARNING +
193+
'Hold on!!! Allow me a moment to finish the running threads' + bcolors.ENDC)
194+
cancel_all = True
195+
for future in not_done:
196+
_ = future.cancel()
197+
_ = wait(not_done, timeout=None)
198+
raise KeyboardInterrupt
177199
except IndexError:
178-
print(bcolors.WARNING + 'Number of proxies are less than threads. Provide more proxies or less threads.' + bcolors.ENDC)
179-
pass
200+
print(bcolors.WARNING + 'Number of proxies are less than threads. Provide more proxies or less threads. ' + bcolors.ENDC)
180201

181202

182203
if __name__ == '__main__':
183-
204+
184205
clean_exe_temp(folder='proxy_check')
185-
threads = int(
186-
input(bcolors.OKBLUE+'Threads (recommended = 100): ' + bcolors.ENDC))
206+
backup()
207+
208+
try:
209+
threads = int(
210+
input(bcolors.OKBLUE+'Threads (recommended = 100): ' + bcolors.ENDC))
211+
except Exception:
212+
threads = 100
187213

188214
proxy_list = load_proxy()
189-
proxy_list = list(set(proxy_list)) # removing duplicate proxies
190-
proxy_list = list(filter(None, proxy_list)) # removing empty proxies
215+
# removing empty & duplicate proxies
216+
proxy_list = list(set(filter(None, proxy_list)))
191217

192218
total_proxies = len(proxy_list)
193-
print(bcolors.OKCYAN + f'Total proxies : {total_proxies}' + bcolors.ENDC)
219+
print(bcolors.OKCYAN +
220+
f'Total unique proxies : {total_proxies}' + bcolors.ENDC)
194221

195-
main()
222+
try:
223+
main()
224+
except KeyboardInterrupt:
225+
sys.exit()

requirements.txt

226 Bytes
Binary file not shown.

search.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
keyword :::: exact video title
1+
keyword 1 :::: exact video title 1
2+
keyword 2 :::: exact video title 2
3+
keyword 3 :::: exact video title 2
4+
keyword 4 :::: exact video title 3

0 commit comments

Comments
 (0)