JimmXinu / FanFicFare

FanFicFare is a tool for making eBooks from stories on fanfiction and other web sites.
Other
746 stars 158 forks source link

Fiction live images error #933

Closed i-push-code closed 9 months ago

i-push-code commented 1 year ago

https://fiction.live/stories/naive-schoolgirl-sakuras-exchange-trip/d8gx32QggbX8JYbET This stories images arent showing up and Im using the latest fanficfare version

JimmXinu commented 1 year ago

Looking at it in the browser inspector, it looks like the HTML refers to images URLs like:

https://www.filepicker.io/api/file/7Fcd4vBTSeiB1t49RoxT

...which fail, but then something in the javascript inside calls a URL like:

https://cdn3.fiction.live/fp/7Fcd4vBTSeiB1t49RoxT?&quality=95

Note the similarity of UID.

filepicker.io appears to be a CDN of some kind. The error I get in FFF is 429 Client Error: Too Many Requests for url:

I don't even pretend to know how adapter_fictionlive works. @HazelSh, do you have the time and interest to look at this?

Jemeni11 commented 1 year ago

Note the similarity of UID.

I came up with this:

if url.startswith("https://www.filepicker.io/api/"):
  logger.warning("Filepicker.io image detected, converting to Fiction.live image. This might fail.")
  url = f"https://cdn3.fiction.live/fp/{url.split('/')[-1]}?&quality=95"

And it worked for the ten images I tested it with. However, I tested it in a standalone script, so I do not know if this will work well with Fanficfare.

HazelSh commented 1 year ago

I'm ill with covid at the moment, can't promise to get to this soon.

JimmXinu commented 1 year ago

Ugh. Hope you feel better soon.

i-push-code commented 1 year ago

Looking at it in the browser inspector, it looks like the HTML refers to images URLs like:

https://www.filepicker.io/api/file/7Fcd4vBTSeiB1t49RoxT

...which fail, but then something in the javascript inside calls a URL like:

https://cdn3.fiction.live/fp/7Fcd4vBTSeiB1t49RoxT?&quality=95

Note the similarity of UID.

filepicker.io appears to be a CDN of some kind. The error I get in FFF is 429 Client Error: Too Many Requests for url:

I don't even pretend to know how adapter_fictionlive works. @HazelSh, do you have the time and interest to look at this?

Note the similarity of UID.

I came up with this:

if url.startswith("https://www.filepicker.io/api/"):
  logger.warning("Filepicker.io image detected, converting to Fiction.live image. This might fail.")
  url = f"https://cdn3.fiction.live/fp/{url.split('/')[-1]}?&quality=95"

And it worked for the ten images I tested it with. However, I tested it in a standalone script, so I do not know if this will work well with Fanficfare.

Thanks

i-push-code commented 1 year ago

I'm ill with covid at the moment, can't promise to get to this soon.

Okay, hope you get better soon

JimmXinu commented 9 months ago

Fixed in #1004