AlphaSlayer1964 / kemono-dl

A simple kemono.party downloader using python.
509 stars 83 forks source link

Fix --inline arg #88

Closed Kimbyeoungjang closed 2 years ago

Kimbyeoungjang commented 2 years ago

https://kemono.party/fanbox/user/3188698/post/420615

This link is one of the example

:Before remove arg Screen Shot 2022-04-25 at 12 10 31 .

in screenshot, BeautifulSoup normally parse html content but after I print inline_images, there is no data in array

:After remove arg Screen Shot 2022-04-25 at 12 11 34 Screen Shot 2022-04-25 at 12 12 20

Now normally download inline content from link.

Kimbyeoungjang commented 2 years ago

note I can't find about that how {"data-media-id": True} tag works in beautiful soup's find_all method. Is this purpose for a find data-media-id tag?

AlphaSlayer1964 commented 2 years ago

So I'm only trying to get images hosted on kemono.party's servers. While this fixes it for this post it will cause errors on files that are not hosted on kemono.party. Unfortunately I really only tested getting those inline on patreon posts, on patreon posts all kemono.party hosted inline images have the tag "data-media-id". I will look into a better method of only getting only kemono.party hosted inline images.

afterdelight commented 2 years ago

plz fix this

AlphaSlayer1964 commented 2 years ago

plz fix this

This was already fixed

afterdelight commented 2 years ago

could you give me the commit link?

AlphaSlayer1964 commented 2 years ago

45dad84

afterdelight commented 2 years ago

ty, but now i got this error on some user on patreon

INFO:Skipping post | post already archived
Traceback (most recent call last):
  File "F:\downloader\kemono.party\kemono-dl-main\kemono-dl.py", line 4, in <module>
    main()
  File "F:\downloader\kemono.party\kemono-dl-main\src\main.py", line 670, in main
    downloader(get_args())
  File "F:\downloader\kemono.party\kemono-dl-main\src\main.py", line 95, in __init__
    self.start_download()
  File "F:\downloader\kemono.party\kemono-dl-main\src\main.py", line 656, in start_download
    self.get_favorites('kemono.party', 'artist', self.k_fav_users)
  File "F:\downloader\kemono.party\kemono-dl-main\src\main.py", line 126, in get_favorites
    self.get_post(f"https://{domain}/{favorite['service']}/user/{favorite['id']}")
  File "F:\downloader\kemono.party\kemono-dl-main\src\main.py", line 162, in get_post
    post = self.clean_post(post, user, site)
  File "F:\downloader\kemono.party\kemono-dl-main\src\main.py", line 326, in clean_post
    content_soup = self.get_inline_images(new_post, content_soup)
  File "F:\downloader\kemono.party\kemono-dl-main\src\main.py", line 231, in get_inline_images
    inline_images = [inline_image for inline_image in content_soup.find_all("img") if inline_image['src'][0] == '/']
  File "F:\downloader\kemono.party\kemono-dl-main\src\main.py", line 231, in <listcomp>
    inline_images = [inline_image for inline_image in content_soup.find_all("img") if inline_image['src'][0] == '/']
  File "C:\Python\Python310\lib\site-packages\bs4\element.py", line 1519, in __getitem__
    return self.attrs[key]
KeyError: 'src'