Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
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
videolan
vlc
Commits
5e374e0a
Commit
5e374e0a
authored
Sep 12, 2012
by
Pierre Ynard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vimeo.lua: remove useless test
This was only useful when we had several URLs to handle
parent
ecddf0b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
62 deletions
+59
-62
share/lua/playlist/vimeo.lua
share/lua/playlist/vimeo.lua
+59
-62
No files found.
share/lua/playlist/vimeo.lua
View file @
5e374e0a
...
...
@@ -42,70 +42,67 @@ end
-- Parse function.
function
parse
()
if
string.match
(
vlc
.
path
,
"vimeo.com/%d+$"
)
then
_
,
_
,
id
=
string.find
(
vlc
.
path
,
"vimeo.com/([0-9]*)"
)
prefres
=
get_prefres
()
ishd
=
false
quality
=
"sd"
codec
=
nil
while
true
do
line
=
vlc
.
readline
()
if
not
line
then
break
end
-- Try to find the video's title
if
string.match
(
line
,
"<meta property=\"
og
:
title
\
""
)
then
_
,
_
,
name
=
string.find
(
line
,
"content=\"
(.
*
)
\
">"
)
end
if
string.match
(
line
,
"{config:.*\"
title
\
":\"" ) then
_,_,name = string.find (line, "
\
"title\"
:
\
"([^\"
]
*
)
\
","
)
end
-- Try to find image for thumbnail
if
string.match
(
line
,
"<meta property=\"
og
:
image
\
""
)
then
_
,
_
,
arturl
=
string.find
(
line
,
"content=\"
(.
*
)
\
">"
)
end
if
string.match
(
line
,
"<meta itemprop=\"
thumbnailUrl
\
""
)
then
_
,
_
,
arturl
=
string.find
(
line
,
"content=\"
(.
*
)
\
">"
)
end
-- Try to find duration
if
string.match
(
line
,
"{config:.*\"
duration
\
":"
)
then
_
,
_
,
duration
=
string.find
(
line
,
"
\"
duration\"
:([
0
-
9
]
*
),
" )
end
-- Try to find request signature (needed to construct video url)
if string.match( line, "
{
config
:.
*
\
"signature\"
:
" ) then
_,_,rsig = string.find (line, "
\
"signature\"
:
\
"([0-9a-f]*)\"
,
" )
end
-- Try to find request signature time (needed to construct video url)
if string.match( line, "
{
config
:.
*
\
"timestamp\"
:
" ) then
_,_,tstamp = string.find (line, "
\
"timestamp\"
:([
0
-
9
]
*
),
" )
end
-- Try to find the available codecs
if string.match( line, "
{
config
:.
*
,
\
"files\"
:{
\
"vp6\"
:
" ) then
codec = "
vp6
"
end
if string.match( line, "
{
config
:.
*
,
\
"files\"
:{
\
"vp8\"
:
" ) then
codec = "
vp8
"
end
if string.match( line, "
{
config
:.
*
,
\
"files\"
:{
\
"h264\"
:
" ) then
codec = "
h264
"
end
-- Try to find whether video is HD actually
if string.match( line, "
{
config
:.
*
,
\
"hd\"
:
1
" ) then
ishd = true
end
if string.match( line, "
{
config
:.
*
\
"height\"
:
" ) then
_,_,height = string.find (line, "
\
"height\"
:([
0
-
9
]
*
),
" )
end
_
,
_
,
id
=
string.find
(
vlc
.
path
,
"vimeo.com/([0-9]*)"
)
prefres
=
get_prefres
()
ishd
=
false
quality
=
"sd"
codec
=
nil
while
true
do
line
=
vlc
.
readline
()
if
not
line
then
break
end
-- Try to find the video's title
if
string.match
(
line
,
"<meta property=\"
og
:
title
\
""
)
then
_
,
_
,
name
=
string.find
(
line
,
"content=\"
(.
*
)
\
">"
)
end
if not codec then
vlc.msg.warn("
unable
to
find
codec
info
")
return nil
if
string.match
(
line
,
"{config:.*\"
title
\
":\"" ) then
_,_,name = string.find (line, "
\
"title\"
:
\
"([^\"
]
*
)
\
","
)
end
if ishd and ( not height or prefres < 0 or prefres >= tonumber(height) ) then
quality = "
hd
"
-- Try to find image for thumbnail
if
string.match
(
line
,
"<meta property=\"
og
:
image
\
""
)
then
_
,
_
,
arturl
=
string.find
(
line
,
"content=\"
(.
*
)
\
">"
)
end
if
string.match
(
line
,
"<meta itemprop=\"
thumbnailUrl
\
""
)
then
_
,
_
,
arturl
=
string.find
(
line
,
"content=\"
(.
*
)
\
">"
)
end
-- Try to find duration
if
string.match
(
line
,
"{config:.*\"
duration
\
":"
)
then
_
,
_
,
duration
=
string.find
(
line
,
"
\"
duration\"
:([
0
-
9
]
*
),
" )
end
-- Try to find request signature (needed to construct video url)
if string.match( line, "
{
config
:.
*
\
"signature\"
:
" ) then
_,_,rsig = string.find (line, "
\
"signature\"
:
\
"([0-9a-f]*)\"
,
" )
end
-- Try to find request signature time (needed to construct video url)
if string.match( line, "
{
config
:.
*
\
"timestamp\"
:
" ) then
_,_,tstamp = string.find (line, "
\
"timestamp\"
:([
0
-
9
]
*
),
" )
end
-- Try to find the available codecs
if string.match( line, "
{
config
:.
*
,
\
"files\"
:{
\
"vp6\"
:
" ) then
codec = "
vp6
"
end
if string.match( line, "
{
config
:.
*
,
\
"files\"
:{
\
"vp8\"
:
" ) then
codec = "
vp8
"
end
path = "
http
:
//
player
.
vimeo
.
com
/
play_redirect
?
quality
=
"..quality.."
&
codecs
=
"..codec.."
&
clip_id
=
"..id.."
&
time
=
"..tstamp.."
&
sig
=
"..rsig.."
&
type
=
html5_desktop_local
"
return { { path = path; name = name; arturl = arturl, duration = duration } }
if string.match( line, "
{
config
:.
*
,
\
"files\"
:{
\
"h264\"
:
" ) then
codec = "
h264
"
end
-- Try to find whether video is HD actually
if string.match( line, "
{
config
:.
*
,
\
"hd\"
:
1
" ) then
ishd = true
end
if string.match( line, "
{
config
:.
*
\
"height\"
:
" ) then
_,_,height = string.find (line, "
\
"height\"
:([
0
-
9
]
*
),
" )
end
end
if not codec then
vlc.msg.warn("
unable
to
find
codec
info
")
return nil
end
if ishd and ( not height or prefres < 0 or prefres >= tonumber(height) ) then
quality = "
hd
"
end
return {}
path = "
http
:
//
player
.
vimeo
.
com
/
play_redirect
?
quality
=
"..quality.."
&
codecs
=
"..codec.."
&
clip_id
=
"..id.."
&
time
=
"..tstamp.."
&
sig
=
"..rsig.."
&
type
=
html5_desktop_local
"
return { { path = path; name = name; arturl = arturl, duration = duration } }
end
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