Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
b5573aef
Commit
b5573aef
authored
Aug 07, 2011
by
Pierre Ynard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
youtube.lua: clean up SWF URL handling
parent
3906a3dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
20 deletions
+17
-20
share/lua/playlist/youtube.lua
share/lua/playlist/youtube.lua
+17
-20
No files found.
share/lua/playlist/youtube.lua
View file @
b5573aef
...
@@ -51,16 +51,14 @@ function probe()
...
@@ -51,16 +51,14 @@ function probe()
return
false
return
false
end
end
end
end
return
(
string.match
(
vlc
.
path
,
"watch%?v="
)
-- the html page
return
(
string.match
(
vlc
.
path
,
"/watch%?"
)
-- the html page
or
string.match
(
vlc
.
path
,
"watch_fullscreen%?video_id="
)
-- the fullscreen page
or
string.match
(
vlc
.
path
,
"/v/"
)
-- video in swf player
or
string.match
(
vlc
.
path
,
"p.swf"
)
-- the (old?) player url
or
string.match
(
vlc
.
path
,
"/player2.swf"
)
)
-- another player url
or
string.match
(
vlc
.
path
,
"jp.swf"
)
-- the (new?) player url (as of 24/08/2007)
or
string.match
(
vlc
.
path
,
"player2.swf"
)
)
-- another player url
end
end
-- Parse function.
-- Parse function.
function
parse
()
function
parse
()
if
string.match
(
vlc
.
path
,
"
watch%?v=
"
)
if
string.match
(
vlc
.
path
,
"
/watch%?
"
)
then
-- This is the HTML page's URL
then
-- This is the HTML page's URL
-- fmt is the format of the video
-- fmt is the format of the video
-- (cf. http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs)
-- (cf. http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs)
...
@@ -109,32 +107,31 @@ function parse()
...
@@ -109,32 +107,31 @@ function parse()
end
end
end
end
if not arturl then
arturl = get_arturl()
end
if not path then
if not path then
vlc.msg.err( "
Couldn
't extract youtube video URL, please check for updates to this script" )
vlc.msg.err( "
Couldn
't extract youtube video URL, please check for updates to this script" )
return { }
return { }
end
end
if not arturl then
arturl = get_arturl()
end
return { { path = path; name = name; description = description; artist = artist; arturl = arturl } }
return { { path = path; name = name; description = description; artist = artist; arturl = arturl } }
else -- This is the flash player'
s
URL
else -- This is the flash player'
s
URL
if
string.match
(
vlc
.
path
,
"title="
)
then
name
=
vlc
.
strings
.
decode_uri
(
get_url_param
(
vlc
.
path
,
"title"
))
end
video_id
=
get_url_param
(
vlc
.
path
,
"video_id"
)
video_id
=
get_url_param
(
vlc
.
path
,
"video_id"
)
arturl
=
get_arturl
(
vlc
.
path
,
video_id
)
if
not
video_id
then
_
,
_
,
video_id
=
string.find
(
vlc
.
path
,
"/v/([^?]*)"
)
end
if
not
video_id
then
vlc
.
msg
.
err
(
"Couldn't extract youtube video URL"
)
return
{
}
end
fmt
=
get_url_param
(
vlc
.
path
,
"fmt"
)
fmt
=
get_url_param
(
vlc
.
path
,
"fmt"
)
if
fmt
then
if
fmt
then
format
=
"&fmt="
..
fmt
format
=
"&fmt="
..
fmt
else
else
format
=
""
format
=
""
end
end
if
not
string.match
(
vlc
.
path
,
"t="
)
then
return
{
{
path
=
"http://www.youtube.com/watch?v="
..
video_id
..
format
}
}
-- This sucks, we're missing "t" which is now mandatory. Let's
-- try using another url
return
{
{
path
=
"http://www.youtube.com/v/"
..
video_id
;
name
=
name
;
arturl
=
arturl
}
}
end
return
{
{
path
=
"http://www.youtube.com/get_video.php?video_id="
..
video_id
..
"&t="
..
get_url_param
(
vlc
.
path
,
"t"
)
..
format
;
name
=
name
;
arturl
=
arturl
}
}
end
end
end
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