Obtainium icon indicating copy to clipboard operation
Obtainium copied to clipboard

Add redirecting links as a source

Open 1xFF opened this issue 1 year ago • 5 comments

A few source requests I've seen here are nothing more then a single URL that redirects to an APK file. Obviously it isn't practical to add every single third party download as a source, so having the ability to track a download link could be useful. Likely the reason this isn't already a feature is version detection, with the filename being the only data point available without downloading. It's certainly possible to track an APK if its filename changes at all, the issue is doing this is a way that a normal user could figure out.

I think it's pretty safe to say that if a filename contains 3+ digits together with one or more periods in-between then its a version number and if its 5-6+ without periods then it's a timestamp or squashed version number, both of which increment. If these conditions aren't met, then it's likely that the filename is static, so the user can be informed the link might not work.

If the regex failed to match then the user could then confirm that yes this filename has a changing value (very low/weird version number, timestamps too small to fit the date into, hashes, whatever) that the regex failed to see.

Then Obtainium can check if the filename changed whenever checking for updates.

1xFF avatar Aug 13 '23 09:08 1xFF

@ImranR98 Does this mean a PR as described would be accepted? Also, I plan on adding this functionality to the pre-existing HTML source is that fine?

1xFF avatar Aug 14 '23 13:08 1xFF

@1xFF yes, a PR would be great especially if it works as an option under the existing HTML source.

ImranR98 avatar Aug 14 '23 13:08 ImranR98

Note that for version detection in the filename, you might want to reuse the version detection logic used for app versions. You could add code to look for timestamps etc on top of that.

ImranR98 avatar Aug 14 '23 13:08 ImranR98

Looking into this again. Quite a few APK's store the android manifest after only a few bytes, which would allow for a partial download to grab the version number. But unfortunately this isn't always the case, some of them for whatever reason are at the end of the file.

1xFF avatar May 04 '24 18:05 1xFF

Haven't looked at this issue in a while. Obtainium does now have a "fixed link" source that relies on hashing the first 1kb or so of the APK (reliable most of the time but not always). I think it should already follow redirects? Haven't tried it.

ImranR98 avatar May 05 '24 04:05 ImranR98