seanap / Audible.com-Search-by-Album

Mp3tag Web Sources Scripts
84 stars 17 forks source link

Not pulling in or saving Subtitle #36

Open brianbeergod opened 8 months ago

brianbeergod commented 8 months ago

tl;dr the Subtitle is not being grabbed or saved properly.

I've honestly been trying to fix this for about 3-4 hours and I just can't get it to work. I tried messing with

# Set Album and correct Audible quirks
findline "<h1  class=\"bc-heading"
joinuntil "authorLabel"
findinline ">"
findinline ":" 1 1
movechar -1
if ":"
    findline "<h1  class=\"bc-heading"
    joinuntil "authorLabel"
    findinline ">"
    outputto "Album"
    regexpreplace "</?[^><]+>" ""
    unspace
    regexpreplace "  +" " "
    sayuntil ":"
    outputto "subtitle"
    movechar 2
    sayuntil "<"
else
    findline "<h1  class=\"bc-heading"
    joinuntil "authorLabel"
    findinline ">" 1 1
    outputto "Album"
    sayuntil "<"
endif

# Subtitle of Album
regexpreplace "  +" " "
replace "<span class=\"bc-text bc-size-medium\" ></span>" ""
findinline "bc-text bc-size-medium\" " 1 1
if ">"
    movechar 1
    outputto "Subtitle"
    sayuntil "<"
else
    gotoline 1
endif

in any way - it either breaks the album search - or cannot find the Subtitle.

I've been using a few different audiobooks and I can't get it to pull it out in any of them. (Testing ASINs: 0062877879, B0B8JSM6TT, 1250818125)

Here is the output that it's grabbing if that helps:

Script-Line    : 153
Command        : regexpreplace
Parameter 1    : >  +<
Parameter 2    : > <

Output         : >The Right Swipe<

Line and position:
<h1 class="bc-heading bc-color-base bc-size-large bc-text-bold" tabIndex='0' role='tabPanel'>The Right Swipe</h1> </li> <li class="bc-list-item  bc-spacing-s2" > <span class="bc-text bc-size-medium" tabIndex='0' role='tabpanel' tabIndex='0' role='tabpanel'>A Novel</span> </li> <li class="bc-list-item   authorLabel" tabIndex='0' role='tabpanel'>
^

So in this use case, I would want "A Novel" saved as the subtitle, but it seems to be grabbing the title "The Right Swipe" instead.

I also have a feeling you're going to have to add something like:

findline ", \"subtitle\": \""
        unspace
        findinline ": \""
        outputto "Subtitle"
        sayuntil "\""

to a similar spot to where I added the image one last night/this morning

Sorry for the long-winded message - I wanted to make sure you had all of the info and some of the methods I tried.

brianbeergod commented 8 months ago

Okay, so I need to modify this,

I didn't realize my mistakes - I'm fighting with some other code.

But using this ASIN as an example: 1250818125

It's still not pulling in "A Novel"

But if I use 0062877879

it pulls in this as the subtitle as well (which I'm fine with) Modern Love (Rai), Book 1

Is there a way it can be toggled (if it's a series - use the series to do the subtitle - if it's a standalone - use the subtitle that was on audible?)

I hope this makes more sense, sorry for the confusion above - it was the Series that was really messing with me more than the code I used.