Commit 27225814 authored by sebaro's avatar sebaro

Fix YouTube

parent c63ea0ab
......@@ -3,6 +3,10 @@
/* SaveTube Changelog */
#2020.01.24
- Script: style/design fixes
- YouTube: fixed for new signature
#2020.01.03
- Script: style/design fixes
- IMDb: fixed for new design
......
{
"manifest_version": 2,
"name": "SaveTube",
"version": "2019.9.21",
"manifest_version": 2,
"name": "SaveTube",
"version": "2020.1.24",
"description": "Download videos from video sharing web sites.",
"description": "Download videos from video sharing web sites.",
"icons": {
"16": "icons/16.png",
"32": "icons/32.png",
"48": "icons/48.png",
"64": "icons/64.png",
"96": "icons/96.png",
"128": "icons/128.png"
},
"icons": {
"16": "icons/16.png",
"32": "icons/32.png",
"48": "icons/48.png",
"64": "icons/64.png",
"96": "icons/96.png",
"128": "icons/128.png"
},
"content_scripts": [
{
"matches": [
"http://youtube.com/*",
"http://www.youtube.com/*",
"https://youtube.com/*",
"https://www.youtube.com/*",
"http://gaming.youtube.com/*",
"https://gaming.youtube.com/*",
"http://m.youtube.com/*",
"https://m.youtube.com/*",
"http://dailymotion.com/*",
"http://www.dailymotion.com/*",
"https://dailymotion.com/*",
"https://www.dailymotion.com/*",
"http://vimeo.com/*",
"http://www.vimeo.com/*",
"https://vimeo.com/*",
"https://www.vimeo.com/*",
"http://metacafe.com/*",
"http://www.metacafe.com/*",
"https://metacafe.com/*",
"https://www.metacafe.com/*",
"http://veoh.com/*",
"http://www.veoh.com/*",
"https://veoh.com/*",
"https://www.veoh.com/*",
"http://viki.com/*",
"http://www.viki.com/*",
"https://viki.com/*",
"https://www.viki.com/*",
"http://imdb.com/*",
"http://www.imdb.com/*",
"https://imdb.com/*",
"https://www.imdb.com/*"
],
"js": ["savetube.user.js"],
"run_at": "document_end"
}
],
"content_scripts": [
{
"matches": [
"http://youtube.com/*",
"http://www.youtube.com/*",
"https://youtube.com/*",
"https://www.youtube.com/*",
"http://gaming.youtube.com/*",
"https://gaming.youtube.com/*",
"http://m.youtube.com/*",
"https://m.youtube.com/*",
"http://dailymotion.com/*",
"http://www.dailymotion.com/*",
"https://dailymotion.com/*",
"https://www.dailymotion.com/*",
"http://vimeo.com/*",
"http://www.vimeo.com/*",
"https://vimeo.com/*",
"https://www.vimeo.com/*",
"http://metacafe.com/*",
"http://www.metacafe.com/*",
"https://metacafe.com/*",
"https://www.metacafe.com/*",
"http://veoh.com/*",
"http://www.veoh.com/*",
"https://veoh.com/*",
"https://www.veoh.com/*",
"http://viki.com/*",
"http://www.viki.com/*",
"https://viki.com/*",
"https://www.viki.com/*",
"http://imdb.com/*",
"http://www.imdb.com/*",
"https://imdb.com/*",
"https://www.imdb.com/*"
],
"js": ["savetube.user.js"],
"run_at": "document_end"
}
],
"permissions": [
"http://manifest.googlevideo.com/*",
"https://manifest.googlevideo.com/*",
"http://player.vimeo.com/*",
"https://player.vimeo.com/*",
"http://api.viki.io/*",
"https://api.viki.io/*"
]
"permissions": [
"http://manifest.googlevideo.com/*",
"https://manifest.googlevideo.com/*",
"http://player.vimeo.com/*",
"https://player.vimeo.com/*",
"http://api.viki.io/*",
"https://api.viki.io/*"
]
}
This diff is collapsed.
// ==UserScript==
// @name SaveTube+
// @version 2019.12.05
// @description Download videos from web sites.
// @author sebaro
// @namespace http://sebaro.pro/savetube
// @downloadURL https://gitlab.com/sebaro/savetube/raw/master/savetubeplus.user.js
// @updateURL https://gitlab.com/sebaro/savetube/raw/master/savetubeplus.user.js
// @icon https://gitlab.com/sebaro/savetube/raw/master/savetube.png
// @include *
// @name SaveTube+
// @version 2020.01.24
// @description Download videos from web sites.
// @author sebaro
// @namespace http://sebaro.pro/savetube
// @downloadURL https://gitlab.com/sebaro/savetube/raw/master/savetubeplus.user.js
// @updateURL https://gitlab.com/sebaro/savetube/raw/master/savetubeplus.user.js
// @icon https://gitlab.com/sebaro/savetube/raw/master/savetube.png
// @include *
// @noframes
// @grant none
// @run-at document-end
// @grant none
// @run-at document-end
// ==/UserScript==
/*
Copyright (C) 2014 - 2019 Sebastian Luncan
Copyright (C) 2014 - 2020 Sebastian Luncan
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Website: http://sebaro.pro/savetube
Contact: http://sebaro.pro/contact
Website: http://sebaro.pro/savetube
Contact: http://sebaro.pro/contact
*/
......@@ -59,9 +59,9 @@ if (window.top && window.top != window.self) return;
// ==========Functions========== //
function styleMyElement(obj, styles) {
for (var stylekey in styles) {
obj.style[stylekey] = styles[stylekey];
}
for (var stylekey in styles) {
obj.style[stylekey] = styles[stylekey];
}
}
......@@ -76,12 +76,12 @@ if (!source) return;
/* Video Patterns */
var patterns = [
'=(http[^=\'"]*?\\.(mp4|flv|webm|m3u8).*?)&',
'file\s*:\s*"(http[^")]*?\\.(mp4|flv|webm|m3u8).*?)"',
'src="(http[^"]*?\\.(mp4|flv|webm|m3u8).*?)"',
'"(http[^"]*?\\.(mp4|flv|webm|m3u8).*?)"',
'\'(http[^\']*?\\.(mp4|flv|webm|m3u8).*?)\''
];
'=(http[^=\'"]*?\\.(mp4|flv|webm|m3u8).*?)&',
'file\s*:\s*"(http[^")]*?\\.(mp4|flv|webm|m3u8).*?)"',
'src="(http[^"]*?\\.(mp4|flv|webm|m3u8).*?)"',
'"(http[^"]*?\\.(mp4|flv|webm|m3u8).*?)"',
'\'(http[^\']*?\\.(mp4|flv|webm|m3u8).*?)\''
];
var exclude = '(thumb|\\.jpg|\\.png|\\.gif|\\.htm|format=|\\/\\/[^\\/]*?(mp4|flv|webm|m3u8)|(mp4|flv|webm|m3u8)[0-9a-zA-Z])';
......@@ -89,55 +89,55 @@ var exclude = '(thumb|\\.jpg|\\.png|\\.gif|\\.htm|format=|\\/\\/[^\\/]*?(mp4|flv
var pattern, matches, matcher, video, type;
var links = [];
for (var i = 0; i < patterns.length; i++) {
pattern = new RegExp(patterns[i], 'g');
matches = source.match(pattern);
if (matches) {
for (var v = 0; v < matches.length; v++) {
matcher = matches[v].match(patterns[i]);
video = (matcher) ? matcher[1] : null;
if (video) {
if (video.indexOf('%') != -1) video = unescape(video);
if (video.indexOf('\\u00') != -1) video = video.replace(/\\u002F/g, '/').replace(/\\u0026/g, '&');
if (video.indexOf('&amp;') != -1) video = video.replace(/&amp;/g, '&');
video = video.replace(/\\/g, '');
if (video.indexOf('http') == 0 && !video.match(exclude)) {
if (links.indexOf(video) == -1) links.push(video);
pattern = new RegExp(patterns[i], 'g');
matches = source.match(pattern);
if (matches) {
for (var v = 0; v < matches.length; v++) {
matcher = matches[v].match(patterns[i]);
video = (matcher) ? matcher[1] : null;
if (video) {
if (video.indexOf('%') != -1) video = unescape(video);
if (video.indexOf('\\u00') != -1) video = video.replace(/\\u002F/g, '/').replace(/\\u0026/g, '&');
if (video.indexOf('&amp;') != -1) video = video.replace(/&amp;/g, '&');
video = video.replace(/\\/g, '');
if (video.indexOf('http') == 0 && !video.match(exclude)) {
if (links.indexOf(video) == -1) links.push(video);
}
}
}
}
}
}
}
}
if (links.length > 0) {
var panel = document.createElement('div');
styleMyElement(panel, {position: 'fixed', height: panelHeight + 'px', backgroundColor: '#FFFFFF', padding: '0px 10px 5px 10px', bottom: '0px', right: '25px', lineHeight: (panelHeight - 2) + 'px', zIndex: '2000000000', borderTop: '1px solid #CCCCCC', borderLeft: '1px solid #CCCCCC', borderRight: '1px solid #CCCCCC', borderRadius: '5px 5px 0px 0px', boxSizing: 'content-box'});
document.body.appendChild(panel);
var logo = document.createElement('div');
styleMyElement(logo, {display: 'inline-block', color: '#32d132', fontSize: '14px', fontWeight: 'bold', border: '1px solid #32d132', borderRadius: '3px', padding: '0px 4px', marginRight: '10px', lineHeight: 'normal', verticalAlign: 'middle'});
panel.appendChild(logo);
logo.innerHTML = userscript;
var menu = document.createElement('select');
styleMyElement(menu, {width: '270px', display: 'inline-block', fontSize: '14px', fontWeight: 'bold', padding: '0px 3px', overflow: 'hidden', border: '1px solid #CCCCCC', color: '#777777', backgroundColor: '#FFFFFF', lineHeight: 'normal', verticalAlign: 'middle', cursor: 'pointer'});
var option;
for (var i = 0; i < links.length; i++) {
option = document.createElement('option');
styleMyElement(option, {fontSize: '14px', fontWeight: 'bold', cursor: 'pointer'});
option.value = links[i];
option.innerHTML = links[i].substr(0, 50) + '...';
option.title = links[i];
menu.appendChild(option);
}
panel.appendChild(menu);
var linkb = document.createElement('div');
styleMyElement(linkb, {display: 'inline-block', color: '#777777', fontSize: '14px', fontWeight: 'bold', padding: '0px 4px', verticalAlign: 'middle', marginLeft: '5px', cursor: 'pointer'});
panel.appendChild(linkb);
var link = document.createElement('a');
styleMyElement(link, {color: '#777777', textDecoration: 'underline'});
link.innerHTML = '[Link]';
link.href = links[0];
linkb.appendChild(link);
menu.addEventListener('change', function() {
link.href = this.value;
}, false);
var panel = document.createElement('div');
styleMyElement(panel, {position: 'fixed', fontFamily: 'sans-serif', fontSize: '10px', height: panelHeight + 'px', lineHeight: panelHeight + 'px', backgroundColor: '#FFFFFF', padding: '0px 10px 5px 10px', bottom: '0px', right: '25px', zIndex: '2000000000', borderTop: '1px solid #CCCCCC', borderLeft: '1px solid #CCCCCC', borderRight: '1px solid #CCCCCC', borderRadius: '5px 5px 0px 0px', textAlign: 'center', boxSizing: 'content-box'});
document.body.appendChild(panel);
var logo = document.createElement('div');
styleMyElement(logo, {display: 'inline-block', color: '#32D132', fontSize: '14px', fontWeight: 'bold', border: '1px solid #32D132', borderRadius: '3px', padding: '0px 4px', marginRight: '10px', lineHeight: 'normal', verticalAlign: 'middle', cursor: 'pointer', boxSizing: 'content-box'});
panel.appendChild(logo);
logo.innerHTML = userscript;
var menu = document.createElement('select');
styleMyElement(menu, {display: 'inline-block', width: 'auto', height: '20px', fontFamily: 'inherit', fontSize: '14px', fontWeight: 'bold', padding: '0px 3px', overflow: 'hidden', border: '1px solid #CCCCCC', color: '#777777', backgroundColor: '#FFFFFF', lineHeight: 'normal', verticalAlign: 'middle', cursor: 'pointer', boxSizing: 'content-box'});
var option;
for (var i = 0; i < links.length; i++) {
option = document.createElement('option');
styleMyElement(option, {fontSize: '14px', fontWeight: 'bold', cursor: 'pointer'});
option.value = links[i];
option.innerHTML = links[i].substr(0, 35) + '...';
option.title = links[i];
menu.appendChild(option);
}
panel.appendChild(menu);
var linkb = document.createElement('div');
styleMyElement(linkb, {display: 'inline-block', color: '#777777', fontSize: '14px', fontWeight: 'bold', padding: '0px 4px', lineHeight: 'normal', verticalAlign: 'middle', marginLeft: '5px', marginBottom: '2px', cursor: 'pointer', boxSizing: 'content-box'});
panel.appendChild(linkb);
var link = document.createElement('a');
styleMyElement(link, {color: '#777777', textDecoration: 'underline'});
link.innerHTML = '[Link]';
link.href = links[0];
linkb.appendChild(link);
menu.addEventListener('change', function() {
link.href = this.value;
}, false);
}
})();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment