-
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
0 parents
commit af21b10
Showing
5 changed files
with
261 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,11 @@ | ||
example urls... | ||
|
||
|
||
url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ" | ||
user-agent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36" | ||
|
||
url: "https://www.youtube.com/watch?v=8ybW48rKBME" | ||
user-agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1664.3 Safari/537.36" | ||
|
||
url: "https://www.youtube.com/watch?v=oHg5SJYRHA0" | ||
user-agent: "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1500.55 Safari/537.36" |
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,11 @@ | ||
example urls... | ||
|
||
|
||
url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ" | ||
user-agent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36" | ||
|
||
url: "https://www.youtube.com/watch?v=8ybW48rKBME" | ||
user-agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1664.3 Safari/537.36" | ||
|
||
url: "https://www.youtube.com/watch?v=oHg5SJYRHA0" | ||
user-agent: "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1500.55 Safari/537.36" |
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,92 @@ | ||
import random, string | ||
import os, sys | ||
import requests as r | ||
import time as t | ||
from termcolor import colored as cl | ||
from fake_useragent import UserAgent | ||
from lxml.html import fromstring | ||
#import urllib.request | ||
#from bs4 import BeautifulSoup | ||
ua = UserAgent() | ||
|
||
def clear(): | ||
clear = input(cl('clear text files (yes or no): ', 'white')) | ||
if clear == 'yes': | ||
pick = input(cl('valid, notvalid, or both: ', 'white')) | ||
if pick == 'valid': | ||
file = open("YESvalid.txt", "w+") | ||
file.write("") | ||
file.close() | ||
elif pick == 'notvalid': | ||
file = open("NOTvalid.txt", "w+") | ||
file.write("") | ||
file.close() | ||
elif pick == 'both': | ||
file = open("YESvalid.txt", "w+") | ||
file.write("") | ||
file.close() | ||
file = open("NOTvalid.txt", "w+") | ||
file.write("") | ||
file.close() | ||
else: | ||
print('\033[H\033[J') | ||
print(cl('invalid choice', 'red')) | ||
t.sleep(3) | ||
os.system('python3 main.py') | ||
elif clear == 'no': | ||
print('files wont be cleared') | ||
else: | ||
print('\033[H\033[J') | ||
print(cl('invalid choice', 'red')) | ||
t.sleep(3) | ||
print('\033[H\033[J') | ||
os.system('python3 main.py') | ||
|
||
print(cl('tubegen v1.0', 'green')) | ||
choice = input(cl('fast or slow: ', 'white')) | ||
if choice == "fast": | ||
speed = 0.2 | ||
clear() | ||
elif choice == "slow": | ||
speed = 0.6 | ||
clear() | ||
else: | ||
print(cl('invalid choice', 'red')) | ||
t.sleep(3) | ||
print('\033[H\033[J') | ||
os.system('python3 main.py') | ||
|
||
|
||
while True: | ||
def get_random_string(length): | ||
random_list = [] | ||
for i in range(length): | ||
random_list.append(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits + '-' + '_')) | ||
return ''.join(random_list) | ||
url = "https://www.youtube.com/watch?v=" + get_random_string(11) | ||
a = ua.random | ||
headers = { | ||
'User-Agent': a | ||
} | ||
res = r.get(url, headers=headers) | ||
if res.status_code == 429: | ||
print('\033[H\033[J') | ||
sys.exit('error 429 - too many requests ):\n') | ||
else: | ||
#soup = BeautifulSoup(urllib.request.urlopen(url, headers=headers), features="html5lib") | ||
tree = fromstring(res.content) | ||
title = tree.findtext('.//title') | ||
if title == " - YouTube" or "YouTube": | ||
valid = "no (" + title + ")" | ||
color = "red" | ||
file = open("NOTvalid.txt", "a+") | ||
file.write('url: "' + url + '"\nuser-agent: "' + a + '"\n\n') | ||
file.close() | ||
elif title != " - YouTube": | ||
valid = "yes (" + title + ")" | ||
color = "green" | ||
file = open("YESvalid.txt", "a+") | ||
file.write('url: "' + url + '"\nuser-agent: "' + a + '"\n\n') | ||
file.close() | ||
print('youtube url: ' + url + '\nis valid: ' + cl(valid, color) + '\n') | ||
t.sleep(speed) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,18 @@ | ||
[tool.poetry] | ||
name = "youtubegen" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["Your Name <[email protected]>"] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.8" | ||
termcolor = "^1.1.0" | ||
bs4 = "^0.0.1" | ||
fake-useragent = "^0.1.11" | ||
lxml = "^4.6.2" | ||
|
||
[tool.poetry.dev-dependencies] | ||
|
||
[build-system] | ||
requires = ["poetry>=0.12"] | ||
build-backend = "poetry.masonry.api" |