Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Backups
youtube-dl
Commits
b39f42ee
Commit
b39f42ee
authored
May 25, 2018
by
András Veres-Szentkirályi
Committed by
Sergey M
May 26, 2018
Browse files
[indavideo] Sign download URLs
parent
6bd499e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
5 deletions
+18
-5
youtube_dl/extractor/indavideo.py
youtube_dl/extractor/indavideo.py
+18
-5
No files found.
youtube_dl/extractor/indavideo.py
View file @
b39f42ee
...
...
@@ -2,10 +2,12 @@
from
__future__
import
unicode_literals
from
.common
import
InfoExtractor
from
..compat
import
compat_str
from
..utils
import
(
int_or_none
,
parse_age_limit
,
parse_iso8601
,
update_url_query
,
)
...
...
@@ -58,11 +60,10 @@ class IndavideoEmbedIE(InfoExtractor):
if
flv_url
not
in
video_urls
:
video_urls
.
append
(
flv_url
)
formats
=
[{
'url'
:
video_url
,
'height'
:
int_or_none
(
self
.
_search_regex
(
r
'\.(\d{3,4})\.mp4(?:\?|$)'
,
video_url
,
'height'
,
default
=
None
)),
}
for
video_url
in
video_urls
]
filesh
=
video
.
get
(
'filesh'
)
formats
=
[
self
.
video_url_to_format
(
video_url
,
filesh
)
for
video_url
in
video_urls
]
self
.
_sort_formats
(
formats
)
timestamp
=
video
.
get
(
'date'
)
...
...
@@ -90,6 +91,18 @@ class IndavideoEmbedIE(InfoExtractor):
'formats'
:
formats
,
}
def
video_url_to_format
(
self
,
video_url
,
filesh
):
height
=
int_or_none
(
self
.
_search_regex
(
r
'\.(\d{3,4})\.mp4(?:\?|$)'
,
video_url
,
'height'
,
default
=
None
))
if
height
and
filesh
:
token
=
filesh
.
get
(
compat_str
(
height
))
if
token
is
not
None
:
video_url
=
update_url_query
(
video_url
,
{
'token'
:
token
})
return
{
'url'
:
video_url
,
'height'
:
height
,
}
class
IndavideoIE
(
InfoExtractor
):
_VALID_URL
=
r
'https?://(?:.+?\.)?indavideo\.hu/video/(?P<id>[^/#?]+)'
...
...
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