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

USA Networks Issues #22105

Closed
netuser0 opened this issue Aug 15, 2019 · 35 comments
Closed

USA Networks Issues #22105

netuser0 opened this issue Aug 15, 2019 · 35 comments

Comments

@netuser0
Copy link

@netuser0 netuser0 commented Aug 15, 2019

Checklist

  • I'm reporting a broken site support
  • I've verified that I'm running youtube-dl version 2019.08.13
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar issues including closed ones

Verbose log

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-o', 'Suits S09E05 - If The Shoe Fits.mp4', '--ap-mso', 'Comcast_SSO', '--ap-username', 'PRIVATE', '--ap-password', 'PRIVATE', '--hls-prefer-native', '-v', 'https://www.usanetwork.com/suits/videos/if-the-shoe-fits']
[debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252
[debug] youtube-dl version 2019.08.13
[debug] Python version 3.7.3 (CPython) - Windows-10-10.0.18362-SP0
[debug] exe versions: ffmpeg N-94452-g9af8ce754b, ffprobe N-94452-g9af8ce754b
[debug] Proxy map: {}
[USANetwork] if-the-shoe-fits: Downloading webpage
ERROR: An extractor error has occurred. (caused by KeyError('data-mpx-guid')); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "c:\program files\python37\lib\site-packages\youtube_dl\extractor\common.py", line 530, in extract
    ie_result = self._real_extract(url)
  File "c:\program files\python37\lib\site-packages\youtube_dl\extractor\usanetwork.py", line 36, in _real_extract
    video_id = player_params['data-mpx-guid']
KeyError: 'data-mpx-guid'
Traceback (most recent call last):
  File "c:\program files\python37\lib\site-packages\youtube_dl\extractor\common.py", line 530, in extract
    ie_result = self._real_extract(url)
  File "c:\program files\python37\lib\site-packages\youtube_dl\extractor\usanetwork.py", line 36, in _real_extract
    video_id = player_params['data-mpx-guid']
KeyError: 'data-mpx-guid'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\program files\python37\lib\site-packages\youtube_dl\YoutubeDL.py", line 796, in extract_info
    ie_result = ie.extract(url)
  File "c:\program files\python37\lib\site-packages\youtube_dl\extractor\common.py", line 543, in extract
    raise ExtractorError('An extractor error has occurred.', cause=e)
youtube_dl.utils.ExtractorError: An extractor error has occurred. (caused by KeyError('data-mpx-guid')); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Description

Did USA Networks change something so Youtube-dl no longer works? See log below. It worked on 8/8/2019 with the youtube-dl version 2019.08.02.

Any ideas?

@F4ckLogins
Copy link

@F4ckLogins F4ckLogins commented Aug 15, 2019

Same issue - gets stuck on "ERROR: An extractor error has occurred. (caused by KeyError('data-mpx-guid',));"

@F4ckLogins
Copy link

@F4ckLogins F4ckLogins commented Aug 15, 2019

Is there a way to manually download from site? Dumping m3u8 from playback is erroring out at about 30 seconds. Something about ads

@tv21
Copy link

@tv21 tv21 commented Aug 15, 2019

I'm seeing the same issue and I am running the program under Ubuntu Linux, not Windows, but I get nearly identical errors. It worked last week but not last night, and if there's a way to manually d/l without it erroring out I sure haven't been able to figure out how. It plays fine in a browser but any method I know of to d/l seems totally broken.

@tv21 tv21 mentioned this issue Aug 15, 2019
4 of 8 tasks complete
@netuser0
Copy link
Author

@netuser0 netuser0 commented Aug 16, 2019

F4ckLogins, I could not find a valid m3u8. The m3u8 I did find did not contain any ts video links or embedded link to the real m3u8

@netuser0
Copy link
Author

@netuser0 netuser0 commented Aug 17, 2019

Hi everyone, I found a work around method that allows downloading the video with the generic Youtube-dl extractor. I am not sure if the method would violate the forum rules or not. It involves modifying the m3u8 file, then using a web server, like IIS, to download the video. Let me know if anyone is interested.

@netuser0
Copy link
Author

@netuser0 netuser0 commented Aug 18, 2019

I just uninstalled the youtube-dl 2019.08.13 and then installed youtube-dl 2019.08.02. I still get the same error. Must not version related. See below.


[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-o', 'Suits S09E05.mp4', '--ap-mso', 'Comcast_SSO', '--ap-username', 'PRIVATE', '--ap-password', 'PRIVATE', '--hls-prefer-native', '-v', 'https://www.usanetwork.com/suits/videos/if-the-shoe-fits']
[debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252
[debug] youtube-dl version 2019.08.02
[debug] Python version 3.7.3 (CPython) - Windows-10-10.0.18362-SP0
[debug] exe versions: ffmpeg N-94452-g9af8ce754b, ffprobe N-94452-g9af8ce754b
[debug] Proxy map: {}
[USANetwork] if-the-shoe-fits: Downloading webpage
ERROR: An extractor error has occurred. (caused by KeyError('data-mpx-guid')); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
File "C:\Program Files\Python37\lib\site-packages\youtube_dl\extractor\common.py", line 530, in extract
ie_result = self._real_extract(url)
File "C:\Program Files\Python37\lib\site-packages\youtube_dl\extractor\usanetwork.py", line 36, in _real_extract
video_id = player_params['data-mpx-guid']
KeyError: 'data-mpx-guid'
Traceback (most recent call last):
File "C:\Program Files\Python37\lib\site-packages\youtube_dl\extractor\common.py", line 530, in extract
ie_result = self._real_extract(url)
File "C:\Program Files\Python37\lib\site-packages\youtube_dl\extractor\usanetwork.py", line 36, in _real_extract
video_id = player_params['data-mpx-guid']
KeyError: 'data-mpx-guid'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Program Files\Python37\lib\site-packages\youtube_dl\YoutubeDL.py", line 796, in extract_info
ie_result = ie.extract(url)
File "C:\Program Files\Python37\lib\site-packages\youtube_dl\extractor\common.py", line 543, in extract
raise ExtractorError('An extractor error has occurred.', cause=e)
youtube_dl.utils.ExtractorError: An extractor error has occurred. (caused by KeyError('data-mpx-guid')); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

@Mr-Jake
Copy link

@Mr-Jake Mr-Jake commented Aug 19, 2019

How did you find the m3u? I tried to locate it in the Firefox console, but could only locate the advertisement.

@netuser0
Copy link
Author

@netuser0 netuser0 commented Aug 19, 2019

I used Video DownloadHelper (https://www.downloadhelper.net/) to get the m3u8 link, then just paste the link into the browser's address bar and save the m3u8. Click Details on the video you want and page will be displayed with the correct m3u8 link in the section called mediaManifest. BTW, the Video DownloadHelper does not correctly download the video either. Let me know if you need any more help.

@Mr-Jake
Copy link

@Mr-Jake Mr-Jake commented Aug 19, 2019

So I compared the current video page to the old video page from archive.org wayback machine.

It looks like they moved 'data-mpx-guid' from class="player-wrapper" to class="video-player-wrapper section-player".

The youtube-dl extractor is searching for 'data-usa-tve-player-container', but 'data-mpx-guid' is no longer in that class.

@netuser0
Copy link
Author

@netuser0 netuser0 commented Aug 19, 2019

Sounds like you figured out the issue. Do you have any idea how to fix the youtube-dl code so it works correctly? I have no clue.

@tv21
Copy link

@tv21 tv21 commented Aug 22, 2019

Hi everyone, I found a work around method that allows downloading the video with the generic Youtube-dl extractor. I am not sure if the method would violate the forum rules or not. It involves modifying the m3u8 file, then using a web server, like IIS, to download the video. Let me know if anyone is interested.

I'd be interested to know your technique, though I don't get the part about needing a web server!

@tv21
Copy link

@tv21 tv21 commented Aug 22, 2019

So I compared the current video page to the old video page from archive.org wayback machine.

It looks like they moved 'data-mpx-guid' from class="player-wrapper" to class="video-player-wrapper section-player".

The youtube-dl extractor is searching for 'data-usa-tve-player-container', but 'data-mpx-guid' is no longer in that class.

In looking at the source code, I see this:

    def _real_extract(self, url):
        display_id = self._match_id(url)
        webpage = self._download_webpage(url, display_id)

        player_params = extract_attributes(self._search_regex(
            r'(<div[^>]+data-usa-tve-player-container[^>]*>)', webpage, 'player params'))
        video_id = player_params['data-mpx-guid']
        title = player_params['data-episode-title']

But I see no reference here or anywhere else to "player-wrapper". I do see references to both "data-usa-tve-player-container" and "data-mpx-guid" but can't figure out what would need to be changed to reference these in the new location (class?). Then again, I am not a programmer, so I'm kind of stumbling in the dark here. Any ideas?

@netuser0
Copy link
Author

@netuser0 netuser0 commented Aug 22, 2019

Hi everyone, here is a workaround for downloading video from USA Networks using the youtube-dl generic extractor.

Step 1:

Find and download m3u8 file for the video that you wish to download.

Copied from above:

I used Video DownloadHelper (https://www.downloadhelper.net/) to get the m3u8 link, then just paste the link into the browser's address bar and save the m3u8. Click Details on the video you want and page will be displayed with the correct m3u8 link in the section called mediaManifest. BTW, the Video DownloadHelper does not correctly download the video either.

Step 2:

Open the m3u8 file any text editor.

Delete every line beginning with #EXTINF that has /video/ in the URL, stop deleting lines when you find the next #EXT-X-DISCONTINUITY. Do not delete the next #EXT-X-DISCONTINUITY. Repeat for the whole m3u8 file.

Delete every line beginning with #EXTINF that has /ads/ in the URL, stop deleting lines when you find the next #EXT-X-DISCONTINUITY. Do not delete the next #EXT-X-DISCONTINUITY. Repeat for the whole m3u8 file.

Keep the sections with #EXTINF that has /tve-adstitch/ in the URL.

Step 3:

With IIS installed move the modified m3u8 file to C:\inetpub\wwwroot. Now, run youtube-dl.exe --hls-prefer-native -v http://localhost/yourfile.m3u8 to download the video.

I choose IIS since it is included in Windows 10 Professional. I am not sure if IIS is available in Windows 10 Home, but if IIS is available, the following web site give details on how to install IIS.

https://helpdeskgeek.com/windows-10/install-and-setup-a-website-in-iis-on-windows-10/

IIS (or whichever web server chosen) must have the m3u8 mime type configured properly. For IIS see https://forums.iis.net/post/1973054.aspx and https://docs.microsoft.com/en-us/iis/configuration/system.webserver/staticcontent/mimemap. On the https://docs.microsoft.com/en-us/iis/configuration/system.webserver/staticcontent/mimemap only follow the instructions up to the Configure section.

Let me know if you need any more help.

@Mr-Jake
Copy link

@Mr-Jake Mr-Jake commented Aug 22, 2019

But I see no reference here or anywhere else to "player-wrapper".

The source code of the web page the video is on.

@netuser0
Copy link
Author

@netuser0 netuser0 commented Aug 23, 2019

Does the project staff plan to address this issue? I do not understand why the issue has not been acknowledged by the project staff. It has been 8 days since the issue has been open.

@ajfredrickson15
Copy link

@ajfredrickson15 ajfredrickson15 commented Aug 23, 2019

@netuser0, nice write-up, but you do not need a webserver to complete the download. You can just use ffmpeg directly.

ffmpeg -protocol_whitelist "file,http,https,tcp,tls" -i /path/to/file.m3u8 -c copy /path/to/new/file.mp4

@netuser0
Copy link
Author

@netuser0 netuser0 commented Aug 23, 2019

@netuser0, nice write-up, but you do not need a webserver to complete the download. You can just use ffmpeg directly.

ffmpeg -protocol_whitelist "file,http,https,tcp,tls" -i /path/to/file.m3u8 -c copy /path/to/new/file.mp4

Thanks for the tip. I did not know that ffmpeg could do that. Should have known, since ffmpeg does a lot of cool things.

@netuser0
Copy link
Author

@netuser0 netuser0 commented Aug 23, 2019

@netuser0, nice write-up, but you do not need a webserver to complete the download. You can just use ffmpeg directly.

ffmpeg -protocol_whitelist "file,http,https,tcp,tls" -i /path/to/file.m3u8 -c copy /path/to/new/file.mp4

I did use ffmpeg as you suggested; however, ffmpeg did not process the video correctly. When ffmpeg finished downloading the video, it only processed 12 minutes of the video; however, the video is supposed to be 42 minutes. It gave a lot of errors like:

[mp4 @ 000001ca694237c0] Non-monotonous DTS in output stream 0:1; previous: 20225562, current: 20184064; changing to 20225563. This may result in incorrect timestamps in the output file.

The native youtube-dl downloader did process the video correctly. So, at least for me, using youtube-dl and the web server works best.

@The-Bart-The
Copy link

@The-Bart-The The-Bart-The commented Aug 24, 2019

No need to have or install a web server,

If you have Dropbox installed, save the *.m3u8 file in your Dropbox folder.

Right click the file and select "Copy Dropbox link" (the Dropbox servers already have the MIME type for *.m3u8 configured correctly).

Paste in the URL, to your YouTube-DL command-line.

Change ?dl=0 to ?dl=1

Run YouTube-DL as usual.

@dadho
Copy link

@dadho dadho commented Aug 24, 2019

No need to have or install a web server,

If you have Dropbox installed, save the *.m3u8 file in your Dropbox folder.

Right click the file and select "Copy Dropbox link" (the Dropbox servers already have the MIME type for *.m3u8 configured correctly).

Paste in the URL, to your YouTube-DL command-line.

Change ?dl=0 to ?dl=1

Run YouTube-DL as usual.

i tried but te file is only 11m lenght.. its a big file but playing only apears 11minutes.

regards

@tv21
Copy link

@tv21 tv21 commented Aug 24, 2019

netuser0 thanks for the writeup, your method does appear to work but the shortcut using ffmpeg didn't for me, and I didn't try Dropbox as I don't use it. I found that under Linux you can use wget -O temporary.m3u8 -nc "filename in quotation marks.m3u8" to get the m3u8 file (saved to "temporary.m3u8" in this example), no need to open it in a browser.

There should be some way to create a script to remove the lines in the m3u8 file so you don't have to do it manually, if they were just single lines you could use sed I think, but the lines come in pairs with the first line being "#EXTINF:" (followed by one or more numbers) and then the following line is the url and I'm assuming you have to remove both. I'm not well-versed enough in the ways of Linux to know how to do that off the top of my head, but theoretically you could create a script that would download the m3u8 (using wget), and discard the lines containing the patterns and the EXTINF lines that precede them.

EDIT: I could not figure out how to make sed work but here is what for an actual programmer would have been a quick and dirty bash script, for me it kept me up half the night because I had to look up how to do every single thing and still kept getting errors. It assumes you have used the wget command I mentioned above and now have a temporary.m3u8 file.

#!/bin/bash
linepre=''
while read line
do case $line in
  "#EXTINF:"*)
    linepre=$line
    read line
    case $line in
      "https://"*)
        case $line in
          *"/video/"*)
          ;;
          *"/ads/"*)
          ;;
          *)
          echo $linepre
          echo $line
          ;;
        esac
        ;;
      *)
        echo $linepre
        echo $line
        ;;
    esac
    ;;
  *)
    echo $line
    ;;
esac
done < ~/temporary.m3u8

I'm sure there far are better ways to do this, but this example bash script looks for lines that begin with "#EXTINF:", then looks to see if the following line begins with "httos://" and if it does then it looks to see if that line contains either "/video/" or "/ads/", if all those are true then it drops those two lines, otherwise it echoes everything else to the screen, so use redirection to send the output to another file. So for example, ./scriptname.sh > newtemp.m3u8 and then use newtemp.m3u8 on the web server. Be sure to make the script executable or you'll get a permission denied error. No guarantees or warranties, this is an example script only and may or may not work as intended - I am not a programmer and don't know what I'm doing!!!

@netuser0
Copy link
Author

@netuser0 netuser0 commented Aug 24, 2019

No need to have or install a web server,
If you have Dropbox installed, save the *.m3u8 file in your Dropbox folder.
Right click the file and select "Copy Dropbox link" (the Dropbox servers already have the MIME type for *.m3u8 configured correctly).
Paste in the URL, to your YouTube-DL command-line.
Change ?dl=0 to ?dl=1
Run YouTube-DL as usual.

i tried but te file is only 11m lenght.. its a big file but playing only apears 11minutes.

regards

Did you modify the m3u8 file per Step 2 of the workaround? If you do not remove the lines that contains "/video/" and "/ads/," then the video will be corrupted.

@netuser0
Copy link
Author

@netuser0 netuser0 commented Aug 24, 2019

tv21,

Thanks posting your script. I would try the script, but I do not use Linux. I have no clue how to script something equivalent in Windows. If someone wants to make something to do as your Linux script does for Windows, then that certainly would be helpful.

@netuser0
Copy link
Author

@netuser0 netuser0 commented Aug 24, 2019

Does anyone have any idea how to draw the attention of project coders to this issue?

@tv21
Copy link

@tv21 tv21 commented Aug 24, 2019

netuser0, I don't use Windows so we are not really on the same platform. But, I was under the impression that Windows could run bash scripts. I searched on "How to run a bash script in Windows" and got many results, for example https://www.howtogeek.com/261591/how-to-create-and-run-bash-shell-scripts-on-windows-10/

Depending on what version of Windows you are running you may need to install additional software such as Cygwin but I was under the impression that Bash is available natively in Windows 10. Look it up in a search engine and you will likely find a method that works in your particular version. Do be aware of the difference in line ending characters between Windows and Linux, although I think if you copy text from this page in your browser it will use the correct line endings for Windows if you're running Windows, at least I'd hope so!

@ajfredrickson15
Copy link

@ajfredrickson15 ajfredrickson15 commented Aug 24, 2019

@netuser0 and @tv21, python is a little more supported under both OSes. An equivalent python script attached.

#!/usr/bin/env python3

# Comments
import sys

inputfile = sys.argv[1]
outputfile = sys.argv[2]

bad_words = ['/video/', '/ads/']

with open(inputfile) as oldfile, open(outputfile, 'w') as newfile:
        lines = oldfile.readlines()
        for i in range(0, len(lines)):
                line = lines[i]
                if not(i == (len(lines) - 1)):
                        next_line = lines[i+1]
                if line.startswith('#EXTINF') and (not any(bad_word in next_line for bad_word in bad_words)):
                        newfile.write(line)
                        newfile.write(next_line)
                elif not(line.startswith('#EXTINF')) and not(line.startswith('http')):
                        newfile.write(line)

Run with something like the following:
python /path/to/usa.py /path/to/test.m3u8 path/to/test_new.m3u8

@netuser0
Copy link
Author

@netuser0 netuser0 commented Aug 24, 2019

@netuser0 and @tv21, python is a little more supported under both OSes. An equivalent python script attached.

#!/usr/bin/env python3

# Comments
import sys

inputfile = sys.argv[1]
outputfile = sys.argv[2]

bad_words = ['/video/', '/ads/']

with open(inputfile) as oldfile, open(outputfile, 'w') as newfile:
        lines = oldfile.readlines()
        for i in range(0, len(lines)):
                line = lines[i]
                if not(i == (len(lines) - 1)):
                        next_line = lines[i+1]
                if line.startswith('#EXTINF') and (not any(bad_word in next_line for bad_word in bad_words)):
                        newfile.write(line)
                        newfile.write(next_line)
                elif not(line.startswith('#EXTINF')) and not(line.startswith('http')):
                        newfile.write(line)

Run with something like the following:
python /path/to/usa.py /path/to/test.m3u8 path/to/test_new.m3u8

@ajfredrickson15, your python script worked perfectly. I did noticed it did leave multiple #EXT-X-DISCONTINUITY lines behind, but I guess it does not matter since it was exactly the same file size as the one I downloaded before when I deleted the line by hand.

@tv21, I appreciate your help regarding running bash scripts in Windows, but, for me, ajfredrickson15's python script is much easier to implement.

Thanks a lot to both of you. We now have a Linux and a Windows solution.

@netuser0
Copy link
Author

@netuser0 netuser0 commented Aug 24, 2019

@ajfredrickson15, could you write a python script for Fox? I looked the m3u8 file and it seem like the code for script would need more scripting than than just changing the "bad_words" per your usa script.

If you do not want do this, then I completely understand, but I have to manually delete ads from the m3u8 on Fox videos when a script could easily do delete the ad lines.

I just need to learn to script. :-)

@netuser0
Copy link
Author

@netuser0 netuser0 commented Aug 24, 2019

@ajfredrickson15, could you write a python script for Fox? I looked the m3u8 file and it seem like the code for script would need more scripting than than just changing the "bad_words" per your usa script.

If you do not want do this, then I completely understand, but I have to manually delete ads from the m3u8 on Fox videos when a script could easily do delete the ad lines.

