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

[kemonoparty] Fix file download URLs #1902

Closed
wants to merge 1 commit into from
Closed

[kemonoparty] Fix file download URLs #1902

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Sep 29, 2021

File paths now need to be prepended with /data. Sorry for the sudden breaking change.

@mikf
Copy link
Owner

mikf commented Sep 30, 2021

Should all file URLs start with /data/, including inline images (1) and files with full URL in path (2), or are there exceptions for certain types or services?

(1) https://kemono.party/fanbox/user/7356311/post/802343
contains one inline image.

https://kemono.party/inline/fanbox/uaozO4Yga6ydkGIJFAQDixfE.jpeg currently loads fine,
https://kemono.party/data/inline/fanbox/uaozO4Yga6ydkGIJFAQDixfE.jpeg times out. - nvm, not anymore. this now also works

(2) https://kemono.party/gumroad/user/trylsc/post/IURjT

full URLs to https://kemono.party/files/gumroad/trylsc/IURjT/reward8.jpg and https://kemono.party/attachments/gumroad/trylsc/IURjT/$3.zip in JSON data. Both are without /data/ and both work.

https://kemono.party/data/files/gumroad/trylsc/IURjT/reward8.jpg and
https://kemono.party/data/attachments/gumroad/trylsc/IURjT/$3.zip time out.

@@ -69,9 +69,8 @@ def items(self):

for post["num"], file in enumerate(files, 1):
post["type"] = file["type"]
url = file["path"]
Copy link
Owner

Choose a reason for hiding this comment

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

You shouldn't remove that line

if url[0] == "/":
url = self.root + url
url = self.root + '/data' + url.replace(self.root, '')
Copy link
Owner

Choose a reason for hiding this comment

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

URLs starting with a / don't also contain or start with https://kemono.party.

I'd rather add another check and handle this there

Suggested change
url = self.root + '/data' + url.replace(self.root, '')
url = self.root + "/data" + url
elif url.startswith("https://kemono.party"):
url = self.root + "/data" + url[20:]

@mikf mikf closed this in da96856 Sep 30, 2021
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.

1 participant