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

[openload] fix extractor #12587

Merged
merged 1 commit into from
Mar 28, 2017
Merged

Conversation

Tithen-Firion
Copy link
Contributor

@Tithen-Firion Tithen-Firion commented Mar 28, 2017

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:

  • 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
  • New extractor
  • New feature

Description of your pull request and other information

Fixes #10408, for now. I've translated deobfuscated JavaScript to Python and tweaked it a bit. Problematic part was parseInt since it can return NaN from empty string. Python's int will just throw ValueError. I've solved it with or '0' but it wont work in this case:

var a = parseInt(''); // NaN
var b = a + 3;        // NaN again, same for `3 + a`
var c = b & 1;        // 0, same for `1 & b`
a = int('' or '0') # 0
b = a + 3          # 3
c = b & 1          # 1

I don't know how to replicate this behaviour in Python but luckily it's not needed for current version of decoder.

@yan12125 yan12125 merged commit aea1dcc into ytdl-org:master Mar 28, 2017
@yan12125
Copy link
Collaborator

Thanks! FYI: python has float('nan')

@Tithen-Firion Tithen-Firion deleted the openload-fix branch March 28, 2017 17:31
@Tithen-Firion
Copy link
Contributor Author

It does, but float('nan') & 1 throws

TypeError: unsupported operand type(s) for &: 'float' and 'int'

I guess custom NaN class and parseInt function behaving like those in JS are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

openload.co extractor not working
2 participants