Subject: Re: Megatools link format changed
From: Max Turgor
Date: Mon, 24 Aug 2020 22:15:24 -0400
Thanks for the explanation on the link validation--that makes sense.

It looks like the delimiter between file and key is the pound symbol. i.e.

https://mega.nz/file/rto3RJTb#qvkRM7D1tdrl-R4-b0hcQVwj3FvLOpRL6wEFr8nMjF4

breaks down to:

file: https://mega.nz/file/rto3RJTb
key: qvkRM7D1tdrl-R4-b0hcQVwj3FvLOpRL6wEFr8nMjF4

the folder is similar:

folder: https://mega.nz/folder/Op43xICA
key: EOCBiRQsgc-An93XW6bkCA

There are 43 and 22 characters in the respective keys. Looking at the regex
list you highlighted, I actually can't figure out why these are failing.

On Mon, Aug 24, 2020 at 9:36 PM Ondřej Jirman <megatools@megous.com> wrote:

> Hi,
>
> On Mon, Aug 24, 2020 at 09:05:44PM -0400, Max Turgor wrote:
> > Hi,
> >
> > Thanks for creating megatools! I wanted to point out that the mega.nz
> link
> > format appears to have changed again, causing the tool (v 1.11.0) to
> reject
> > the links. (I think the links are just more characters now?) Here's a
> small
> > example file:
> >
> > *megadl
> >
> https://mega.nz/file/rto3RJTb#qvkRM7D1tdrl-R4-b0hcQVwj3FvLOpRL6wEFr8nMjF4
> > <
> https://mega.nz/file/rto3RJTb#qvkRM7D1tdrl-R4-b0hcQVwj3FvLOpRL6wEFr8nMjF4
> >*
> > WARNING: Skipping invalid Mega download link:
> >
> https://mega.nz/file/rto3RJTb#qvkRM7D1tdrl-R4-b0hcQVwj3FvLOpRL6wEFr8nMjF4
> >
> > The same appears to be an issue with folders.
> >
> > *megadl https://mega.nz/folder/Op43xICA#EOCBiRQsgc-An93XW6bkCA
> > <https://mega.nz/folder/Op43xICA#EOCBiRQsgc-An93XW6bkCA>*
> > WARNING: Skipping invalid Mega download link:
> > https://mega.nz/folder/Op43xICA#EOCBiRQsgc-An93XW6bkCA
> >
> > Since the format of the link appears to change somewhat regularly, I
> wonder
> > if it would make sense to either skip link validation, or provide a
> > --skip-validation option to allow a forced bypass of the validation step
> in
> > case the format changes again.
>
> It's not that simple. It's not like megatools just passes a link to mega
> and magically gets the file data back. Link format needs to be understood,
> parsed for the folder handle/encrpytion keys and whatever else they decided
> to stuff in there this time, and that's just the beginning...
>
> I don't have much interest in extending megatools, anymore, myself.
> I just maintain the web, provide builds, and accept patches from time
> to time.
>
> Luckily the last time the format was changed, I made the code more generic,
> so adding support for new format should be straightforward, unless they
> changed the semantics of the link data. It would just involve adding
> a few lines to this table:
>
> https://megous.com/git/megatools/tree/tools/dl.c#n337
>
> So if you figure out what part of the link is key and what is file handle,
> I'll add it there. Anyway, looking at the new links, there's something not
> quite right about the key part. File key should be 43 chars, folder key 22
> chars, and that doesn't seem to be the case with the links you posted.
>
> regards,
>         o.
>
> > Thanks for maintaining such a great tool!
> >  -M
>