mirror of
https://github.com/l1ving/youtube-dl
synced 2025-01-28 01:02:57 +08:00
Added A Script that Adds Easier Downloading
Process of how script works: -Looks through Download.txt -Looks element up using Google Ajax Tool -Returns link to youtube-dl to be downloaded -Downloads all elements to links folder
This commit is contained in:
parent
88060cce10
commit
9bbe8dfbdf
3
Easy Link Downloader/Download.txt
Normal file
3
Easy Link Downloader/Download.txt
Normal file
@ -0,0 +1,3 @@
|
||||
1812 Overture by Tchiavosky
|
||||
Moonlight Sonata by Beethoven
|
||||
Cannon in D by Pachebel
|
121
Easy Link Downloader/EasyLinkDownloader.py
Normal file
121
Easy Link Downloader/EasyLinkDownloader.py
Normal file
@ -0,0 +1,121 @@
|
||||
from __future__ import unicode_literals
|
||||
from pip._vendor.distlib.compat import raw_input
|
||||
from urllib import request
|
||||
from unidecode import unidecode
|
||||
import time
|
||||
import os
|
||||
import youtube_dl
|
||||
import sys
|
||||
import json
|
||||
'''This receives a search parameter of type string
|
||||
Then, it escapes that string, example "Hey Jude" -> "Hey%20Jude"
|
||||
It makes a URL request to 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q='+search' a google API tool
|
||||
Then it takes the result from the query (A number of website google has found, takes the first link, and returns the link to be downloaded
|
||||
'''
|
||||
|
||||
class MyLogger(object):
|
||||
def debug(self, msg):
|
||||
pass
|
||||
|
||||
def warning(self, msg):
|
||||
pass
|
||||
|
||||
def error(self, msg):
|
||||
print(msg)
|
||||
|
||||
|
||||
def my_hook(d):
|
||||
if d['status'] == 'finished':
|
||||
print('Done downloading, now converting ...')
|
||||
|
||||
class NotYoutubeLinkError(Exception):
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
def __str__(self):
|
||||
return repr(self.value)
|
||||
|
||||
class NotValidSongError(Exception):
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
def __str__(self):
|
||||
return repr(self.value)
|
||||
|
||||
def getURL(search):
|
||||
final = None
|
||||
original = search
|
||||
search = unidecode(search)
|
||||
try:
|
||||
print("The item to be searched: ",search)
|
||||
search = search.replace(' ', '%20')
|
||||
print("Converted string: ", search)
|
||||
|
||||
rawdata = request.urlopen("http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q="+(search))
|
||||
result = json.loads(rawdata.readall().decode('utf-8'))
|
||||
searchResults = result['responseData']['results']
|
||||
|
||||
final = searchResults[0]['unescapedUrl']
|
||||
except Exception as e:
|
||||
if (search == "\n"):
|
||||
printEnd()
|
||||
else:
|
||||
print(e)
|
||||
print("You need to switch your VPN! Start next download with :", original)
|
||||
raw_input()
|
||||
getURL(search)
|
||||
|
||||
return final
|
||||
|
||||
def printEnd():
|
||||
print("All songs searched, check Faliure.txt and Success.txt for more info")
|
||||
print("Press enter to exit")
|
||||
raw_input()
|
||||
sys.exit()
|
||||
|
||||
|
||||
'''Begin Main'''
|
||||
|
||||
print("Press enter to search \"Download.txt\". PLEASE READ THE README FILE:")
|
||||
raw_input()
|
||||
print("Enter number to specify where you want to get your song from (Press enter if you don't care)")
|
||||
print("1. Youtube \n2. Soundcloud")
|
||||
x = raw_input()
|
||||
|
||||
#Opens text file, Download = source
|
||||
f1 = open("Download.txt", "r")
|
||||
songs = []
|
||||
|
||||
for i, line in enumerate(f1):
|
||||
line = line[:-1]
|
||||
songs.append(line)
|
||||
|
||||
f1.close()
|
||||
|
||||
currentDate = time.strftime("%Y-%m-%d - %H-%M-%S")
|
||||
for element in songs:
|
||||
#Options for Youtube_DL, read the documentation on github
|
||||
ydl_opts = {'outtmpl': os.getcwd()+'/links/'+element+'.%(ext)s',
|
||||
'format': 'bestaudio/best',
|
||||
'postprocessors': [{
|
||||
'key': 'FFmpegExtractAudio',
|
||||
'preferredcodec': 'mp3',
|
||||
'preferredquality': '192',
|
||||
}],
|
||||
}
|
||||
|
||||
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
|
||||
if (x == 1):
|
||||
element += " youtube"
|
||||
if (x == 2):
|
||||
element += " soundcloud"
|
||||
|
||||
url = getURL(element)
|
||||
print("URL: ",url,"\n")
|
||||
|
||||
try:
|
||||
if not 'youtube' in url:
|
||||
raise NotYoutubeLinkError("NotYoutubeLinkError: Not a youtube Link!")
|
||||
|
||||
ydl.download([url])
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
printEnd()
|
25
Easy Link Downloader/README.md
Normal file
25
Easy Link Downloader/README.md
Normal file
@ -0,0 +1,25 @@
|
||||
NOTE: If you don't know what you're doing READ THE DETAILED DESCRIPTION!
|
||||
|
||||
NOTE: Do not download copyrighted music with this opensource script!
|
||||
|
||||
Step 1: Find "Download.txt" inside "Music Downloader" folder -> Double Click
|
||||
|
||||
Step 2: Fill "Download.txt" with songs you like (scroll to bottom to see an example list)
|
||||
|
||||
Step 3: Double Click "EasyLinkDownloader.py"
|
||||
|
||||
Step 4: Hit enter when done, music will be in music folder
|
||||
|
||||
|
||||
Example List (included):
|
||||
1812 Overture by Tchiavosky
|
||||
Moonlight Sonata by Beethoven
|
||||
Cannon in D by Pachebel
|
||||
|
||||
Credit:
|
||||
|
||||
Team behind youtube-dl Amazing work!
|
||||
|
||||
Team behind Google Ajax
|
||||
|
||||
Team behind ffmpeg and ffprobe
|
5
Easy Link Downloader/desktop.ini
Normal file
5
Easy Link Downloader/desktop.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=This folder is shared online.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
BIN
Easy Link Downloader/ffmpeg.exe
Normal file
BIN
Easy Link Downloader/ffmpeg.exe
Normal file
Binary file not shown.
BIN
Easy Link Downloader/ffprobe.exe
Normal file
BIN
Easy Link Downloader/ffprobe.exe
Normal file
Binary file not shown.
BIN
Easy Link Downloader/links/1812 Overture by Tchiavosky.mp3
Normal file
BIN
Easy Link Downloader/links/1812 Overture by Tchiavosky.mp3
Normal file
Binary file not shown.
BIN
Easy Link Downloader/links/Cannon in D by Pachebe.mp3
Normal file
BIN
Easy Link Downloader/links/Cannon in D by Pachebe.mp3
Normal file
Binary file not shown.
BIN
Easy Link Downloader/links/Moonlight Sonata by Beethoven.mp3
Normal file
BIN
Easy Link Downloader/links/Moonlight Sonata by Beethoven.mp3
Normal file
Binary file not shown.
5
Easy Link Downloader/links/desktop.ini
Normal file
5
Easy Link Downloader/links/desktop.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=This folder is shared online.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
5
bin/desktop.ini
Normal file
5
bin/desktop.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=This folder is shared online.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
5
desktop.ini
Normal file
5
desktop.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=This folder is shared online.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
5
devscripts/desktop.ini
Normal file
5
devscripts/desktop.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=This folder is shared online.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
5
devscripts/gh-pages/desktop.ini
Normal file
5
devscripts/gh-pages/desktop.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=This folder is shared online.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
5
docs/desktop.ini
Normal file
5
docs/desktop.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=This folder is shared online.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
5
test/desktop.ini
Normal file
5
test/desktop.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=This folder is shared online.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
5
test/swftests/desktop.ini
Normal file
5
test/swftests/desktop.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=This folder is shared online.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
5
youtube_dl/desktop.ini
Normal file
5
youtube_dl/desktop.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=This folder is shared online.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
5
youtube_dl/downloader/desktop.ini
Normal file
5
youtube_dl/downloader/desktop.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=This folder is shared online.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
5
youtube_dl/extractor/desktop.ini
Normal file
5
youtube_dl/extractor/desktop.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=This folder is shared online.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
5
youtube_dl/postprocessor/desktop.ini
Normal file
5
youtube_dl/postprocessor/desktop.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=This folder is shared online.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
Loading…
Reference in New Issue
Block a user