Skip to content
This repository has been archived by the owner on Oct 25, 2020. It is now read-only.

Handle copyright claimed URLs correctly #36

Closed
Greek opened this issue Nov 22, 2019 · 2 comments
Closed

Handle copyright claimed URLs correctly #36

Greek opened this issue Nov 22, 2019 · 2 comments

Comments

@Greek
Copy link

Greek commented Nov 22, 2019

yturling links that are claimed will output this error:

C:\Users\Andreas-PC>yturl https://www.youtube.com/watch?v=HZ3xJ6YiyqE
Traceback (most recent call last):
  File "C:\Users\Andreas-PC\AppData\Local\Programs\Python\Python37-32\Scripts\yturl-script.py", line 11, in <module>
    load_entry_point('yturl==2.0.2', 'console_scripts', 'yturl')()
  File "c:\users\andreas-pc\appdata\local\programs\python\python37-32\lib\site-packages\yturl.py", line 151, in main
    itag_to_url_map = itags_for_video(args.video_id)
  File "c:\users\andreas-pc\appdata\local\programs\python\python37-32\lib\site-packages\yturl.py", line 79, in itags_for_video
    streams = api_response["url_encoded_fmt_stream_map"].split(",")
KeyError: 'url_encoded_fmt_stream_map'

there should be a way to find a way around this, a couple of links that were claimed I checked worked fine when I input them into this Glitch project. This might be related to #4..

@sskras
Copy link

sskras commented Jan 15, 2020

I am having similar traceback on Msys2 (POSIX on Windows) with Python2:

$ yturl https://www.youtube.com/watch?v=im004pekphs
Traceback (most recent call last):
  File "/usr/bin/yturl", line 11, in <module>
    load_entry_point('yturl==2.0.2', 'console_scripts', 'yturl')()
  File "/usr/lib/python2.7/site-packages/yturl.py", line 147, in main
    itag_to_url_map = itags_for_video(args.video_id)
  File "/usr/lib/python2.7/site-packages/yturl.py", line 80, in itags_for_video
    streams = api_response['url_encoded_fmt_stream_map'].split(',')
KeyError: u'url_encoded_fmt_stream_map'

Yesterday it worked fine.
I have no direct output but it looked that way when passed to mpv player:

$ /mingw64/bin/mpv --no-video $(yturl https://www.youtube.com/watch?v=im004pekphs)
Using itag 18.
Playing: https://r1---sn-uxv-8ovs.googlevideo.com/videoplayback?expire=1579024081&ei=caodXuiqHdOEv_IPuPykuAY&ip=88.118.134.152&id=o-AObJ5zvJCG6PDLBYcuCHEVgBVjoh9xlJlaMC0AXJLHE7&itag=18&source=youtube&requiressl=y
es&mm=31%2C29&mn=sn-uxv-8ovs%2Csn-f5f7ln7y&ms=au%2Crdu&mv=m&mvi=0&pcm2cms=yes&pl=18&initcwndbps=1496250&vprv=1&mime=video%2Fmp4&gir=yes&clen=122158605&ratebypass=yes&dur=2963.260&lmt=1554481469939316&mt=157900240
9&fvip=1&fexp=23842630&c=WEB&txp=5531432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cratebypass%2Cdur%2Clmt&sig=ALgxI2wwRQIhANN8KygFa0sndOFF3Udvkp1lfDHHNTZiGXCF1D7Bodic
AiB4kDx76nvUj2B37wCGJqgTHSGW0joWGtLlmjyxytxoIA%3D%3D&lsparams=mm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpcm2cms%2Cpl%2Cinitcwndbps&lsig=AHylml4wRQIhAP1jMPZtfQFf4nz58okhzUClXvBo2Y-ewzNiAJ5w4hfdAiAj4mjHXTZBkUUr4ImI_gO1JDCiLv2jKm4G
TM4pfckQ8w%3D%3D
     Video --vid=1 (*) (h264 640x360 30.000fps)
 (+) Audio --aid=1 (*) (aac 2ch 44100Hz)
AO: [wasapi] 48000Hz stereo 2ch float
A: 00:00:03 / 00:49:23 (0%) Cache: 1253s+36MB 

@cdown
Copy link
Owner

cdown commented Jan 21, 2020

YouTube appears to be backfilling more and more videos over to DASH and other segmented formats, I'm afraid. Until someone does the work to define how this should look, yturl won't support these.

I made this error more clear in 61c0a32.

@cdown cdown closed this as completed Jan 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants