from bs4 import BeautifulSoup
import requests, shutil, os, sys
def open_folder():
try:
os.mkdir("Media")
os.chdir("Media")
except:
os.chdir("Media")
URL_LOGIN_NEXTVOZ = "https://next.voz.vn/login/login/"
URL_CHECKED = "https://next.voz.vn/attachments/f40a65ae-7e6d-4b6d-a625-18b8e2c093d1-jpeg.1353/"
open_folder()
print("\-----/-----\Tools Create By Loozzi/-----\-----/")
print("Tools không lưu thông tin đăng nhập.\nBạn có muốn đăng nhập để tải tất cả ảnh full-size không?")
check_input = input("y/n: ")
if check_input == "y" or check_input=="Y":
try:
username = input("Username: ")
password = input("Password: ")
except:
print('Bạn nhập lỗi rồi')
payload = {
'login': username,
'password': password
}
with requests.session() as requests:
requests.post(URL_LOGIN_NEXTVOZ, data=payload)
res_check = requests.get(URL_CHECKED)
if res_check.status_code == 200:
check_login=True
print("Dang nhap thanh cong")
else:
check_login = False
print("Sai tai khoan hoac mat khau!")
while check_login==True:
print("CHAO MUNG CAC STRAMER DEN VOI TRAI NGHIEM BI CON GAI DI`")
print("======================================")
requests.post(URL_LOGIN_NEXTVOZ, data=payload)
def downloader(url, file_name):
try:
res_img = requests.get(url, stream=True)
with open(file_name, 'wb') as f:
res_img.raw.decode_content = True
shutil.copyfileobj(res_img.raw, f)
print("downloading...")
except:
print("Ảnh này bị lỗi!")
def get_img_page(url):
res = requests.get(url)
soup = BeautifulSoup(res.text, 'html.parser')
for img in soup.find_all('img'):
if img['src'].startswith("https"):
if img['src'].startswith("https://next.voz.vn/"):
downloader(img['src'], img.get('alt'))
else:
url_img_list = img['src'].split('/')
downloader(img['src'], url_img_list[-1])
def get_all_page(id, s_p, e_p):
for i in range(s_p, e_p + 1):
print("Page {0}....".format(i))
tuple_ingredient = ("https://next.voz.vn", "threads", str(id), "page-" + str(i))
full_url_page = "/".join(tuple_ingredient)
get_img_page(full_url_page)
print("Xong page {0}.....".format(i))
print("\-----/-----\CreateByLoozzi/-----\-----/")
try:
id_input = int(input("ID Bai viet: "))
page_start = int(input("Page Start: "))
page_end = int(input("Page End: "))
ID_NEXVOZ = id_input
PAGE_START = page_start
PAGE_END = page_end
except:
print("Ban nhap loi gi roi! Vui long thu lai!")
get_all_page(ID_NEXVOZ, PAGE_START, PAGE_END)
print("HOAN THANH NHIEM VU!")
print("+-+-+-+-+-+-+-+-+-+-+-+-+-")
check_continue = input("Nhập 't' hoặc 'T' để tiếp tục chương trình!\n")
if check_continue == "t" or check_continue == "T":
continue
else:
break
# TAI ANH KHONG CAN DANG NHAP
elif check_input == "n" or check_input == "N":
while True:
print("BAN VUA CHON KHONG DANG NHAP, 1 SO ANH KHONG CO FULLSIZE NEN KHONG THE TAI\nDOI LUC XAY RA 1 SO LOI KHONG THE CHAY TOOLS")
print("======================================")
with requests.session() as session:
def downloader(url, file_name):
try:
res_img = requests.get(url, stream=True)
with open(file_name, 'wb') as f:
res_img.raw.decode_content = True
shutil.copyfileobj(res_img.raw, f)
print("downloading...")
except:
print("Ảnh này bị lỗi!")
def get_img_page(url):
res = session.get(url)
soup = BeautifulSoup(res.text, 'html.parser')
for img in soup.find_all('img'):
if img['src'].startswith("https"):
if img['src'].startswith("https://next.voz.vn/"):
downloader(img['src'], img.get('alt'))
else:
url_img_list = img['src'].split('/')
downloader(img['src'], url_img_list[-1])
def get_all_page(id, s_p, e_p):
for i in range(s_p, e_p + 1):
print("Page {0}....".format(i))
tuple_ingredient = ("https://next.voz.vn", "threads", str(id), "page-" + str(i))
full_url_page = "/".join(tuple_ingredient)
get_img_page(full_url_page)
print("Xong page {0}.....".format(i))
print("\-----/-----\CreateByLoozzi/-----\-----/")
try:
id_input = int(input("ID Bai viet: "))
page_start = int(input("Page Start: "))
page_end = int(input("Page End: "))
ID_NEXVOZ = id_input
PAGE_START = page_start
PAGE_END = page_end
except:
print("Ban nhap loi gi roi! Vui long thu lai!")
get_all_page(ID_NEXVOZ, PAGE_START, PAGE_END)
print("HOAN THANH NHIEM VU!")
print("+-+-+-+-+-+-+-+-+-+-+-+-+-")
check_continue = input("Nhập 't' hoặc 'T' để tiếp tục chương trình!\n")
if check_continue == "t" or check_continue == "T":
continue
else:
break
else:
print("Bạn chọn sai rồi! Vui lòng thử lại!")