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

dezoomify-rs adding ending/trailing end to url #174

Open
ymerouani opened this issue May 5, 2022 · 4 comments
Open

dezoomify-rs adding ending/trailing end to url #174

ymerouani opened this issue May 5, 2022 · 4 comments

Comments

@ymerouani
Copy link

ymerouani commented May 5, 2022

Hello!
So I am working on trying to make dezoomify-rs work with ancestry.com images. I have thus far figured out that they use DZI for their zoomifyer, and of course also cookies is a must since its behind a login. And just figured out the header option for dezoomify-rs, which is perfect. But annoyingly, you need to add a unique security key to the ending of each image URL to pass security check of ancestry.com.
URL example:

URL: https://mediasvc.ancestry.com/v2/tile/namespaces/62010/media/62010_b952499-00324.dzi
Should be URL: https://mediasvc.ancestry.com/v2/tile/namespaces/62010/media/62010_b952499-00324.dzi?securitytoken=xxxxx

Tile example

So for this tile: https://mediasvc.ancestry.com/v2/tile/namespaces/62010/media/62010_b952499-00324_files/12/3_0.jpg
It should be: https://mediasvc.ancestry.com/v2/tile/namespaces/62010/media/62010_b952499-00324_files/12/3_0.jpg?securitytoken=xxxxxx

So in short, I'm wondering how to go about editing the program to account for the security key in the url. Im guessing that Custom yaml may be the way to go? But any concrete help would be appreciated!

@ymerouani ymerouani changed the title dezoomify-rs cookies and adding ending to url dezoomify-rs adding ending/trailing end to url May 5, 2022
@lovasoa
Copy link
Owner

lovasoa commented May 6, 2022

You could try to integrate something like rlua in the custom yaml dezoomer to let the user compute their own URL, in which they could compute security tokens

@ymerouani
Copy link
Author

ymerouani commented May 6, 2022

You could try to integrate something like rlua in the custom yaml dezoomer to let the user compute their own URL, in which they could compute security tokens

Thank you so much for your quick reply lovasoa, and of course thank you even more for your amazing tool.

I think the integration of rlua is beyond my skill level. I dont even begin to know whow to go about it. I was trying to figure out a way to maybe edit the way dezoomer-rs works with DZI by editing the "mod.rs" file. Maybe adding the security token part of the url as a string to this part, before "$" : let tile_re = Regex::new("_files/\\d+/\\d+_\\d+\\.(jpe?g|png)$").unwrap(); or maybe this part "{base}/{level}/{x}_{y}.{format}", . As you can see thats the extent of my knowledge, editing small things.

Is it doable that way? And if it is, any links that woudl show me hwo to recompile it?

@ymerouani
Copy link
Author

Update, so I found a way by adding the string after "{format}" {base}/{level}/{x}_{y}.{format} inside the mod.rs file in dzi map, and then compiling. And it worked.
Problem is I just figured that the securitytoken is dynamic, and each picture has its own security key. So this would warrant either scraping all the security tokens, for all pictures and then recompiling the file everytime for a new picture. O finding a better way. If I find a solution I will come back

@Cosmicore
Copy link

It seems that the only way is to write a script that will get the desired token and pass it to dezoomify-rs. All this will work quite well in batch mode. The script receives the token, and dezoomify-rs downloads the tiles and generates the image. This is only if the token is the same for each tile, i.e. it differs only for whole images.

If the token is different for each tile, I see another way. Maybe it is even easier. You can independently download each tile of all images (use a downloader program after the script or implement both functions in one script, which is easy). Then make tiles.yaml and build images with dezoomify-rs.

The last method is also suitable when tiles are encrypted and decrypted only when displayed on the screen by a non-standard viewer.

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

No branches or pull requests

3 participants