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

[Crypter & Downloader] Added knigavuhe.org #4480

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

EnergoStalin
Copy link

Describe the changes

Add simple provider for https://knigavuhe.org so feeding url like this https://knigavuhe.org/book/dopolnitelnye-istorii/ would download a book.

S in SKnigavuhe states for Storage cause i suspect s3 backend judging by subdomain. It serves sole purpose - rewriting name without touching url. Couldn't figure out better way to do it.

Additional references

image

Maybe i will add proper naming templates to it and more metadata resolving from page but for now it's all what i need.

@pep8speaks
Copy link

pep8speaks commented Jun 7, 2024

Hello @EnergoStalin! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 11:89: E501 line too long (89 > 88 characters)

We recommend to use black to automatically correct these files.

Comment last updated at 2024-06-08 22:05:20 UTC

@CLAassistant
Copy link

CLAassistant commented Jun 7, 2024

CLA assistant check
All committers have signed the CLA.

__type__ = "downloader"
__version__ = "0.1"
__status__ = "testing"
__pattern__ = (
Copy link
Member

Choose a reason for hiding this comment

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

__pattern__ must not be surrounded by round brackets

Copy link
Author

@EnergoStalin EnergoStalin Jun 8, 2024

Choose a reason for hiding this comment

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

It's done automatically by black due to line length > 88(89 to be exact). I guess linter will fail if i change that.

@GammaC0de
Copy link
Member

Sorry but one more thing: please issue the PR against the develop branch

@EnergoStalin
Copy link
Author

Also it suddenly stopped working now with Loaded URL exceeded limit (2000000) exception investigating...

@GammaC0de
Copy link
Member

Also it suddenly stopped working now with Loaded URL exceeded limit (2000000) exception investigating...

Probably a solution would be something like:

def setup(self):
try:
self.req.http.close()
except Exception:
pass
self.req.http = HTTPRequest(
cookies=self.req.cj,
options=self.pyload.request_factory.get_options(),
limit=10_000_000,
)

@EnergoStalin EnergoStalin changed the base branch from main to develop June 8, 2024 22:04
@EnergoStalin
Copy link
Author

Don't think it should be that big not bigger 2GB for sure. Will debug through mitmproxy to see if it actually should be this big.

@EnergoStalin
Copy link
Author

EnergoStalin commented Jun 8, 2024

Ok it's broken because i renamed Hoster part. When adding S prefix again it works like before. Probably i guessed first time right you cant name it same way expecting to work.

I couldn't figure out how to set filename for url from Decryptor. So this solutions i can think of.

Solutions

  • Leave hoster with different name from decrypter. Downsides of this approach would be that you need enable them separately.
  • Trick fragment to take priority matching some conditions. So default hoster plugin can be used.
    def name(url, safe_name=True):
    url = format.url(url)
    up = urllib.parse.urlparse(url)
    name = up.path.split("/")[-1]
    if not name:
    name = up.query.split("=", 1)[::-1][0].split("&", 1)[0]
    if not name and up.fragment:
    name = "#" + up.fragment
    elif name and up.fragment:
    name += "#" + up.fragment
    if not name:
    name = up.netloc.split(".", 1)[0]
    return safe_nm(name) if safe_name else name
  • Fix this bug cause i suspect it is one if you asked me to rename Hoster to the same name seems you unaware of this behaviour
  • Allow decrypter decrypt filenames as well
     self.packages.append("", [ (name, url) ], "")
  • Write another default hoster flavor which will match urls ending with fragment(#) which likely filename.

@EnergoStalin
Copy link
Author

Also it suddenly stopped working now with Loaded URL exceeded limit (2000000) exception investigating...

Probably a solution would be something like:

def setup(self):
try:
self.req.http.close()
except Exception:
pass
self.req.http = HTTPRequest(
cookies=self.req.cj,
options=self.pyload.request_factory.get_options(),
limit=10_000_000,
)

This is fixing the issue but then it fails unable to resolve BookPlayer data in decrypter.

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

Successfully merging this pull request may close these issues.

None yet

4 participants