-
Notifications
You must be signed in to change notification settings - Fork 20
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
Feature request: Export favorites to JSON #75
Comments
Or export in any other way because I'm not logged in and I have dozens of favorites and exporting it one by one is a tedious process. |
I needed this feature as well and wrote this little script to export favorites using adb. Dependencies : java, xmllint, adb Probably not the cleanest solution but it worked well to export all my locally saved posts. #!/bin/bash
# Connect to your phone using adb
adb start-server
# The following command must show your phone connected for the script to work
adb devices
# Get the Glider package name
package_name=$(adb shell cmd package list packages | grep -i glider | sed -e 's/^package://')
# nl.viter.glider
# Backup application data
adb backup -noapk -f backup.ab "${package_name}"
# Download latest version of android-backup-extractor (abe.jar)
wget https://github.com/nelenkov/android-backup-extractor/releases/download/master-20221109063121-8fdfc5e/abe.jar
# Extract backup using the backup password previously entered on the phone
read -s -p "Backup password: " password
java -jar abe.jar unpack backup.ab output.tar "$password"
tar -xvf output.tar
# Get the 'flutter.favorited' key and decode it
# The string 'This is the prefix for a list.' is appended before, we need to remove it
xmllint apps/nl.viter.glider/sp/FlutterSharedPreferences.xml --xpath "/map/string[@name='flutter.favorited']/text()" | head -n -1 | base64 -d | sed -e 's/^This is the prefix for a list.//' > favorited.serialized
# Write a small java app to parse the serialized ArrayList<String>
cat >Deserialize.java << EOF
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
public class Deserialize {
public static void main(String[] args) {
ArrayList<String> list = null;
try (FileInputStream fis = new FileInputStream(args[0]);
ObjectInputStream ois = new ObjectInputStream(fis);) {
list = (ArrayList) ois.readObject();
} catch (IOException ioe) {
ioe.printStackTrace();
} catch (ClassNotFoundException c) {
System.out.println("Class not found");
c.printStackTrace();
}
for (String name : list) {
System.out.println("https://news.ycombinator.com/item?id=" + name);
}
}
}
EOF
javac Deserialize.java
java Deserialize favorited.serialized
# output:
# https://news.ycombinator.com/item?id=ABC
# https://news.ycombinator.com/item?id=XYZ
# ... |
Hey @ThomasChevalier thanks for the script. I'm sure some people will find it useful. However, it's worth noting that the script won't work on Android 12, due to It would be great if @Mosc had the time to revisit this and at least implement a provisory solution based on POST requests at the very least. Then one could set up a HTTP server and intercept/save accordingly. |
This has been implemented as part of v2.0.0! It's available on the setting page and exports a JSON with a list of favorites IDs. |
Really like the app so far. I'm interested in exporting my (locally-saved) favorites to JSON. In particular, this would be useful for searching when I'm on my PC and need something.
The text was updated successfully, but these errors were encountered: