How to get a list with js commands

Can we get list of thumbnails with js commands?

thanks, but this command can only get one thumbnail. i want to get the list in one command

Try Like This Using this Code you will get All Title , Image , And Time in a list format

And Using Length of the list blocks you can get its Length

(function() {
var Thumbnail = new Object();
var Title = new Object();
var Time = new Object();
    thumbimages = document.getElementsByClassName("lazy wp-post-image");
    titlelist = document.getElementsByTagName("h3");
    timelist = document.getElementsByClassName("time");


    for(var i = 0; i < 33; i++) {
        Thumbnail[i] = thumbimages[i].src;
    }
for(var i = 0; i < 34; i++) {
        Title[i] = titlelist[i].textContent;
    }
 
for(var i = 0; i < 34; i++) {
        Time[i] = timelist[i].textContent;
    }
var allData = new Object();
allData = {Thumbnail, Title, Time};
return JSON.stringify(allData);
})();

The Output you will get in Json Format Like This

{
  "Thumbnail": {
    "0": "https://www.dramacool9.co/wp-content/uploads/2022/03/940920-2022-180x220.png",
    "1": "https://www.dramacool9.co/wp-content/uploads/2021/09/rose-in-the-starsea-180x220.png",
    "2": "https://www.dramacool9.co/wp-content/uploads/2021/09/those-who-read-hearts-of-evil-180x220.png",
    "3": "https://www.dramacool9.co/wp-content/uploads/2021/09/Two-Conjectures-About-Marriage-2021-180x220.png",
    "4": "https://www.dramacool9.co/wp-content/uploads/2022/02/Challenges-at-Midlife-2022-180x220.png",
    "5": "https://www.dramacool9.co/wp-content/uploads/2021/08/The-Second-Husband-2021-180x220.png",
    "6": "https://www.dramacool9.co/wp-content/uploads/2021/10/The-All-Round-Wife-2021-180x220.png",
    "7": "https://www.dramacool9.co/wp-content/uploads/2022/02/First-Love-Again-2022-180x220.png",
    "8": "https://www.dramacool9.co/wp-content/uploads/2021/12/Love-Twist-2021-180x220.png",
    "9": "https://www.dramacool9.co/wp-content/uploads/2022/02/Modern-Marriage-2022-180x220.png",
    "10": "https://www.dramacool9.co/wp-content/uploads/2022/03/Under-the-Skin-2022-180x220.png",
    "11": "https://www.dramacool9.co/wp-content/uploads/2022/02/In-Your-Heart-2022-180x220.png",
    "12": "https://www.dramacool9.co/wp-content/uploads/2021/09/Youre-My-Sky-2021-180x220.png",
    "13": "https://www.dramacool9.co/wp-content/uploads/2022/02/The-War-of-Flowers-2022-180x220.png",
    "14": "https://www.dramacool9.co/wp-content/uploads/2021/09/cai-bu-yao-he-lao-ban-tan-lian-ai-180x220.png",
    "15": "https://www.dramacool9.co/wp-content/uploads/2021/09/Royal-Feast-2021-180x220.png",
    "16": "https://www.dramacool9.co/wp-content/uploads/2022/03/Sweet-Lovestory-with-You-2021-180x220.png",
    "17": "https://www.dramacool9.co/wp-content/uploads/2021/03/Hidden-Marriage-Love-2021-180x220.png",
    "18": "https://www.dramacool9.co/wp-content/uploads/2022/02/Love-Forever-After-2022-180x220.png",
    "19": "https://www.dramacool9.co/wp-content/uploads/2022/02/To.Two-2021-180x220.png",
    "20": "https://www.dramacool9.co/wp-content/uploads/2022/01/Something-in-My-Room-2022-180x220.png",
    "21": "https://www.dramacool9.co/wp-content/uploads/2022/03/Lucky-Club-2022-180x220.png",
    "22": "https://www.dramacool9.co/wp-content/uploads/2022/01/kei-yaku-abunai-aibou-180x220.png",
    "23": "https://www.dramacool9.co/wp-content/uploads/2022/03/Hokusai-to-Meshi-Sae-Areba-180x220.png",
    "24": "https://www.dramacool9.co/wp-content/uploads/2021/12/Best-Mistake-Season-3-2021-180x220.png",
    "25": "https://www.dramacool9.co/wp-content/uploads/2021/12/Best-Mistake-Season-3-2021-180x220.png",
    "26": "https://www.dramacool9.co/wp-content/uploads/2021/12/Best-Mistake-Season-3-2021-180x220.png",
    "27": "https://www.dramacool9.co/wp-content/uploads/2021/12/Best-Mistake-Season-3-2021-180x220.png",
    "28": "https://www.dramacool9.co/wp-content/uploads/2022/02/Semantic-Error-2022-180x220.png",
    "29": "https://www.dramacool9.co/wp-content/uploads/2022/02/Talking-Bones-2-2022-180x220.png",
    "30": "https://www.dramacool9.co/wp-content/uploads/2021/09/Lord-Marriage-Please-Stay-2021-180x220.png",
    "31": "https://www.dramacool9.co/wp-content/uploads/2022/03/Childe-Xies-Wine-2022-180x220.png",
    "32": "https://www.dramacool9.co/wp-content/uploads/2022/03/You-are-My-Heartbeat-2022-180x220.png"
  },
  "Title": {
    "0": "940920 (2022) ",
    "1": "Star-crossed Lovers (2022) ",
    "2": "Through the Darkness (2022) ",
    "3": "Two Conjectures About Marriage (2022) ",
    "4": "Challenges at Midlife (2022) ",
    "5": "The Second Husband (2021) ",
    "6": "The All-Round Wife (2021) ",
    "7": "First Love Again (2022) ",
    "8": "Love Twist (2021) ",
    "9": "Modern Marriage (2022) ",
    "10": "Under the Skin (2022) ",
    "11": "In Your Heart (2022) ",
    "12": "You’re My Sky (2022) ",
    "13": "The War of Flowers (2022) ",
    "14": "Legally Romance (2022) ",
    "15": "Royal Feast (2022) ",
    "16": "Sweet Lovestory with You (2021) ",
    "17": "Hidden Marriage Love (2021) ",
    "18": "Love Forever After (2022) ",
    "19": "To.Two (2021) ",
    "20": "Something in My Room (2022) ",
    "21": "Lucky Club (2022) ",
    "22": "KeiĂ—Yaku: Abunai Aibou (2022) ",
    "23": "Hokusai to Meshi Sae Areba ",
    "24": "Best Mistake Season 3 (2021) Special 5 ",
    "25": "Best Mistake Season 3 (2021) Special 4 ",
    "26": "Best Mistake Season 3 (2021) Special 3 ",
    "27": "Best Mistake Season 3 (2021)  Special 2 ",
    "28": "Best Mistake Season 3 (2021) Special 1 ",
    "29": "Semantic Error (2022) ",
    "30": "Talking Bones 2 (2022) ",
    "31": "Ms. Cupid in Love (2022) ",
    "32": "Childe Xie’s Wine (2022) ",
    "33": "You are My Heartbeat (2022) "
  },
  "Time": {
    "0": "2 hours ago",
    "1": "2 hours ago",
    "2": "3 hours ago",
    "3": "3 hours ago",
    "4": "4 hours ago",
    "5": "3 hours ago",
    "6": "4 hours ago",
    "7": "4 hours ago",
    "8": "4 hours ago",
    "9": "4 hours ago",
    "10": "8 hours ago",
    "11": "10 hours ago",
    "12": "10 hours ago",
    "13": "10 hours ago",
    "14": "11 hours ago",
    "15": "11 hours ago",
    "16": "13 hours ago",
    "17": "13 hours ago",
    "18": "14 hours ago",
    "19": "15 hours ago",
    "20": "15 hours ago",
    "21": "23 hours ago",
    "22": "23 hours ago",
    "23": "23 hours ago",
    "24": "24 hours ago",
    "25": "1 day ago",
    "26": "1 day ago",
    "27": "1 day ago",
    "28": "1 day ago",
    "29": "1 day ago",
    "30": "1 day ago",
    "31": "1 day ago",
    "32": "1 day ago",
    "33": "1 day ago"
  }
}
3 Likes

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

thank you very much. I will try your code tomorrow, I am on duty today

Why is my code not working? tell

Tell me what to do, how to get the data? when using this command I get a list of titles, I can’t get links

I get one link
document.getElementsByTagName(“img”)[0].src;

get all titles
document.getElementsByClassName(“list-episode-item”)[0].innerText

can you show how you got the result in json format? both codes do not work, I tried all the combinations that I know, the code does not work, I get the answer “null”

Okay Let me Go Home currently i am out

1 Like

Can you share the site url because there are so many

I got the reason
I not recommend to use that site
it loads a lot of ads & ads & Pop up ads & Also a warning ads
and also it shows ads with no option to close the ads and also the ads are not safe its 18+
So seriously it does not look safe at all

and when you load the url that all comes and therefore it shows that error because you are redirected to other page or site

this site is just an example. I’m not going to take data from him. I want to understand how the code works

thank you very much, you were right. The error was from the site. I tried on another site and everything works fine

So you can check the above two code and implement it to your main site

Go through to both the code

Or Else send your original site url either here or PM

1 Like

once again thank you so much for your help

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.