-
جمعه, ۸ فروردين ۱۳۹۹، ۰۱:۲۷ ب.ظ
-
۴۴۶
پروژه ی ارسالی - دنلودر در پایتون
فرستنده : [+] DELLER [+]
نام پروژه : Blue Downloader
دسته بندی : python - پایتون
توضیحات : یک دانلودر کاربردی در پایتون . قابلیت ها : * جمع آوری لینک های دانلود از یک سایت * دانلود یک فایل از طریق لینک * دانلود چندین فایل از طریق لیست لینک .
سورس :
import requests
import os
import sys
import re
from datetime import datetime
import time
def links(link,dict_name,page_num,format):
clear=lambda :os.system("clear")
clear()
ad = 0
page = 1
len_link = []
while page <= int(page_num):
if page == 1:
url = link.format(page)
req = requests.get(url)
f = open("content.html", "w")
f.write(str(req.content))
f.close()
site = open("content.html")
site = site.read()
links = re.findall('([^"]+).{}'.format(format), site)
len_link.append(len(links))
clear = lambda: os.system("clear")
clear()
print("links===>" + str(len(links)))
print("page====>" + str(page))
page = page + 1
for i in links:
fm = open("{}.text".format(dict_name), "a")
fm.write(i + ".{}\n".format(format))
if page > 1:
url = link.format(page)
req = requests.get(url)
f = open("content.html", "w")
f.write(str(req.content))
f.close()
site = open("content.html")
site = site.read()
links = re.findall('([^"]+).{}'.format(format), site)
clear = lambda: os.system("clear")
clear()
linkz = len_link[ad] + len(links)
print("links===>" + str(linkz))
print("page num====>" + str(page))
len_link.append(linkz)
page = page + 1
ad = ad + 1
for i in links:
fm = open("{}.text".format(dict_name), "a")
fm.write(i + ".{}\n".format(format))
def blue_downloader(address,link,hour,minute):
clear()
os.system('mkdir {}/Downloader/'.format(address))
print("Your File Downloaded At {}:{}".format(hour, minute))
state = True
while state:
ctime = datetime.now()
if ctime.hour == int(hour) and ctime.minute == int(minute):
state = False
print("Start Downloading ...")
wget = lambda: os.system("wget -P \"{}/Downloader/\" \"{}\"".format(address, link))
print("---------------------------------Downloader-------------------------- ------------------")
wget()
print("----------------------------------------------------------------------------------------")
def red_downloader(dictionary,address,hour,minute,number_of_start,number_of_end):
clear = lambda: os.system("clear")
clear()
print("Your File Downloaded At {}:{}".format(hour, minute))
state = True
while state:
ctime = datetime.now()
if ctime.hour == int(hour) and ctime.minute == int(minute):
state = False
print("Start Downloading ...")
os.system('mkdir {}/Downloader/'.format(address))
g=1
mg=[]
dl=1
links = open(dictionary)
for link in links:
if g < int(number_of_start):
clear = lambda: os.system("clear")
clear()
g = g + 1
print(str(g))
if int(number_of_end) >= g >= int(number_of_start):
link = link.strip("\n")
link = "{}".format(link)
wget = lambda: os.system("wget -P \"{}/Downloader/\" \"{}\"".format(address, link))
print("---------------------------------Downloader-------------------------- ------------------")
wget()
print("----------------------------------------------------------------------------------------")
print("---------------------------------information--------------------------------------------")
os.system("du -h {}/Downloader/")
print("----------------------------------------------------------------------------------------")
g = g + 1
clear = lambda : os.system("clear")
clear()
from colorama import init,Fore
init()
print(Fore.BLUE + """ ____ _____ _ _ _____ ____
| _ \ | ____| | | | | | ____| | _ \
| | | | | _| | | | | | _| | |_) |
| |_| | | |___ | |___ | |___ | |___ | _ <
|____/ |_____| |_____| |_____| |_____| |_| \_\
""")
print("hi i'm downloader ")
input("press any key to go.")
clear()
ernum=11
while ernum ==11:
clear()
menu = input("1)Link collector" + "\n" + "2)Blue downloader" + "\n" + "3)Red downloader" + "\n" + "(1,2,3)")
clear()
if menu == "1":
link = input("Good good ! Now I need yor site address(My friend, you have to find the page word in the link and"
" change the number on it to {})" + "\n")
clear()
dict_name = input("Give me a name for your dictionary" + "\n")
clear()
page_num = input("Well! How many does your site have?" + "\n")
clear()
format = input("what is your file format? " + "\n")
links(link, dict_name, page_num, format)
print("Your dictionary is ready :)")
input()
clear
continu=input("do you want another things ?(y,n)")
continu.lower()
if continu=="y":
ernum=11
else:
ernum=2
if menu=="2":
link=input("Your link==>\n")
clear()
address=input("Where do you want save it?==>\n")
clear()
time_begin = input("when do you want to download?(2:30)")
hour = time_begin.split(":")[0]
minute = time_begin.split(":")[1]
time.sleep(5)
clear()
blue_downloader(address,link,hour,minute)
input("press any key to continue")
clear()
continu = input("do you want another things ?(y,n)")
continu.lower()
if continu == "y":
ernum = 11
else:
ernum = 2
if menu=="3":
dct_add=input("where is your dictionary?(/home/file.mp3)\n")
clear()
address=input("where do you want save it?(home/delsy/)\n")
clear()
number_of_start = input("number of start?\n")
clear()
number_of_end=input("number of end?\n")
clear()
time_begin = input("when do you want to download?(2:30)")
hour = time_begin.split(":")[0]
minute = time_begin.split(":")[1]
red_downloader(dct_add,address,hour,minute,number_of_start,number_of_end)
input("press any key to continue")
clear()
continu = input("do you want another things ?(y,n)")
continu.lower()
if continu == "y":
ernum = 11
else:
ernum = 2
print("good luck :)")
لینک دانلود همین سورس خروجی گرفته شده در لینوکس :
http://bayanbox.ir/info/8833338269694697542/ow
جهت ارسال پروژه های خود :
پروژه ی خود به همراه توضیح آن ر ارسال کنید به :
mrpythonblog@gmail.com
برچسب ها:
DELLER,
DELSY,
Mr Python,
deller,
delsy,
mrpython,
mrpython.blog.ir,
python,
مستر پایتون,
پایتون,