Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
6
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
SaveTube
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sebaro
SaveTube
Commits
9cfff239
Commit
9cfff239
authored
Sep 12, 2019
by
sebaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add second source for YouTube videos
parent
6f900ea2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
143 additions
and
26 deletions
+143
-26
CHANGES
CHANGES
+4
-1
Extensions/WebExtensions/SaveTube/manifest.json
Extensions/WebExtensions/SaveTube/manifest.json
+1
-1
Extensions/WebExtensions/SaveTube/savetube.user.js
Extensions/WebExtensions/SaveTube/savetube.user.js
+69
-12
Extensions/WebExtensions/savetube.crx
Extensions/WebExtensions/savetube.crx
+0
-0
Extensions/WebExtensions/savetube.xpi
Extensions/WebExtensions/savetube.xpi
+0
-0
Extensions/WebExtensions/savetube.zip
Extensions/WebExtensions/savetube.zip
+0
-0
savetube.user.js
savetube.user.js
+69
-12
No files found.
CHANGES
View file @
9cfff239
...
...
@@ -3,8 +3,11 @@
/* SaveTube Changelog */
#2019.09.12
- YouTube: adds a second source for videos in case the first fails or is not available
#2019.09.01
- YouTube: exclude multi segment DASH videos
- YouTube: exclude
s
multi segment DASH videos
#2019.08.17
- YouTube: adds VLD/240, LD/360 DASH videos
...
...
Extensions/WebExtensions/SaveTube/manifest.json
View file @
9cfff239
...
...
@@ -2,7 +2,7 @@
"manifest_version"
:
2
,
"name"
:
"SaveTube"
,
"version"
:
"2019.9.1"
,
"version"
:
"2019.9.1
2
"
,
"description"
:
"Download videos from video sharing web sites."
,
...
...
Extensions/WebExtensions/SaveTube/savetube.user.js
View file @
9cfff239
// ==UserScript==
// @name SaveTube
// @version 2019.09.
01
// @version 2019.09.
12
// @description Download videos from video sharing web sites.
// @author sebaro
// @namespace http://sebaro.pro/savetube
...
...
@@ -582,7 +582,33 @@ function SaveTube() {
/* Get Videos Content */
var
ytVideosEncodedFmts
,
ytVideosAdaptiveFmts
,
ytVideosContent
,
ytHLSVideos
,
ytHLSContent
;
ytVideosEncodedFmts
=
getMyContent
(
page
.
url
,
'
"url_encoded_fmt_stream_map
\\\\
?":
\\
s*
\\\\
?"(.*?)
\\\\
?"
'
,
false
);
if
(
!
ytVideosEncodedFmts
)
{
ytVideosEncodedFmtsNew
=
getMyContent
(
page
.
url
,
'
"formats
\\\\
?":
\\
s*(
\\
[.*?
\\
])
'
,
false
);
if
(
ytVideosEncodedFmtsNew
)
{
ytVideosEncodedFmts
=
''
;
ytVideosEncodedFmtsNew
=
cleanMyContent
(
ytVideosEncodedFmtsNew
,
false
);
ytVideosEncodedFmtsNew
=
ytVideosEncodedFmtsNew
.
match
(
new
RegExp
(
'
"url":
\
s*".*?"
'
,
'
g
'
));
if
(
ytVideosEncodedFmtsNew
)
{
for
(
var
i
=
0
;
i
<
ytVideosEncodedFmtsNew
.
length
;
i
++
)
{
ytVideosEncodedFmts
+=
ytVideosEncodedFmtsNew
[
i
].
replace
(
/"/g
,
''
).
replace
(
'
url:
'
,
'
url=
'
)
+
'
,
'
;
}
}
}
}
ytVideosAdaptiveFmts
=
getMyContent
(
page
.
url
,
'
"adaptive_fmts
\\\\
?":
\\
s*
\\\\
?"(.*?)
\\\\
?"
'
,
false
);
if
(
!
ytVideosAdaptiveFmts
)
{
ytVideosAdaptiveFmtsNew
=
getMyContent
(
page
.
url
,
'
"adaptiveFormats
\\\\
?":
\\
s*(
\\
[.*?
\\
])
'
,
false
);
if
(
ytVideosAdaptiveFmtsNew
)
{
ytVideosAdaptiveFmts
=
''
;
ytVideosAdaptiveFmtsNew
=
cleanMyContent
(
ytVideosAdaptiveFmtsNew
,
false
);
ytVideosAdaptiveFmtsNew
=
ytVideosAdaptiveFmtsNew
.
match
(
new
RegExp
(
'
"url":
\
s*".*?"
'
,
'
g
'
));
if
(
ytVideosAdaptiveFmtsNew
)
{
for
(
var
i
=
0
;
i
<
ytVideosAdaptiveFmtsNew
.
length
;
i
++
)
{
ytVideosAdaptiveFmts
+=
ytVideosAdaptiveFmtsNew
[
i
].
replace
(
/"/g
,
''
).
replace
(
'
url:
'
,
'
url=
'
)
+
'
,
'
;
}
}
}
}
if
(
!
ytVideosAdaptiveFmts
)
{
var
ytDASHVideos
,
ytDASHContent
;
ytDASHVideos
=
getMyContent
(
page
.
url
,
'
"dashmpd
\\\\
?":
\\
s*
\\\\
?"(.*?)
\\\\
?"
'
,
false
);
...
...
@@ -626,18 +652,49 @@ function SaveTube() {
var
ytVideoID
=
page
.
url
.
match
(
/
(\?
|&
)
v=
(
.*
?)(
&|$
)
/
);
ytVideoID
=
(
ytVideoID
)
?
ytVideoID
[
2
]
:
null
;
if
(
ytVideoID
)
{
var
ytVideosInfo
=
getMyContent
(
page
.
win
.
location
.
protocol
+
'
//
'
+
page
.
win
.
location
.
hostname
+
'
/get_video_info?video_id=
'
+
ytVideoID
+
'
&eurl=https://youtube.googleapis.com/v/
'
,
'
TEXT
'
,
false
);
if
(
ytVideosInfo
)
{
ytVideosEncodedFmts
=
ytVideosInfo
.
match
(
/url_encoded_fmt_stream_map=
(
.*
?)
&/
);
ytVideosEncodedFmts
=
(
ytVideosEncodedFmts
)
?
ytVideosEncodedFmts
[
1
]
:
null
;
if
(
ytVideosEncodedFmts
)
{
ytVideosEncodedFmts
=
cleanMyContent
(
ytVideosEncodedFmts
,
true
);
ytVideosContent
=
ytVideosEncodedFmts
;
var
ytVideosInfoPage
=
page
.
win
.
location
.
protocol
+
'
//
'
+
page
.
win
.
location
.
hostname
+
'
/get_video_info?video_id=
'
+
ytVideoID
+
'
&eurl=https://youtube.googleapis.com/v/
'
;
ytVideosEncodedFmts
=
getMyContent
(
ytVideosInfoPage
,
'
url_encoded_fmt_stream_map=(.*?)&
'
,
false
);
if
(
ytVideosEncodedFmts
)
{
ytVideosEncodedFmts
=
cleanMyContent
(
ytVideosEncodedFmts
,
true
);
ytVideosContent
=
ytVideosEncodedFmts
;
}
else
{
ytVideosEncodedFmtsNew
=
getMyContent
(
ytVideosInfoPage
,
'
formats%22%3A(%5B.*?%5D)
'
,
false
);
if
(
ytVideosEncodedFmtsNew
)
{
ytVideosEncodedFmts
=
''
;
ytVideosEncodedFmtsNew
=
cleanMyContent
(
ytVideosEncodedFmtsNew
,
true
);
ytVideosEncodedFmtsNew
=
ytVideosEncodedFmtsNew
.
match
(
new
RegExp
(
'
"(url|cipher)":
\
s*".*?"
'
,
'
g
'
));
if
(
ytVideosEncodedFmtsNew
)
{
for
(
var
i
=
0
;
i
<
ytVideosEncodedFmtsNew
.
length
;
i
++
)
{
ytVideosEncodedFmts
+=
ytVideosEncodedFmtsNew
[
i
].
replace
(
/"/g
,
''
).
replace
(
'
url:
'
,
'
url=
'
).
replace
(
'
cipher:
'
,
''
)
+
'
,
'
;
}
if
(
ytVideosEncodedFmts
.
indexOf
(
'
%3A%2F%2F
'
)
!=
-
1
)
{
ytVideosEncodedFmts
=
cleanMyContent
(
ytVideosEncodedFmts
,
true
);
}
ytVideosContent
=
ytVideosEncodedFmts
;
}
}
}
if
(
!
ytVideosAdaptiveFmts
)
{
ytVideosAdaptiveFmts
=
getMyContent
(
ytVideosInfoPage
,
'
adaptive_fmts=(.*?)&
'
,
false
);
if
(
ytVideosAdaptiveFmts
)
{
ytVideosAdaptiveFmts
=
cleanMyContent
(
ytVideosAdaptiveFmts
,
true
);
}
if
(
!
ytVideosAdaptiveFmts
)
{
ytVideosAdaptiveFmts
=
ytVideosInfo
.
match
(
/adaptive_fmts=
(
.*
?)
&/
);
ytVideosAdaptiveFmts
=
(
ytVideosAdaptiveFmts
)
?
ytVideosAdaptiveFmts
[
1
]
:
null
;
if
(
ytVideosAdaptiveFmts
)
ytVideosAdaptiveFmts
=
cleanMyContent
(
ytVideosAdaptiveFmts
,
true
);
else
{
ytVideosAdaptiveFmtsNew
=
getMyContent
(
ytVideosInfoPage
,
'
adaptiveFormats%22%3A(%5B.*?%5D)
'
,
false
);
if
(
ytVideosAdaptiveFmtsNew
)
{
ytVideosAdaptiveFmts
=
''
;
ytVideosAdaptiveFmtsNew
=
cleanMyContent
(
ytVideosAdaptiveFmtsNew
,
true
);
ytVideosAdaptiveFmtsNew
=
ytVideosAdaptiveFmtsNew
.
match
(
new
RegExp
(
'
"(url|cipher)":
\
s*".*?"
'
,
'
g
'
));
if
(
ytVideosAdaptiveFmtsNew
)
{
for
(
var
i
=
0
;
i
<
ytVideosAdaptiveFmtsNew
.
length
;
i
++
)
{
ytVideosAdaptiveFmts
+=
ytVideosAdaptiveFmtsNew
[
i
].
replace
(
/"/g
,
''
).
replace
(
'
url:
'
,
'
url=
'
).
replace
(
'
cipher:
'
,
''
)
+
'
,
'
;
}
if
(
ytVideosAdaptiveFmts
.
indexOf
(
'
%3A%2F%2F
'
)
!=
-
1
)
{
ytVideosAdaptiveFmts
=
cleanMyContent
(
ytVideosAdaptiveFmts
,
true
);
}
}
}
}
}
}
...
...
Extensions/WebExtensions/savetube.crx
View file @
9cfff239
No preview for this file type
Extensions/WebExtensions/savetube.xpi
View file @
9cfff239
No preview for this file type
Extensions/WebExtensions/savetube.zip
View file @
9cfff239
No preview for this file type
savetube.user.js
View file @
9cfff239
// ==UserScript==
// @name SaveTube
// @version 2019.09.
01
// @version 2019.09.
12
// @description Download videos from video sharing web sites.
// @author sebaro
// @namespace http://sebaro.pro/savetube
...
...
@@ -582,7 +582,33 @@ function SaveTube() {
/* Get Videos Content */
var
ytVideosEncodedFmts
,
ytVideosAdaptiveFmts
,
ytVideosContent
,
ytHLSVideos
,
ytHLSContent
;
ytVideosEncodedFmts
=
getMyContent
(
page
.
url
,
'
"url_encoded_fmt_stream_map
\\\\
?":
\\
s*
\\\\
?"(.*?)
\\\\
?"
'
,
false
);
if
(
!
ytVideosEncodedFmts
)
{
ytVideosEncodedFmtsNew
=
getMyContent
(
page
.
url
,
'
"formats
\\\\
?":
\\
s*(
\\
[.*?
\\
])
'
,
false
);
if
(
ytVideosEncodedFmtsNew
)
{
ytVideosEncodedFmts
=
''
;
ytVideosEncodedFmtsNew
=
cleanMyContent
(
ytVideosEncodedFmtsNew
,
false
);
ytVideosEncodedFmtsNew
=
ytVideosEncodedFmtsNew
.
match
(
new
RegExp
(
'
"url":
\
s*".*?"
'
,
'
g
'
));
if
(
ytVideosEncodedFmtsNew
)
{
for
(
var
i
=
0
;
i
<
ytVideosEncodedFmtsNew
.
length
;
i
++
)
{
ytVideosEncodedFmts
+=
ytVideosEncodedFmtsNew
[
i
].
replace
(
/"/g
,
''
).
replace
(
'
url:
'
,
'
url=
'
)
+
'
,
'
;
}
}
}
}
ytVideosAdaptiveFmts
=
getMyContent
(
page
.
url
,
'
"adaptive_fmts
\\\\
?":
\\
s*
\\\\
?"(.*?)
\\\\
?"
'
,
false
);
if
(
!
ytVideosAdaptiveFmts
)
{
ytVideosAdaptiveFmtsNew
=
getMyContent
(
page
.
url
,
'
"adaptiveFormats
\\\\
?":
\\
s*(
\\
[.*?
\\
])
'
,
false
);
if
(
ytVideosAdaptiveFmtsNew
)
{
ytVideosAdaptiveFmts
=
''
;
ytVideosAdaptiveFmtsNew
=
cleanMyContent
(
ytVideosAdaptiveFmtsNew
,
false
);
ytVideosAdaptiveFmtsNew
=
ytVideosAdaptiveFmtsNew
.
match
(
new
RegExp
(
'
"url":
\
s*".*?"
'
,
'
g
'
));
if
(
ytVideosAdaptiveFmtsNew
)
{
for
(
var
i
=
0
;
i
<
ytVideosAdaptiveFmtsNew
.
length
;
i
++
)
{
ytVideosAdaptiveFmts
+=
ytVideosAdaptiveFmtsNew
[
i
].
replace
(
/"/g
,
''
).
replace
(
'
url:
'
,
'
url=
'
)
+
'
,
'
;
}
}
}
}
if
(
!
ytVideosAdaptiveFmts
)
{
var
ytDASHVideos
,
ytDASHContent
;
ytDASHVideos
=
getMyContent
(
page
.
url
,
'
"dashmpd
\\\\
?":
\\
s*
\\\\
?"(.*?)
\\\\
?"
'
,
false
);
...
...
@@ -626,18 +652,49 @@ function SaveTube() {
var
ytVideoID
=
page
.
url
.
match
(
/
(\?
|&
)
v=
(
.*
?)(
&|$
)
/
);
ytVideoID
=
(
ytVideoID
)
?
ytVideoID
[
2
]
:
null
;
if
(
ytVideoID
)
{
var
ytVideosInfo
=
getMyContent
(
page
.
win
.
location
.
protocol
+
'
//
'
+
page
.
win
.
location
.
hostname
+
'
/get_video_info?video_id=
'
+
ytVideoID
+
'
&eurl=https://youtube.googleapis.com/v/
'
,
'
TEXT
'
,
false
);
if
(
ytVideosInfo
)
{
ytVideosEncodedFmts
=
ytVideosInfo
.
match
(
/url_encoded_fmt_stream_map=
(
.*
?)
&/
);
ytVideosEncodedFmts
=
(
ytVideosEncodedFmts
)
?
ytVideosEncodedFmts
[
1
]
:
null
;
if
(
ytVideosEncodedFmts
)
{
ytVideosEncodedFmts
=
cleanMyContent
(
ytVideosEncodedFmts
,
true
);
ytVideosContent
=
ytVideosEncodedFmts
;
var
ytVideosInfoPage
=
page
.
win
.
location
.
protocol
+
'
//
'
+
page
.
win
.
location
.
hostname
+
'
/get_video_info?video_id=
'
+
ytVideoID
+
'
&eurl=https://youtube.googleapis.com/v/
'
;
ytVideosEncodedFmts
=
getMyContent
(
ytVideosInfoPage
,
'
url_encoded_fmt_stream_map=(.*?)&
'
,
false
);
if
(
ytVideosEncodedFmts
)
{
ytVideosEncodedFmts
=
cleanMyContent
(
ytVideosEncodedFmts
,
true
);
ytVideosContent
=
ytVideosEncodedFmts
;
}
else
{
ytVideosEncodedFmtsNew
=
getMyContent
(
ytVideosInfoPage
,
'
formats%22%3A(%5B.*?%5D)
'
,
false
);
if
(
ytVideosEncodedFmtsNew
)
{
ytVideosEncodedFmts
=
''
;
ytVideosEncodedFmtsNew
=
cleanMyContent
(
ytVideosEncodedFmtsNew
,
true
);
ytVideosEncodedFmtsNew
=
ytVideosEncodedFmtsNew
.
match
(
new
RegExp
(
'
"(url|cipher)":
\
s*".*?"
'
,
'
g
'
));
if
(
ytVideosEncodedFmtsNew
)
{
for
(
var
i
=
0
;
i
<
ytVideosEncodedFmtsNew
.
length
;
i
++
)
{
ytVideosEncodedFmts
+=
ytVideosEncodedFmtsNew
[
i
].
replace
(
/"/g
,
''
).
replace
(
'
url:
'
,
'
url=
'
).
replace
(
'
cipher:
'
,
''
)
+
'
,
'
;
}
if
(
ytVideosEncodedFmts
.
indexOf
(
'
%3A%2F%2F
'
)
!=
-
1
)
{
ytVideosEncodedFmts
=
cleanMyContent
(
ytVideosEncodedFmts
,
true
);
}
ytVideosContent
=
ytVideosEncodedFmts
;
}
}
}
if
(
!
ytVideosAdaptiveFmts
)
{
ytVideosAdaptiveFmts
=
getMyContent
(
ytVideosInfoPage
,
'
adaptive_fmts=(.*?)&
'
,
false
);
if
(
ytVideosAdaptiveFmts
)
{
ytVideosAdaptiveFmts
=
cleanMyContent
(
ytVideosAdaptiveFmts
,
true
);
}
if
(
!
ytVideosAdaptiveFmts
)
{
ytVideosAdaptiveFmts
=
ytVideosInfo
.
match
(
/adaptive_fmts=
(
.*
?)
&/
);
ytVideosAdaptiveFmts
=
(
ytVideosAdaptiveFmts
)
?
ytVideosAdaptiveFmts
[
1
]
:
null
;
if
(
ytVideosAdaptiveFmts
)
ytVideosAdaptiveFmts
=
cleanMyContent
(
ytVideosAdaptiveFmts
,
true
);
else
{
ytVideosAdaptiveFmtsNew
=
getMyContent
(
ytVideosInfoPage
,
'
adaptiveFormats%22%3A(%5B.*?%5D)
'
,
false
);
if
(
ytVideosAdaptiveFmtsNew
)
{
ytVideosAdaptiveFmts
=
''
;
ytVideosAdaptiveFmtsNew
=
cleanMyContent
(
ytVideosAdaptiveFmtsNew
,
true
);
ytVideosAdaptiveFmtsNew
=
ytVideosAdaptiveFmtsNew
.
match
(
new
RegExp
(
'
"(url|cipher)":
\
s*".*?"
'
,
'
g
'
));
if
(
ytVideosAdaptiveFmtsNew
)
{
for
(
var
i
=
0
;
i
<
ytVideosAdaptiveFmtsNew
.
length
;
i
++
)
{
ytVideosAdaptiveFmts
+=
ytVideosAdaptiveFmtsNew
[
i
].
replace
(
/"/g
,
''
).
replace
(
'
url:
'
,
'
url=
'
).
replace
(
'
cipher:
'
,
''
)
+
'
,
'
;
}
if
(
ytVideosAdaptiveFmts
.
indexOf
(
'
%3A%2F%2F
'
)
!=
-
1
)
{
ytVideosAdaptiveFmts
=
cleanMyContent
(
ytVideosAdaptiveFmts
,
true
);
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment