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

Viu OTT extractor error (KeyError) #26701

Open
panda130 opened this issue Sep 25, 2020 · 24 comments · May be fixed by #26775
Open

Viu OTT extractor error (KeyError) #26701

panda130 opened this issue Sep 25, 2020 · 24 comments · May be fixed by #26775

Comments

@panda130
Copy link

@panda130 panda130 commented Sep 25, 2020

Checklist

  • I'm reporting a broken site support
  • I've verified that I'm running youtube-dl version 2020.09.20
  • 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: ['-i', '-v', 'https://www.viu.com/ott/sg/en-us/vod/233440/Hot-Stove-League']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.09.20
[debug] Python version 3.7.7 (CPython) - Darwin-16.7.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.1.4, ffprobe 4.1.4, phantomjs 2.1.1, rtmpdump 2.4
[debug] Proxy map: {}
[viu:ott] 233440: Downloading video info
[viu:ott] 233440: Downloading stream info
ERROR: An extractor error has occurred. (caused by KeyError('data')); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 532, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/viu.py", line 233, in _real_extract
    })['data']['stream']
KeyError: 'data'
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 532, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/viu.py", line 233, in _real_extract
    })['data']['stream']
KeyError: 'data'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 797, in extract_info
    ie_result = ie.extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 545, in extract
    raise ExtractorError('An extractor error has occurred.', cause=e)
youtube_dl.utils.ExtractorError: An extractor error has occurred. (caused by KeyError('data')); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Description

As of today, the Viu OTT extractor is no longer working. I have tried multiple server locations.

This issue is occurring with videos that are geo-restricted to both Singapore and Thailand. They are still accessible via web browser using a proxy.

Singapore sample: https://www.viu.com/ott/sg/en-us/vod/233440/Hot-Stove-League
Thailand sample: https://www.viu.com/ott/th/en-us/vod/165839/A-Poem-A-Day

This is really bad because Viu is one of the main sites for Asian TV dramas that are not available anywhere else. Thank you for your help!

@panda130
Copy link
Author

@panda130 panda130 commented Sep 25, 2020

@zackmark29 Thank you for replying. I do not believe that either of the sample episodes I mentioned are premium episodes because you can watch them via web browser without a subscription.

Something seems to have changed to stop youtube-dl from even seeing the available video formats. Using "--list-formats" is not working.

So what you are saying is that even if youtube-dl could see the available video formats, the HD quality videos will no longer be available? The HD quality videos were working via youtube-dl a couple of days ago.

@zackmark29
Copy link

@zackmark29 zackmark29 commented Sep 25, 2020

@zackmark29 Thank you for replying. I do not believe that either of the sample episodes I mentioned are premium episodes because you can watch them via web browser without a subscription.

Something seems to have changed to stop youtube-dl from even seeing the available video formats. Using "--list-formats" is not working.

So what you are saying is that even if youtube-dl could see the available video formats, the HD quality videos will no longer be available? The HD quality videos were working via youtube-dl a couple of days ago.

No, in my case, if I don't have premium account, youtube-dl can't be able to check the available format as well. Because the cookie id is required.

I'll check now with SG vpn. I'll update you in a minute

@zackmark29
Copy link

@zackmark29 zackmark29 commented Sep 25, 2020

I'm able to get all resolution with you're given sg link
image

@panda130
Copy link
Author

@panda130 panda130 commented Sep 25, 2020

@zackmark29 Thanks for following up. So it seems like all formats of the videos are still available. It's just that there is some syntax change on Viu's server side that the youtube-dl Viu extractor needs to compensate for.

@zackmark29
Copy link

@zackmark29 zackmark29 commented Sep 25, 2020

@zackmark29 Thanks for following up. So it seems like all formats of the videos are still available. It's just that there is some syntax change on Viu's server side that the youtube-dl Viu extractor needs to compensate for.

Yeah. If I just know Python I can edit it for you but I only know C#
@dstftw can do it for you

@Ashish0804
Copy link

@Ashish0804 Ashish0804 commented Sep 26, 2020

I'm able to get all resolution with you're given sg link
image

Is your C# tool available to public?

@zackmark29
Copy link

@zackmark29 zackmark29 commented Sep 26, 2020

I'm able to get all resolution with you're given sg link
image

Is your C# tool available to public?

No, this is just for personal use.

@Ashish0804
Copy link

@Ashish0804 Ashish0804 commented Sep 26, 2020

I'm able to get all resolution with you're given sg link
image

Is your C# tool available to public?

No, this is just for personal use.

can u share the extractor code? I can try and modify it for python

@zackmark29
Copy link

@zackmark29 zackmark29 commented Sep 26, 2020

I'm able to get all resolution with you're given sg link
image

Is your C# tool available to public?

No, this is just for personal use.

can u share the extractor code? I can try and modify it for python

I just tested again and I noticed this is the problem
Example url: https://www.viu.com/ott/sg/en-us/vod/233440/Hot-Stove-League

https://www.viu.com/ott/sg/index.php?r=vod/ajax-detail&platform_flag_label=web&area_id=2&language_flag_id=3&product_id=233440

to fix it should have &ut=2 at the end like this

https://www.viu.com/ott/sg/index.php?r=vod/ajax-detail&platform_flag_label=web&area_id=2&language_flag_id=3&product_id=233440&ut=2

And here's for the streams
https://d1k2us671qcoau.cloudfront.net/distribute_web_sg.php?ccs_product_id=9aceb6645dbdd1afa252581c2476af8f&language_flag_id=3

for some premium videos sometimes token is required to get the streams.

https://d1k2us671qcoau.cloudfront.net/distribute_web_sg.php?ccs_product_id=9aceb6645dbdd1afa252581c2476af8f&language_flag_id=3&identity=6398e7db08dab6cdc285cdf26656723c31888c2e

Let me know if you needed more.

@panda130 panda130 mentioned this issue Sep 26, 2020
5 of 9 tasks complete
@panda130
Copy link
Author

@panda130 panda130 commented Sep 26, 2020

@zackmark29 Yay! Thank you so much! Based on your observation, I fixed the viu.py extractor by adding in the 'language_flag_id' and the 'ut' into the query. I am not a programmer, and this is the first time I have ever done anything in Python...

I have also submitted my first-ever pull request.

@zackmark29
Copy link

@zackmark29 zackmark29 commented Sep 27, 2020

@zackmark29 Yay! Thank you so much! Based on your observation, I fixed the viu.py extractor by adding in the 'language_flag_id' and the 'ut' into the query. I am not a programmer, and this is the first time I have ever done anything in Python...

I have also submitted my first-ever pull request.

Wow that's great! so is it work now?
I hope I also know how to modify python from youtube-dl extractor.

@zackmark29
Copy link

@zackmark29 zackmark29 commented Sep 27, 2020

But the ut i think it depends on the region. In my country (PH) it's ut=0 and for SG it's ut=2

@panda130
Copy link
Author

@panda130 panda130 commented Sep 27, 2020

@zackmark29 I did some more testing. I actually removed the ut part of the query, and the extractor still works. So ut does not seem to be necessary.

There are a couple of remaining issues.

  1. After I made the "language_flag_id" change to the query, the Viu extractor is only working for Singapore videos. For some reason, it does not work with Thailand videos. Can you find the correct video URL format for the Thailand videos? Sample URL: https://www.viu.com/ott/th/en-us/vod/165839/A-Poem-A-Day

  2. The extractor is no longer working for Premium videos. It used to work for Premium videos.

@zackmark29
Copy link

@zackmark29 zackmark29 commented Sep 29, 2020

@zackmark29 I did some more testing. I actually removed the ut part of the query, and the extractor still works. So ut does not seem to be necessary.

There are a couple of remaining issues.

  1. After I made the "language_flag_id" change to the query, the Viu extractor is only working for Singapore videos. For some reason, it does not work with Thailand videos. Can you find the correct video URL format for the Thailand videos? Sample URL: https://www.viu.com/ott/th/en-us/vod/165839/A-Poem-A-Day
  2. The extractor is no longer working for Premium videos. It used to work for Premium videos.

In PH, ut is needed.
But I'll look into it later.

@touchhyuk
Copy link

@touchhyuk touchhyuk commented Sep 29, 2020

how can i download from viu with viu.py? i did install python but i can't run viu python. please guide

@panda130
Copy link
Author

@panda130 panda130 commented Sep 30, 2020

@touchhyuk I assume that you've already downloaded the youtube-dl master source code. You'll need to make the modifications to viu.py that are listed in my pull request.

Then you have to recompile youtube-dl.

In your bash terminal, set your current directory to the root folder of the youtube-dl master source code. For instance, if you downloaded the youtube-dl source code to your Downloads folder, you might have to set your current directory to "/Users/USERNAMEHERE/Downloads/youtube-dl-master" by typing "cd /Users/USERNAMEHERE/Downloads/youtube-dl-master" in your bash terminal.

Then enter the command "make" in your bash terminal. There will be an executable binary file created called "youtube-dl". Move that "youtube-dl" binary file to wherever your computer normally stores the youtube-dl binary file. Use the terminal command "which youtube-dl" if you need to find out where that is.

@touchhyuk
Copy link

@touchhyuk touchhyuk commented Sep 30, 2020

@touchhyuk I assume that you've already downloaded the youtube-dl master source code. You'll need to make the modifications to viu.py that are listed in my pull request.

Then you have to recompile youtube-dl.

In your bash terminal, set your current directory to the root folder of the youtube-dl master source code. For instance, if you downloaded the youtube-dl source code to your Downloads folder, you might have to set your current directory to "/Users/USERNAMEHERE/Downloads/youtube-dl-master" by typing "cd /Users/USERNAMEHERE/Downloads/youtube-dl-master" in your bash terminal.

Then enter the command "make" in your bash terminal. There will be an executable binary file created called "youtube-dl". Move that "youtube-dl" binary file to wherever your computer normally stores the youtube-dl binary file. Use the terminal command "which youtube-dl" if you need to find out where that is.

i cant run make command
got this error

C:\Users\Administrator\Downloads\youtube-dl-master>make
'make' is not recognized as an internal or external command,
operable program or batch file.

@panda130
Copy link
Author

@panda130 panda130 commented Oct 2, 2020

@touchhyuk I am sorry to hear that. I don't use Windows so I'm afraid I can't help with this particular problem. It seems to be a permissions issue. Please try asking on the Reddit or stack exchange page.

See this link:
https://stackoverflow.com/questions/55561387/how-to-rebuild-python-youtube-dl-from-the-source

@lkho
Copy link
Contributor

@lkho lkho commented Oct 2, 2020

@touchhyuk If you just want to run youtube-dl with python interpreter (which you have already downloaded), there is no need to recompile or rebuild a standalone exe. Just follow the developer instructions will work.

@lkho
Copy link
Contributor

@lkho lkho commented Oct 2, 2020

@panda130 @zackmark29 for your reference

In my country (HK), ut is also 0, area_id = 1, language_flag_id = 1 for zh-hk, 3 for en-us

@touchhyuk
Copy link

@touchhyuk touchhyuk commented Oct 2, 2020

@touchhyuk If you just want to run youtube-dl with python interpreter (which you have already downloaded), there is no need to recompile or rebuild a standalone exe. Just follow the developer instructions will work.

i cant please giive your discord id or telegram id

@touchhyuk
Copy link

@touchhyuk touchhyuk commented Oct 2, 2020

please someone fix youtube-dl.exe with viu.py and send here. i want downloaf from viu and tried a week but cant fix

@zackmark29
Copy link

@zackmark29 zackmark29 commented Oct 4, 2020

please someone fix youtube-dl.exe with viu.py and send here. i want downloaf from viu and tried a week but cant fix

You could try to follow my instruction from this
#26788

@lkho lkho linked a pull request that will close this issue Oct 15, 2020
6 of 6 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

5 participants
You can’t perform that action at this time.