youtube-dl icon indicating copy to clipboard operation
youtube-dl copied to clipboard

[parler] Backport extractor from yt-dlp

Open palewire opened this issue 1 year ago • 6 comments

Please follow the guide below

  • You will be asked some questions, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your pull request (like that [x])
  • Use Preview tab to see how your pull request will actually look like

Before submitting a pull request make sure you have:

In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:

  • [x] I am the original author of this code and I am willing to release it under Unlicense
  • [ ] I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

  • [ ] Bug fix
  • [ ] Improvement
  • [x] New extractor
  • [ ] New feature

Description of your pull request and other information

Explanation of your pull request in arbitrary form goes here. Please make sure the description explains the purpose and effect of your pull request and is worded well enough to be understood. Provide as much context and examples as possible.

palewire avatar Aug 07 '22 18:08 palewire

Thanks for all the advice. I've made your changes and tried to apply them to #31141 and #31143 as well.

palewire avatar Aug 08 '22 18:08 palewire

I've updated this patch to act as a backport from yt-dlp. You can find it here. https://github.com/yt-dlp/yt-dlp/pull/4616

I've left out the third test for a YouTube embed because I'm unsure how to handle that task in this package. If you'd like that included, if can give me some pointers on how to implement it I'd be happy to add.

palewire avatar Aug 15 '22 18:08 palewire

I've left out the third test for a YouTube embed because I'm unsure how to handle that task in this package. If you'd like that included, if can give me some pointers on how to implement it I'd be happy to add.

It's the exact same. Just return a url_result. Only difference as I remember is that you have to do YoutubeIE.ie_key() instead of just YoutubeIE for the key

pukkandan avatar Aug 15 '22 19:08 pukkandan

I've left out the third test for a YouTube embed because I'm unsure how to handle that task in this package. If you'd like that included, if can give me some pointers on how to implement it I'd be happy to add.

It's the exact same. Just return a url_result. Only difference as I remember is that you have to do YoutubeIE.ie_key() instead of just YoutubeIE for the key

In the third test, you need to have an add_ie item at the same level as the info_dict:

            'add_ie': ['Youtube'],

Apparently the test works without that in yt-dlp?

dirkf avatar Aug 16 '22 02:08 dirkf

Tests don't work in youtube-dl without add_ie? I haven't changed anything related to it in yt-dlp - and honestly have never understood what the purpose of that key is. It could be a change inherited via yt-dlc, though I don't see any obvious commits for it in the history

pukkandan avatar Aug 16 '22 02:08 pukkandan

I guess, something to do with lazy_extractors? What happened when @palewire ran the test in yt-dl? From the comment I inferred that it failed.

The add_IE thing (was cargo cult for me too) has two effects, I find:

  • [{self.addIE}] appended to the test name
  • check that the added IE is .working().

dirkf avatar Aug 16 '22 02:08 dirkf

@dirkf, I added the YouTube passthrough test back in, as you suggested.

However, I'm getting #30976 when I try to test it locally. It's failing to dig out https://youtu.be/r5vkSaz8PxQ.

If I run the vanilla CLI against that URL it does work. So I suspect there must be something off about how I'm accessing the YouTubeIE with this internal reference.

palewire avatar Aug 23 '22 17:08 palewire

getting #30976 when I try to test it locally

I think you need to update from the ytdl-org master branch, which fixed this a few days ago (after YT changed the challenge syntax in the latest player JS).

dirkf avatar Aug 24 '22 12:08 dirkf

Here's the error I get:

$ python test/test_download.py TestDownload.test_Parler_2                                                                                         
[Parler] f23b85c1-6558-470f-b9ff-02c145f28da5: Downloading JSON metadata                                                                          
[youtube] r5vkSaz8PxQ: Downloading webpage                                                                                                        
[youtube] r5vkSaz8PxQ: Downloading MPD manifest                                                                                                   
[youtube] r5vkSaz8PxQ: Downloading player 0c356943                                                                                                
ERROR: [youtube] Unable to decode n-parameter: download likely to be throttled (Failed to evaluate 0 + None (caused by TypeError("unsupported oper
and type(s) for +: 'int' and 'NoneType'")); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  h
ttps://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 rec
ent call last):                                                                                                                                   
  File "/home/palewire/Code/youtube-dl/youtube_dl/jsinterp.py", line 203, in _operator                                                            
    return opfunc(left_val, right_val)                                                                                                            
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'

palewire avatar Aug 24 '22 12:08 palewire

That's the fixed error (actually a later player is fixed as well, and the latest player(s) have, so far, not broken our mini JS interpreter) .

dirkf avatar Aug 24 '22 13:08 dirkf

I pulled from master and still got it. So I think this bug is probably a phantom and the patch is ready for your review.

palewire avatar Aug 24 '22 13:08 palewire