eljeffeg / SmartCopy

Chrome extension for copying genealogical data into Geni.com.
16 stars 14 forks source link

Ancestry page fails to load data #91

Closed GuyKh closed 3 years ago

GuyKh commented 3 years ago

Getting the following error:

Error handling response: SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Object.loadPage (chrome-extension://ofikakkdpjlipbnhbfloclbkcabdhjah/collections/ancestryfree.js:31:32)
    at loadPage (chrome-extension://ofikakkdpjlipbnhbfloclbkcabdhjah/popup.js:379:32)
    at chrome-extension://ofikakkdpjlipbnhbfloclbkcabdhjah/popup.js:780:17

When trying to find the issue - looking into file: https://github.com/jeffg2k/SmartCopy/blob/master/collections/ancestryfree.js#L31 I'm seeing that the match[0] is:

...
...
    "clientConfig": {
        "lcId": "1033",
        "userAgent": "Mozilla/5.0 (Macintosh

so it stops in the middle of the line and indeed this is not a valid JSON.

parsing the entire page gives me:

"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36"
[and so on]

I think the issue is with the ; sign (this is expected to be the end of the line)

Regex is a b**ch, I know...

eljeffeg commented 3 years ago

Thanks for the investigation and fix. 👍