Created
January 11, 2023 16:37
-
-
Save cocoabox/2ed66d2868da6e3a16c6a1e3213fd21d to your computer and use it in GitHub Desktop.
steal-synopsis-from-amazon-prime-video.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async function(){ | |
const series_title = document.querySelector('[data-automation-id="title"]')?.innerText.trim(); | |
const series_synop = document.querySelector('[data-automation-id="atf-synopsis"]')?.innerText.trim(); | |
const li_arr = document.querySelectorAll('[id^="av-ep-episodes"]'); | |
let episodes = []; | |
for (const li of li_arr) { | |
const title_elem = li.querySelector('[data-automation-id^="ep-title-episodes-"]'); | |
const title_all = title_elem.innerText.trim(); | |
const title_mat = title_all.match(/^([0-9]+)\.*\s*(.*)$/); | |
if (! title_mat) { | |
console.warn("failed to match title :", title_all); | |
} | |
const ep = parseFloat(title_mat[1].trim() ?? -1); | |
const title = title_mat[2].trim(); | |
const synop_elem = li.querySelector('[data-automation-id^="synopsis-"]'); | |
const synop = synop_elem.innerText.trim(); | |
const img = li.querySelector('img'); | |
const img_href = img.src; | |
episodes.push({ep, title, synop, img_href}); | |
} | |
prompt('', JSON.stringify({series_title, series_synop, episodes})); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment