Sadpanda Save/Export All Favorites

Load all favorites to the page and save it, export as JSON data or just copy the textbox contents. Works on exhentai and e-hentai.

< Feedback on Sadpanda Save/Export All Favorites

Review: Good - script works

§
Posted: 2024-05-22

The json file I dump has a small number of elements that are null, which always prevents me from displaying the results and throws an error when using your sadpanda-graphs.surge.sh page

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'gallery_info_full')
at parseData (script.js:83:39)
at reloadCharts (script.js:40:15)
at script.js:25:13

I don't know if it's just me that's having the problem.
Add judgment after line 82 of script.js

if (row === null) {
// If gallery_info_full is null, skip this line.
continue;
}

The problem has been solved.

Thanks again for your script and page!

§
Posted: 2024-05-22

And also i'd like to know what could cause this problem or how I should find the item that errors out as null.
Perhaps the entry has been deleted by the DMCA?

SaddestPandaAuthor
§
Posted: 2024-05-22

First of all thanks for the bug report. For now I updated the website with the fix that you suggested.

The problem is most likely with the json parser of the "Sadpanda Save/Export All Favorites" script. I doubt its related to removed (DMCAd) galleries as those are visible on the favorites page like any other gallery.

Can you use the script to load your favorites into the page and then check the console for any getJSONfromExtendedRow error lines?
Also please update the script before doing above as I have made the error log a bit more detailed now.

ttttsdst @ protonmail.com if you don't want to share the error log publicly. It shouldn't contain anything personal though unless you have private galleries.

§
Posted: 2024-05-22

The site works fine now, but what puzzles me is that the script now fails all the way through the first page (50 entries) when exporting favorites.

Here is one of the error logs.

userscript.html?name=Sadpanda-Save%252FExport-All-Favorites.user.js&id=45130c6b-bd59-49f9-aae6-0d4554e08548:2201 SaveExportFavorites: getJSONfromExtendedRow error! {error: TypeError: Cannot read properties of null (reading '1')
at getJSONfromExtendedRow (chrome-exten…} {row: tr} {rowOuterHTML: '

'}
getJSONfromExtendedRow @ userscript.html?name=Sadpanda-Save%252FExport-All-Favorites.user.js&id=45130c6b-bd59-49f9-aae6-0d4554e08548:2201
getThisPage @ userscript.html?name=Sadpanda-Save%252FExport-All-Favorites.user.js&id=45130c6b-bd59-49f9-aae6-0d4554e08548:1898
getThePagesNew @ userscript.html?name=Sadpanda-Save%252FExport-All-Favorites.user.js&id=45130c6b-bd59-49f9-aae6-0d4554e08548:1931

There were 50 such errors reported until it turns to the second page.
The exported json file is as follows.

[
null,
null,
.........
null,
null,(50 in total)
{
"gallery_info_full": {
"gallery": {
"gid": "2480258",
"token": "ba93bff7bc"
},
"title": "[丑露ムキ] 籠女籠ノ中 後篇 (COMIC 阿吽 2023年2月号) [中国翻訳] [DL版]",
"date_uploaded": 1677580620000,
"date_favorited": 1677613800000,
"category": "manga",
"uploader": "changl",
"rating": {
"average": 4.5,
"count": 0
},
"user_rating": 0,
"favorites": {
"category": 7,
"category_title": "yeah",
"note": ""
},
"thumbnail": "https://s.exhentai.org/t/67/37/6737301902ce426db906ca344bfa0c136b574802-2197129-1062-1500-png_250.jpg",
"image_count": 28,
"tags": {
"language": [
"chinese",
"translated"
],
"female": [
"lolicon",
"kimono"
],
"mixed": [
"ffm threesome",
"group"
],
"artist": [
"ushiro muki"
],
"other": [
"full censorship"
]
},
"tags_have_namespace": true,
"source": "layout_extended",
"source_site": "exhentai",
"date_generated": 1716402503057
},
"source_script": "save-export-all-favorites"
},
.........

if you need the detaled log,tell me that i will send it to your email
§
Posted: 2024-05-22

After updating again I'm even more confused.
Now that the null is gone, for the 53 entries of favorites I exported there are now only 3 entries in the json file, now the null is not written by default is it?

Here is one of the error logs.


error
:
TypeError: Cannot read properties of null (reading '1') at getJSONfromExtendedRow (chrome-extension://dhdgffkkebhmkfjojejmpbldmpobfkfo/userscript.html?name=Sadpanda-Save%252FExport-All-Favorites.user.js&id=45130c6b-bd59-49f9-aae6-0d4554e08548:2195:121) at getThisPage (chrome-extension://dhdgffkkebhmkfjojejmpbldmpobfkfo/userscript.html?name=Sadpanda-Save%252FExport-All-Favorites.user.js&id=45130c6b-bd59-49f9-aae6-0d4554e08548:1898:29) at HTMLInputElement.getThePagesNew (chrome-extension://dhdgffkkebhmkfjojejmpbldmpobfkfo/userscript.html?name=Sadpanda-Save%252FExport-All-Favorites.user.js&id=45130c6b-bd59-49f9-aae6-0d4554e08548:1934:5)
message
:
"Cannot read properties of null (reading '1')"
stack
:
"TypeError: Cannot read properties of null (reading '1')\n at getJSONfromExtendedRow (chrome-extension://dhdgffkkebhmkfjojejmpbldmpobfkfo/userscript.html?name=Sadpanda-Save%252FExport-All-Favorites.user.js&id=45130c6b-bd59-49f9-aae6-0d4554e08548:2195:121)\n at getThisPage (chrome-extension://dhdgffkkebhmkfjojejmpbldmpobfkfo/userscript.html?name=Sadpanda-Save%252FExport-All-Favorites.user.js&id=45130c6b-bd59-49f9-aae6-0d4554e08548:1898:29)\n at HTMLInputElement.getThePagesNew (chrome-extension://dhdgffkkebhmkfjojejmpbldmpobfkfo/userscript.html?name=Sadpanda-Save%252FExport-All-Favorites.user.js&id=45130c6b-bd59-49f9-aae6-0d4554e08548:1934:5)"

I have always 50 errors of the first page.

SaddestPandaAuthor
§
Posted: 2024-05-22

Alright that helped a ton. I think there is a problem with the tag parser. The parser follows a strict html structure so this error might be related to an external script that modifies the favorites page so if you are using anything let me know.
And yes, I stopped the script from adding the nulls into the JSON object. Instead it now says "xxx objects in parsed JSON data" in the status panel; letting you know about any potential errors.

Can you update the script again and this time in the console right click the FULL_ERROR_LOG text and click copy object (first option). And then share the copied text with me. With this finally I should be able to find the main problem and fix it.

I can't replicate the error on my side so I need your help to fix it. Many thanks.

§
Posted: 2024-05-22

Alright that helped a ton. I think there is a problem with the tag parser. The parser follows a strict html structure so this error might be related to an external script that modifies the favorites page so if you are using anything let me know.

And yes, I stopped the script from adding the nulls into the JSON object. Instead it now says "xxx objects in parsed JSON data" in the status panel; letting you know about any potential errors.

Can you update the script again and this time in the console right click the FULL_ERROR_LOG text and click copy object (first option). And then share the copied text with me. With this finally I should be able to find the main problem and fix it.

I can't replicate the error on my side so I need your help to fix it. Many thanks.

okay,i think it might have something to do with the localization plugin I installed.
I will have a try again.

§
Posted: 2024-05-22
Edited: 2024-05-22

{
"error": {},
"row": {},
"rowOuterHTML": "

\"[Artist]

"
}

§
Posted: 2024-05-22
Edited: 2024-05-22

{
"error": {},
"row": {},
"rowOuterHTML": "

\"[Artist]

"
}

My fault.I forget that i just installed a localization plugin.
After i close it,the plugin works well now.

SaddestPandaAuthor
§
Posted: 2024-05-22

What plugin is it? Maybe I can make it work with the plugin as well.

§
Posted: 2024-05-22
Edited: 2024-05-22

What plugin is it? Maybe I can make it work with the plugin as well.

The source code on GitHub
https://github.com/EhTagTranslation/EhSyringe
and sleazyfork
https://sleazyfork.org/zh-CN/scripts/407833-ehsyringe

§
Posted: 2024-05-22

What plugin is it? Maybe I can make it work with the plugin as well.

The source code on GitHub
https://github.com/EhTagTranslation/EhSyringe
and sleazyfork
https://sleazyfork.org/zh-CN/scripts/407833-ehsyringe

Is adapting this script perhaps a bit tricky?
Perhaps it is not really necessary, as this need may only be useful for specific native speakers.

SaddestPandaAuthor
§
Posted: 2024-05-22

I'll try and let you know. It shouldn't be hard.

§
Posted: 2024-05-22

Also, the script now works well enough to even fetch data related to entries that have been deleted by the DMCA, and doesn't fetch null in json file as it did before. So is it possible to add a separate stats item with a separate list of deleted or privatized galleries?

SaddestPandaAuthor
§
Posted: 2024-05-22
Edited: 2024-05-22

Its impossible to know if a gallery is DMCA'd or removed from the favorites page. The script would have to check each and every single gallery or use the API for that information. The script only parses the favorites page and on the favorites page removed and existing galleries look exactly the same.
For now it would be quite hard to do that.

Alright I have mainly fixed the EhSyringe issue. The only problem is you need to disable the "translate timestamp" (翻译时间戳) option for the dates to be parsed correctly. With that option disabled it gives the same JSON output as the website without EhSyringe.
If that option is enabled date fields will be left as null.

Also added a relevant warning message into the status box.

SaddestPandaAuthor
§
Posted: 2024-05-28
Edited: 2024-05-28

The script is now compatible with EhSyringe. Including the "translate timestamp" (翻译时间戳) option.

Let me know if there are any problems.

§
Posted: 2024-05-28

The script is now compatible with EhSyringe. Including the "translate timestamp" (翻译时间戳) option.

Let me know if there are any problems.

Okay,it works well with the "translate timestamp" now.
Thanks!

Post reply

Sign in to post a reply.