ulixee / hero

The web browser built for scraping
MIT License
800 stars 41 forks source link

Corrupted profiles #133

Closed alexio777 closed 2 years ago

alexio777 commented 2 years ago

Hi! Sometimes the saved profile contains null value and hangs when trying to load it... My temporary fix for this:

    profileData = profileData.replace("[null]", "[]");
    profileData = profileData.replace(",null]", "]");
    profileData = profileData.replace("[null,", "[");

Example:

    "https://www.youtube.com": {
            "indexedDB": [
                null, <-----------------------------
                {
                    "name": "YtIdbMeta",
                    "version": 1,
                    "objectStores": [
                        {
                            "name": "databases",
                            "indexes": [],
                            "keyPath": "actualName",
                            "autoIncrement": false
                        }
                    ],
                },....
alexio777 commented 2 years ago

I also found that loading hero with profile hangs when the following is saved in the profile:

       "https://www.desertcart.co.za": {
            "indexedDB": [
                {
                    "name": "smartech",
                    "version": 2,
                    "objectStores": [
                        {
                            "name": "activity",
                            "indexes": [],
                            "keyPath": "timestamp",
                            "autoIncrement": false
                        },
                        {
                            "name": "attribute",
                            "indexes": [],
                            "keyPath": "identity",
                            "autoIncrement": false
                        }
                    ],
                    "data": {
                        "activity": [
                            "{\"value\":[]}", <--------------------
                            "{\"value\":[]}", <--------------------
                            "{\"value\":[]}", <--------------------
                            "{\"value\":[]}" <--------------------
                        ],
                        "attribute": []
                    }

All loading problems with the profile are related to the indexedDB, for myself I found a temporary solution to the problem - clear the indexedDB records in the profile before saving....

blakebyrnes commented 2 years ago

Thanks @alexio777. Do you have a session database you could share for the first issue? You can send to me on Discord if you're willing