eljeffeg / SmartCopy

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

Fix YadVaShem new Design #119

Open GuyKh opened 6 months ago

GuyKh commented 6 months ago

Solves #118

Basically - changed the logic to the following:

  1. Load from the page the selected record ID (by using the parsed page)
  2. Call the YadVaShem API with the language (from the URL) and the ItemID
  3. Convert the returned json to an object
  4. Go over the object fields to extract data

e.g. for https://collections.yadvashem.org/en/names/14035251 call (step 2) to: https://yv360.yadvashem.org/api/Names/GetSingleFullDetails?id=1100850&lang=en&source=Page%20of%20Testimony

response is in the following format:

{
    "details": [
        {
            "tag": null,
            "id": "YSLN",
            "value": "Epsztein",
            "url": ""
        },
        {
            "tag": null,
            "id": "YSLN",
            "value": "Epshtein",
            "url": ""
        },
        {
            "tag": null,
            "id": "YSFN",
            "value": "Abram",
            "url": ""
        },
        {
            "tag": null,
            "id": "YSFN",
            "value": "Avraham",
            "url": ""
        },
        {
            "tag": null,
            "id": "GENDER",
            "value": "Male",
            "url": ""
        },...

Then, convert the details list to an object by using a id to field_name mapping, with value from value. Then parse it.

Also - since they may be duplicates, take the first value.

Bonus: Refactor addEventData to a common class.

Other things to add (probably in a different PR) - the ability to fetch an image.