{
"manifest_version": 2 ,
"name": "Adder",
"description": "Add video's URL to file for future download",
"version": "1.3.1",
"icons": { "128": "icons/square_youtube.png"},
"background": {
"scripts": ["background.js"],
"persistent": false
},
"permissions": [
"tabs",
"downloads",
"declarativeContent"
],
"page_action": {
"default_name": "Adder",
"default_icon": "icons/square_youtube.png",
"default_popup": "popup.html",
"default_title": "Add it!"
}
}
{
"manifest_version": 2 ,
"name": "Adder",
"description": "Add video's URL to file for future download",
"version": "1.3.1",
"icons": { "128": "icons/square_youtube.png"},
"background": {
"scripts": ["background.js"],
"persistent": false
},
"permissions": [
"tabs",
"downloads",
"declarativeContent"
],
"page_action": {
"default_name": "Adder",
"default_icon": "icons/square_youtube.png",
"default_popup": "popup.html",
"default_title": "Add it!"
}
}
// Update the declarative rules on install or upgrade.
chrome.runtime.onInstalled.addListener(function() {
chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {
chrome.declarativeContent.onPageChanged.addRules([{
conditions: [
// When a page contains a <video> tag...
new chrome.declarativeContent.PageStateMatcher({
css: ["video"]
})
],
// ... show the page action.
actions: [new chrome.declarativeContent.ShowPageAction() ]
}]);
});
});
// Update the declarative rules on install or upgrade.
chrome.runtime.onInstalled.addListener(function() {
chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {
chrome.declarativeContent.onPageChanged.addRules([{
conditions: [
// When a page contains a <video> tag...
new chrome.declarativeContent.PageStateMatcher({
css: ["video"]
})
],
// ... show the page action.
actions: [new chrome.declarativeContent.ShowPageAction() ]
}]);
});
});
var stripThis = "https://www.youtube.com/watch?v=";
chrome.tabs.query({active: true, lastFocusedWindow: true}, function(tabs) {
var currentUrl = tabs[0].url;
var smallUrl = currentUrl.substring(stripThis.length, currentUrl.length);
var pathDL = "URLs/"+smallUrl+".txt";
chrome.downloads.download({url: currentUrl, filename:pathDL}, function(downloadId) {});
});
var stripThis = "https://www.youtube.com/watch?v=";
chrome.tabs.query({active: true, lastFocusedWindow: true}, function(tabs) {
var currentUrl = tabs[0].url;
var smallUrl = currentUrl.substring(stripThis.length, currentUrl.length);
var pathDL = "URLs/"+smallUrl+".txt";
chrome.downloads.download({url: currentUrl, filename:pathDL}, function(downloadId) {});
});
#!/bin/bash
DownloadAndConvert() {
echo Avvio...
echo Importo URLs da files...
echo creo lista unificata...
cd /home/faceless/Dropbox/URLs/
count=`ls -1 *.txt 2>/dev/null | wc -l`
YTBSTR="https://www.youtube.com/watch?v="
if [ $count != 0 ]; then
touch mergedList
for filename in *.txt; do
echo $YTBSTR$(basename "$filename" .txt) >> mergedList
if [ $filename != mergedList ]; then
rm $filename
fi
done
download
cleanup
elif [ -e mergedList ]; then
echo La lista è già presente! - Procedo...
download
cleanup
else
echo Non ci sono video! - Esco
exit
fi
}
download() {
echo Inizio Scaricamento...
youtube-dl -x -a "mergedList" --no-playlist
}
cleanup() {
echo Pulisco lista...
rm mergedList
echo FINE
}
trap exit SIGINT
DownloadAndConvert
#!/bin/bash
DownloadAndConvert() {
echo Avvio...
echo Importo URLs da files...
echo creo lista unificata...
cd /home/faceless/Dropbox/URLs/
count=`ls -1 *.txt 2>/dev/null | wc -l`
YTBSTR="https://www.youtube.com/watch?v="
if [ $count != 0 ]; then
touch mergedList
for filename in *.txt; do
echo $YTBSTR$(basename "$filename" .txt) >> mergedList
if [ $filename != mergedList ]; then
rm $filename
fi
done
download
cleanup
elif [ -e mergedList ]; then
echo La lista è già presente! - Procedo...
download
cleanup
else
echo Non ci sono video! - Esco
exit
fi
}
download() {
echo Inizio Scaricamento...
youtube-dl -x -a "mergedList" --no-playlist
}
cleanup() {
echo Pulisco lista...
rm mergedList
echo FINE
}
trap exit SIGINT
DownloadAndConvert