Skip to content

Commit

Permalink
n-resp
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkf committed Mar 2, 2023
1 parent b076402 commit b0b53e8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions youtube_dl/extractor/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -1712,8 +1712,9 @@ def _unthrottle_format_urls(self, video_id, player_url, formats):
if n_response is None:
# give up if descrambling failed
break
fmt['url'] = update_url(
parsed_fmt_url, query_update={'n': [n_response]})
for fmt_dct in traverse_obj(fmt, (None, (None, ('fragments', Ellipsis))), expected_type=dict):
fmt_dct['url'] = update_url(
fmt_dct['url'], query_update={'n': [n_response]})

# from yt-dlp, with tweaks
def _extract_signature_timestamp(self, video_id, player_url, ytcfg=None, fatal=False):
Expand Down

9 comments on commit b0b53e8

@Vangelis66
Copy link

@Vangelis66 Vangelis66 commented on b0b53e8 Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... Code snapshot dirkf-youtube-dl-newmaster-git-20230302-gb0b53e8 works for me on py3.4:

yt-dl -f 140-1 "p7FCgw_GlWc" => 

[youtube] p7FCgw_GlWc: Downloading webpage
[youtube] Confirming age
[youtube] p7FCgw_GlWc: Downloading API JSON
[dashsegments] Total fragments: 1
[download] Destination: Kanye West - Famous-p7FCgw_GlWc.m4a
[download] 100% of 9.83MiB in 00:07
[ffmpeg] Correcting container in "Kanye West - Famous-p7FCgw_GlWc.m4a"

FWIW, previous code snapshot dirkf-youtube-dl-newmaster-git-20230301-gb076402 doesn't work on its own, but it does when the @u-n-k-n-o-w-n patch has been applied (it doesn't use traverse_obj)

BTW, have you noticed that the audio-only formats now come in *-0 and *-1 variants?
EDIT: Seems to occur only on age-gated videoIDs (e.g. "p7FCgw_GlWc" above) ...

@Vangelis66
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

py2.7 also seems to work as expected 😄 ; running on browser-downloaded source, file version.py manually modified 😉 :

youtube-dl -vf 140-1 "p7FCgw_GlWc" --fixup never => 

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-vf', u'140-1', u'p7FCgw_GlWc', u'--fixup', u'never']
[debug] Encodings: locale cp1253, fs mbcs, out cp737, pref cp1253
[debug] youtube-dl version 2023.03.02 (git-b0b53e892)
[debug] Python version 2.7.18 (CPython) - Windows-Vista-6.0.6003-SP2
[debug] exe versions: none
[debug] Proxy map: {}
[youtube] p7FCgw_GlWc: Downloading webpage
[youtube] Confirming age
[youtube] p7FCgw_GlWc: Downloading API JSON
[debug] [youtube] Decrypted nsig BihvX6LFvzUHncUydrZ => FSzPoNauNl-h_A
[debug] [youtube] Decrypted nsig VfdexaRbM6MGiTM_WAk => 2Hqin4F4l5gqRQ
[debug] Invoking downloader on u'https://rr2---sn-4vguioxu-n3bl.googlevideo.com/videoplayback?sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cvprv%2Cxtags%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&fexp=24007246&ei=dsYAZPv8Jsq1gQfmipK4CQ&ip=46.12.48.227&clen=10310099&id=o-AJ2zHKrf5VcKKYfGB2De5CSXbJJ55JstbcI4YFVn9H1g&txp=5532434&gir=yes&requiressl=yes&keepalive=yes&source=youtube&gcr=gr&sig=AOq0QJ8wRgIhAMX0D4lFIDfALp2W4pzVExyomUPP7Iz62RMAMUIbmvLNAiEA2K_gTKLtbRXxl2-HeAxaPhXKsWjJhpYCjq2dphsK2FI%3D&dur=636.992&ns=0ijtK7aX1VJmYrwljOKjorYL&initcwndbps=763750&vprv=1&lsig=AG3C_xAwRQIgLfYSmjWjwIsCm4VhnT4DAehOrLXq2oeshPYcQ_mA8joCIQCTzfA_BgQzloDXUOstgwIwVOM4t5OYQ8g6MzXfbwPBOg%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lmt=1655987080855281&c=TVHTML5_SIMPLY_EMBEDDED_PLAYER&expire=1677794006&mime=audio%2Fmp4&fvip=1&xtags=drc%3D1&itag=140&mm=31%2C29&mn=sn-4vguioxu-n3bl%2Csn-nv47zn7y&mh=a3&n=FSzPoNauNl-h_A&mt=1677771926&mv=m&pl=20&ms=au%2Crdu&mvi=2'
[dashsegments] Total fragments: 1
[download] Destination: Kanye West - Famous-p7FCgw_GlWc.m4a
[download] 100% of 9.83MiB in 00:08

@tansy ?

@nicolaasjan
Copy link

@nicolaasjan nicolaasjan commented on b0b53e8 Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't make it faster here (should be ~10MB/s)...

[download] 3.8% of 216.45MiB at 682.79KiB/s ETA 05:12^C

[Edit]
Never mind. I applied only this commit, haha.
Now:
[download] 24.9% of ~250.55MiB at 11.76MiB/s ETA 00:17^C 😀️

Ouderdom komt met gebreken...

@nicolaasjan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't use aria2c though:

WARNING: Requested external downloader cannot be used: ignoring --external-downloader-args

@Vangelis66

This comment was marked as off-topic.

@Vangelis66

This comment was marked as off-topic.

@dirkf
Copy link
Owner Author

@dirkf dirkf commented on b0b53e8 Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If aria2 doesn't work any better than the combination of native and ffmpeg downloading, I don't think there's anything to be done, though PRs might be considered.

@Vangelis66
Copy link

@Vangelis66 Vangelis66 commented on b0b53e8 Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... And it took Google less than half a day to nullify this latest fix 😡 ; throttling is BACK:

[youtube] p7FCgw_GlWc: Downloading webpage
[youtube] Confirming age
[youtube] p7FCgw_GlWc: Downloading API JSON
[dashsegments] Total fragments: 1
[download] Destination: Kanye West - Famous-p7FCgw_GlWc.m4a
[download]   7.7% of ~9.83MiB at 50.70KiB/s ETA 01:06
ERROR: Interrupted by user
Terminate batch job (Y/N)? y

Downstream have been notified an hour ago, "they" thought at first it was a dupe of yt-dlp/yt-dlp#6369 ...
Back to the drawing board 😉 ...

@nicolaasjan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. 🙂

[dashsegments] Total fragments: 22
[download] Destination: /dev/shm/test-ytd/Kanye West - Famous.f137.mp4
[download]  20.0% of ~220.00MiB at 12.11MiB/s ETA 00:15^C

Please sign in to comment.