I just need to learn to script. :-)

@ajfredrickson15, never mind I just figured out that youtube-dl will remove the Fox ads automatically. I just had to paste in the link to the m3u8. :-)

@tv21
Copy link

@tv21 tv21 commented Aug 25, 2019

ajfredrickson15 thanks but the bash script I wound up with after some more work yesterday eliminates the need to use Video DownloadHelper. The way it works is you need to open the Developer Tools console network tab and filter on m3u8 and begin playing the video, then copy the URL of first link that appears. Using that as an argument to the script, it will find the link by downloading that m3u8 (using wget -O temporary.m3u8 -nc -q "$1"), and searching the downloaded file for a line that begins with "#EXT-X-STREAM-INF:BANDWIDTH=" and also contains the string "RESOLUTION=1920x1080". When it finds that line it reads the next line, checks to make sure it begins with "https://", and then uses that as the target of another wget (after deleting the original temporary.m3u8 file). I believe (but haven fully tested) that this gives you the same file that you would get using Video DownloadHelper. You do have to be fairly quick about copying and pasting the link from the Developer Tools because it seems to expire very quickly (possibly one minute?). I am sure you could do this in Python also but I don't know Python well enough to modify your script. The lines I added (between "#!/bin/bash" and "linepre=''") were:

wget -O temporary.m3u8 -nc -q "$1" || { echo "Error retrieving m3u8 file"; exit 1; }

while read line
do case $line in
  "#EXT-X-STREAM-INF:BANDWIDTH="*)
    case $line in
      *"RESOLUTION=1920x1080"*)
        read line
        case $line in
          "https://"*)
          success=true
          break
          ;;
          *)
          echo "Expected URL not found - aborting script"
          exit 1
          ;;
        esac
        ;;
      *)
      ;;
    esac
    ;;
  *)
  ;;
esac
done < temporary.m3u8

rm temporary.m3u8

if [ "$success" != "true" ]
then
  echo "Stream information not found - has the link expired? - aborting script"
  exit 1
fi

wget -O temporary.m3u8 -nc -q "$line" || { echo "Error retrieving secondary m3u8 file"; exit 1; }

