Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative URLs in m3u8 #189

Open
norenh opened this issue Apr 13, 2016 · 3 comments
Open

Relative URLs in m3u8 #189

norenh opened this issue Apr 13, 2016 · 3 comments

Comments

@norenh
Copy link

norenh commented Apr 13, 2016

I have noticed that SVTPlay sometime use relative URLs in their m3u8-file which causes get_flash_videos to call ffmpeg with a invalid URI.
The problem can be seen for the video below (for 5 more days):
http://www.svtplay.se/video/7707206/ockupationen/ockupationen-sasong-1-avsnitt-1

I am neither familiar with get_flash_videos or the m3u8 format but I assume that the proper way to deal with it is in read_hls_playlist as the problem might exist at other sites as well. I made the following quick and dirty workaround to deal with it in my end:


diff --git a/lib/FlashVideo/Utils.pm b/lib/FlashVideo/Utils.pm
index d621f00..805b4f4 100644
--- a/lib/FlashVideo/Utils.pm
+++ b/lib/FlashVideo/Utils.pm
@@ -7,6 +7,7 @@ use base 'Exporter';
 use HTML::Entities;
 use HTML::TokeParser;
 use Encode;
+use URI;

 use constant FP_KEY => "Genuine Adobe Flash Player 001";
 use constant EXTENSIONS => qr/\.(?:flv|mp4|mov|wmv|avi|m4v)/i;
@@ -563,7 +564,7 @@ sub read_hls_playlist {
   foreach my $line (@lines) {
     if ($line =~ /BANDWIDTH/) {
       $line =~ /BANDWIDTH=([0-9]*)/;
-      $urltable{int($1)} = $lines[$i + 1];
+      $urltable{int($1)} = URI->new("$lines[$i + 1]")->abs("$url")->canonical();
     }
     $i++;
   }
-- 
@karjonas
Copy link
Contributor

I cannot reproduce this problem. Please run this command and provide the output:
./get_flash_videos --debug http://www.svtplay.se/video/7707206/ockupationen/ockupationen-sasong-1-avsnitt-1

@norenh
Copy link
Author

norenh commented Apr 13, 2016

Oops, it seems like you are correct. It is not a problem with latest git and I totally missed reproducing with latest. I can now see that you ffmpeg is replaced with a hlsdownloader and that seems to deal with it properly, although the problem exist in latest released version (1.25.91).

Feel free to close this and thanks for the quick response!

@karjonas
Copy link
Contributor

Great, thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants