How to get a list with js commands

Code:

(function(){
let dataList = {};
let dramaElements = document.querySelectorAll('.list-episode-item')[0].querySelectorAll('li');
dramaElements.forEach(function(list, index){
var tempObj = {};
tempObj.image = list.querySelector('a > img').src;
tempObj.title = list.querySelector('.title').textContent;
dataList[index] = tempObj;  
})
return JSON.stringify(dataList);
})();

Result:

{
  "0": {
    "image": "https://imagecdn.me/cover/our-days.png",
    "title": "Our Days (2022)"
  },
  "1": {
    "image": "https://imagecdn.me/cover/enchante.png",
    "title": "Enchante (2022)"
  },
  "2": {
    "image": "https://imagecdn.me/cover/nihon-boro-yado-kiko-2019.png",
    "title": "Nihon Boro Yado Kiko (2019)"
  },
  "3": {
    "image": "https://imagecdn.me/cover/those-who-read-hearts-of-evil.png",
    "title": "Through the Darkness (2022)"
  },
  "4": {
    "image": "https://imagecdn.me/cover/two-conjectures-about-marriage.png",
    "title": "Two Conjectures About Marriage (2022)"
  },
  "5": {
    "image": "https://imagecdn.me/cover/rose-in-the-starsea.png",
    "title": "Star-crossed Lovers (2022)"
  },
  "6": {
    "image": "https://imagecdn.me/cover/challenges-at-midlife.png",
    "title": "Challenges at Midlife (2022)"
  },
  "7": {
    "image": "https://imagecdn.me/cover/challenges-at-midlife.png",
    "title": "Challenges at Midlife (2022)"
  },
  "8": {
    "image": "https://imagecdn.me/cover/first-love-for-the-third-time.png",
    "title": "First Love Again (2022)"
  },
  "9": {
    "image": "https://imagecdn.me/cover/two-conjectures-about-marriage.png",
    "title": "Two Conjectures About Marriage (2022)"
  },
  "10": {
    "image": "https://imagecdn.me/cover/second-husband.png",
    "title": "The Second Husband (2021)"
  },
  "11": {
    "image": "https://imagecdn.me/cover/national-team-wife.png",
    "title": "The All-Round Wife (2021)"
  },
  "12": {
    "image": "https://imagecdn.me/cover/love-twist.png",
    "title": "Love Twist (2021)"
  },
  "13": {
    "image": "https://imagecdn.me/cover/modern-marriage.png",
    "title": "Modern Marriage (2022)"
  },
  "14": {
    "image": "https://imagecdn.me/cover/under-the-skin.png",
    "title": "Under the Skin (2022)"
  },
  "15": {
    "image": "https://imagecdn.me/cover/940920.png",
    "title": "940920 (2022)"
  },
  "16": {
    "image": "https://imagecdn.me/cover/you-are-my-sky.png",
    "title": "You're My Sky (2022)"
  },
  "17": {
    "image": "https://imagecdn.me/cover/the-war-of-flowers.png",
    "title": "The War of Flowers (2022)"
  },
  "18": {
    "image": "https://imagecdn.me/cover/in-your-heart-2022.png",
    "title": "In Your Heart (2022)"
  },
  "19": {
    "image": "https://imagecdn.me/cover/royal-feast.png",
    "title": "Royal Feast (2022)"
  },
  "20": {
    "image": "https://imagecdn.me/cover/cai-bu-yao-he-lao-ban-tan-lian-ai.png",
    "title": "Legally Romance (2022)"
  },
  "21": {
    "image": "https://imagecdn.me/cover/sweet-guy-2018.png",
    "title": "Sweet Guy (2018)"
  },
  "22": {
    "image": "https://imagecdn.me/cover/the-100th-bride-2005.png",
    "title": "The 100th Bride (2005)"
  },
  "23": {
    "image": "https://imagecdn.me/cover/love-forever-after-2022.png",
    "title": "Love Forever After (2022)"
  },
  "24": {
    "image": "https://imagecdn.me/cover/something-in-my-room.png",
    "title": "Something in My Room (2022)"
  },
  "25": {
    "image": "https://imagecdn.me/cover/to-two-2021.png",
    "title": "To.Two (2021)"
  },
  "26": {
    "image": "https://imagecdn.me/cover/sweet-lovestory-with-you-2021.png",
    "title": "Sweet Lovestory with You (2021)"
  },
  "27": {
    "image": "https://imagecdn.me/cover/hidden-marriage-love.png",
    "title": "Hidden Marriage Love (2021)"
  },
  "28": {
    "image": "https://imagecdn.me/cover/lucky-club.png",
    "title": "Lucky Club (2022)"
  },
  "29": {
    "image": "https://imagecdn.me/cover/kei-yaku-abunai-aibou.png",
    "title": "Kei×Yaku: Abunai Aibou (2022)"
  },
  "30": {
    "image": "https://imagecdn.me/cover/semantic-error.png",
    "title": "Semantic Error (2022)"
  },
  "31": {
    "image": "https://imagecdn.me/cover/best-mistake-season-3.png",
    "title": "Best Mistake Season 3 (2021) Special 5"
  },
  "32": {
    "image": "https://imagecdn.me/cover/journey-to-the-west-afterstory-2000.png",
    "title": "Journey to the West Afterstory (2000)"
  },
  "33": {
    "image": "https://imagecdn.me/cover/talking-bones-season-2.png",
    "title": "Talking Bones 2 (2022)"
  },
  "34": {
    "image": "https://imagecdn.me/cover/hokusai-to-meshi-sae-areba.png",
    "title": "Hokusai to Meshi Sae Areba"
  },
  "35": {
    "image": "https://imagecdn.me/cover/lord-marriage-please-stay.png",
    "title": "Ms. Cupid in Love (2022)"
  }
}
5 Likes