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

Cannot import from previous export #7802

Open
steveman1123 opened this issue Feb 4, 2022 · 30 comments · Fixed by #11745
Open

Cannot import from previous export #7802

steveman1123 opened this issue Feb 4, 2022 · 30 comments · Fixed by #11745
Labels
bug Issue is related to a bug import/export

Comments

@steveman1123
Copy link

Steps to reproduce:

  1. Under subscriptions tab, select subscritions item.
  2. Select "import from" "previous export"
  3. select the exported json file
  4. subscritions are populated

Expected behavior:
Subscriptions are populated from the json export

Actual behavior:
No files are able to be selected in the file browser, all files are greyed out.

Additional steps taken:
Storage permission is allowed, import also works in newpipe legacy v0.20.8

Android version:
8.0.0

Newpipe version:
0.21.15/0.21.16

@steveman1123
Copy link
Author

No template was generated when writing this issue (could be due to using mobile site), apologies for any inconvience. Please comment for any additional info as this is my first issue with newpipe

@triallax
Copy link
Contributor

triallax commented Feb 4, 2022

No template was generated when writing this issue (could be due to using mobile site), apologies for any inconvience.

No worries, this is already better than a lot of issues out there.

I can't reproduce this. What file manager are you using? Can you try https://f-droid.org/packages/me.zhanghai.android.files and see if it works?

(Added template-ignored by mistake, ignore that)

@triallax triallax added bug Issue is related to a bug template ignored The user didn't follow the template/instructions (or removed them) waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. and removed template ignored The user didn't follow the template/instructions (or removed them) labels Feb 4, 2022
@steveman1123
Copy link
Author

I don't seem to have a choice, it just automatically opens the default android file browser (it looks like the legacy one opens its own browser)

@github-actions github-actions bot removed the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Feb 4, 2022
@triallax
Copy link
Contributor

triallax commented Feb 4, 2022

I don't seem to have a choice, it just automatically opens the default android file browser

Did you try installing it yet or not?

it looks like the legacy one opens its own browser

The current NewPipe still has that one, but it's used only when SAF is off. I think on Android 8 we enabled it by default at some point. I think you can disable SAF by toggling "Settings > Download > Use system folder picker (SAF)" off, but I'm not sure since I'm using Android 11, where SAF is mandatory.

@triallax triallax added the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Feb 4, 2022
@steveman1123
Copy link
Author

That did it! Updated perfectly after disabling SAF

@github-actions github-actions bot removed the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Feb 4, 2022
@steveman1123
Copy link
Author

Issue is resolved after disabling SAF

@triallax
Copy link
Contributor

triallax commented Feb 4, 2022

That's a workaround, not a fix, so I'll re-open this.

@triallax triallax reopened this Feb 4, 2022
@mrflamist
Copy link

Not sure if it's related to the issue here, but I didn't want to create a new issue just in case. Importing a zip from the subscriptions tab doesn't work with neither of my file managers.

IMG_20220204_162237

In Settings -> Content, I can only select the exported zip with the Google file manager as selecting it with Material Files will result in "No valid ZIP file" error and even then, it will only reload the app without changing anything.

IMG_20220204_162133

Android version: 10
NewPipe version: 0.21.16

@triallax
Copy link
Contributor

triallax commented Feb 4, 2022

Importing a zip from the subscriptions tab doesn't work with neither of my file managers.

That's working as intended, as the subscription file format is JSON, not ZIP.

In Settings -> Content, I can only select the exported zip with the Google file manager as selecting it with Material Files will result in "No valid ZIP file" error and even then, it will only reload the app without changing anything.

Maybe the ZIP file was corrupted? What version of NewPipe did you export the ZIP from? Or was it exported from a debug version of a PR or something?

@mrflamist
Copy link

That's working as intended, as the subscription file format is JSON, not ZIP.

Aha, apologies. My bad.

Maybe the ZIP file was corrupted? What version of NewPipe did you export the ZIP from? Or was it exported from a debug version of a PR or something?

I exported it on 0.21.15 from F-Droid. I may have just done something wrong.

@triallax
Copy link
Contributor

triallax commented Feb 4, 2022

I exported it on 0.21.15 from F-Droid. I may have just done something wrong.

It doesn't sound like it, but I'm not sure. Can you record your screen while you're trying to import the database but then NewPipe restarts without doing anything?

@mrflamist
Copy link

mrflamist commented Feb 4, 2022

It doesn't sound like it, but I'm not sure. Can you record your screen while you're trying to import the database but then NewPipe restarts without doing anything?

I'm afraid I cannot, because I just tried it one more time and it imported the database without a problem. Unfortunately, I have no idea what I did to make it work

Edit: All I remember doing was restarting my phone, it could have been some Xiaomi bogus... Sorry for not being very helpful.

@triallax
Copy link
Contributor

triallax commented Feb 4, 2022

No problem, at least the issue is solved.

@NewNewPipe
Copy link

The application could add its version number to the export file which would make it easier to identify the source of the problem (between different versions).

@theduckrules

This comment was marked as off-topic.

@triallax

This comment was marked as off-topic.

@theduckrules

This comment was marked as off-topic.

@codingForCats
Copy link

I have this problem. I can import a json file that I export from newpipe, but it greys out any json file I've emailed from freetube

@osopolar
Copy link

osopolar commented Feb 18, 2023

tl:dr It seems that you need to download the zip archive to your local storage, i.e. Download folder.


I migrated my old phone to a new using androids built-in transfer tool. It did not transfer new pipe data (subscriptions, playlists etc.). So I exported the data on the old phone, stored it on google drive, as it was the easiest way to get it to the new phone, and tried to import it from there – directly from the Google Drive folder. I got the "No valid ZIP file" error.

After I downloaded the zip archive from my google drive folder to the download folder (local storage) and imported it from there, it worked.

So if it is the case that NewPipe isn't allowed to access Google Drive there should be a more helpful error message.

@DavidPesticcio
Copy link

DavidPesticcio commented Aug 25, 2023

I also cannot import previously exported subscriptions from the same directory as the export or any other - with the same issue as OP. Restarting device has no effect. 😞

  • NewPipe Version: 0.25.2
  • Tablet Device: Amazon Fire 7
  • Android OS: Fire OS 5.7.0.0

Works fine for the same version on Pixel 6 Pro running Android 12 - both installed from F-Droid.

@sudoshindo
Copy link

sudoshindo commented Apr 28, 2024

What's the status on this?

As of this comment, I'm on the latest version. I still cannot use this import function properly.

If there are no plans to fix this then can you instead just bind these items to the Import/Export Database functions found in Settings > Backup and restore?

@opusforlife2
Copy link
Collaborator

Tried this? #7802 (comment)

@sudoshindo
Copy link

Tried this? #7802 (comment)

Completely irrelevant. I'm not sharing the exported file with Drive.

@opusforlife2
Copy link
Collaborator

It seems that you need to download the zip archive to your local storage, i.e. Download folder.

This part specifically.

@fearedbliss
Copy link

fearedbliss commented Nov 11, 2024

Hello, I've also been experiencing this issue for a while, but finally got around to filing a bug report and found this one. Below is an export of my subscriber list, we can see that the issue is that the exporter is inserting extra characters in the middle of two json elements, causing the entire export to fail to be read. I haven't looked at the code but it may be around some sort of iteration logic. The below was exported using the built in NewPipe exporting functionality:

{"app_version":"0.27.2","app_version_int":999,"subscriptions":[{"service_id":0,"url":"https://www.youtube.com/channel/UCRtAu8OVYVfuNZmTV-Ug0zA","name":"Buddhism"},{"service_id":0,"url":"https://www.youtube.com/channel/UCPIyEJzvW7SsbiIrooixjNA","name":"Doug's Dharma"},{"service_id":0,"url":"https://www.youtube.com/channel/UCDiKw3GnFIwyNJBzhCoRI-Q","name":"Framework"},{"service_id":0,"url":"https://www.youtube.com/channel/UCRIeMHsEdzA9RroG19kXdYg","name":"Jesse Enkamp"},{"service_id":0,"url":"https://www.youtube.com/channel/UCy7jKqbTj9DqgIeaQT0_png","name":"Kevin Lee"},{"service_id":0,"url":"https://www.youtube.com/channel/UC5UAwBUum7CPN5buc-_N1Fw","name":"The Linux Experiment"}]},{"service_id":0,"url":"https://www.youtube.com/channel/UCy7jKqbTj9DqgIeaQT0_png","name":"Kevin Lee"},{"service_id":0,"url":"https://www.youtube.com/channel/UChJQlg1b_cOttPX3SiIh5gA","name":"Lau Dinha in Hong Kong - Hong Kong in the World"},{"service_id":0,"url":"https://www.youtube.com/channel/UCXXd3koJ2dagmhR1csXRTfw","name":"Moo-Moo Clips"},{"service_id":0,"url":"https://www.youtube.com/channel/UCXYOXWWqgtSrk27402V_JMw","name":"Sensei Seth"},{"service_id":0,"url":"https://www.youtube.com/channel/UCU4WVZqK_vuXb6sAArbs8yQ","name":"Supper Moment"},{"service_id":0,"url":"https://www.youtube.com/channel/UC5UAwBUum7CPN5buc-_N1Fw","name":"The Linux Experiment"}]}

And we can see the message that was shown by the DuckDuckGo Json Validator:

Error: Parse error on line 1:
...Linux Experiment"}]},{"service_id":0,"ur
-----------------------^
Expecting 'EOF', got ','

EDIT: Another thing I thought about is that my normal flow for exporting is to "replace" (aka "select the previous existing backup file that was made via Android") via the UI. If the application's behavior in this instance is to "merge two dictionaries", then the bug may be in the merging and export logic.

@Stypox
Copy link
Member

Stypox commented Nov 24, 2024

@fearedbliss I have no idea what might have happened to the export you made, but it seems likely that the file got corrupted in some way, because the file is valid JSON up until the comma that gives the error, and the rest of the file contains duplicate channels. Can you reproduce consistently, or did this happen to just one file?

@fearedbliss
Copy link

It may be possible it happened due to some weird interactions with the workflow I described above. I tried to export/import by creating a new file (rather than overwriting an existing file) and that seemed to work correctly. Feel free to consider what I said before as either invalid or potentially a minor bug that can be deprioritized).

@Stypox
Copy link
Member

Stypox commented Nov 24, 2024

Thanks, I could reproduce by exporting and overwriting the file, I provided a fix PR in #11745 (although JSONs that are already corrupted would need to be edited manually to remove the trailing content)

@fearedbliss
Copy link

Thanks for the fix @Stypox. I'm happy you were able to reproduce and it wasn't just me going crazy haha.

@opusforlife2
Copy link
Collaborator

This issue is about a different problem. The linked PR fixed the bug mentioned in this particular comment only: #7802 (comment).

@opusforlife2 opusforlife2 reopened this Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug import/export
Projects
None yet
Development

Successfully merging a pull request may close this issue.