(EDITED a couple times after posting to add error trap if the link has expired or the desired stream isn't present, and then fix it because I did it wrong, and also fix a couple other bits of bad code. I'm still not certain it's 100% correct.)

This addition to the script has not been fully tested yet, and yes I know this is probably a horrible way to do it, using the case statement in this way, but when the only tool you have is a hammer... as I said I am not a programmer. If you would care to add something like this to your Python script I'd definitely try it. I just don't like the idea of having to leave Video DownloadHelper installed because I would only need it for this one thing, and I don't know if it is "phoning home" with any information about the sites I visit.

With that problem solved the only other thing would be to figure out how to use the modified m3u8 without needing to use an external server. There are so many options available in youtube-dl that I'm wondering if any would allow it to read the m3u8 file directly, and to assume the correct m3u8 mime type if that is the issue. You would THINK there would be some way to pass it a link to a file rather than a URL; I know in a browser you can use a link that starts with file:// followed by a link but if you try that it gives an error message like...

WARNING: Could not send HEAD request to file:///home/username/filename.m3u8: <urlopen error file:// scheme is explicitly disabled in youtube-dl for security reasons>

Apparently this is disallowed because of the security vulnerability discussed at #8227 so I am not sure if there is any solution that doesn't involve using an outside server. Personally I kind of wish there were a command line option to override this check and allow using file:// in instances where you know what you are doing, but then again that would require actually reading every m3u8 file you create to make sure it doesn't contain anything malicious, and in any case I don't know if that would actually work. The code that disallows the use of file:// is in YoutubeDL.py (search for "scheme is explicitly disabled in youtube-dl for security reasons" to find it) and it looks like if you removed that check it might work, and if you read down a few lines there is a comment about using the --encoding option which (according to the help text) will "Force the specified encoding (experimental)" which MIGHT allow specifying the mime type in some way??? But, since this is all Python code I don't really understand it, so if anyone who does get Python wants to experiment, that might be a place to start. I can certainly understand, and very much appreciate the program developers wanting to protect us from security risks, but on the other hand I am really curious what would happen if that check for file:// weren't there, and we could tell the program to use the m3u8 directly without having to put it on an external server.

@netuser0
Copy link
Author

@netuser0 netuser0 commented Aug 25, 2019

@tv21, I think what you outlined in your last post is the ideal way to tackle the issue. All we need now is someone with python experience to work with you to come up with a solution.

Thank you for all your efforts.

@tv21
Copy link

@tv21 tv21 commented Aug 25, 2019

This may or may not be helpful to anyone trying to make further progress:

Tech Tip: Really Simple HTTP Server with Python

If it doesn't work it may be because of the mime type thing, which I really don't understand at all. But my thought was that maybe in Python you can create a mini-http server on the fly, then it would be removed when the script ends, after youtube-dl is run? No idea, just a thought.

@netuser0
Copy link
Author

@netuser0 netuser0 commented Aug 25, 2019

I wonder if @dstftw (a major youtube-dl project contributor) has seen this thread?

@tv21
Copy link

@tv21 tv21 commented Aug 25, 2019

netuser0, you may as well give it up trying to get the attention of anyone that can fix this - I'm sure they've already seen this thread and my suspicion is that they don't care and you're just annoying them. There are far more longstanding bugs than this one, in some cases for which people have contributed the exact code needed to fix them, and still they remain unfixed (example see #11258 which affects every Comcast user).

I suspect that youtube-dl is one of those pieces of software where the developers are probably burned out and tired of making changes, since sites are continuously changing the layout of their download pages and their download methods, and because it is free software and the developers aren't getting paid to do this, they feel no obligation or incentive to hurry up and fix something just because a user may want it. If you wait patiently they may eventually fix it, but if you go out of your way to annoy them, that could have the opposite effect of what you want. How would you feel if you had authored a software project, and every time you had a spare moment there was a whole pile of things that needed to be fixed, and people complaining that you weren't fixing them fast enough? You might just be inclined to go take a nice long walk in the sunshine and let all the ingrates fend for themselves!

Just be happy that they do make fixes at their convenience, even if it takes a while!

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 25, 2019

I'll repeat it 1001 time: for any work on such issues you must provide tv account credentials. Until you do that it neither possible for us to fix nor review and check ones contributions.

@ytdl-org ytdl-org locked and limited conversation to collaborators Aug 25, 2019
@dstftw dstftw closed this in 183a18c Aug 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
8 participants
You can’t perform that action at this time.