Closed fboumol closed 2 years ago
Hi @fboumol, that sounds right. I added it in the latest comment. Give it a try!
Thank you. It works great.
Unfortunately, it is not working the following command (running it in the shell)
series="/tv_aTo2Mjs.html"; epi="1.1"
urlvideo=$(./soap2day-dl.sh -p "${series}" -e "${epi}" -l)
urlsubtitle=$(./soap2day-dl.sh -p "${series}" -e "${epi}" -s -l)
mpv --sub-file="${urlsubtitle}" "${urlvideo}"
The reason is that urlsubtitle
is in the domain soap2day, and it requires the right headers to acces them (even curl
without the right headers does not allow to download the subtitle). But it works if one uses the cookie information provided by soap2day, i.e., using
series="/tv_aTo2Mjs.html"; epi="1.1"
urlvideo=$(./soap2day-dl.sh -p "${series}" -e "${epi}" -l)
urlsubtitle=$(./soap2day-dl.sh -p "${series}" -e "${epi}" -s -l)
# the right values for xxx and yyy can be obtained looking at the javascript console (in chromium, firefox, ...) when accessing soap2day domain
headers=( 'User-Agent: xxx','Cookie: yyy' )
mpv --http-header-fields="${headers[@]}" --sub-file="${urlsubtitle}" "${urlvideo}"
it works. But unfortunately one needs to find the right value of "yyy" (while "xxx" can be constant), and I only know how to get it using a non automatic way (i.e., looking myself in the firerox javascript console).
Can your code of the file "getResponse.js" be easily modified to also provide in its json output the headers information your code uses? I am not familiar enough with puppeteer to know how to do it.
I suspect that an obvious advantage of providing this info would be that the shell script can be easily modified to be faster (only the first download would require the use of puppeteer).
Hi @fboumol, right. You could use this https://github.com/KevCui/soap2day-dl/blob/840172c088ec20f8cb2b1cea0354b12426eed1bb/bin/getCookie.js to download cookies.
Awesome, it works like a charm.
One last wondering around puppeteer. Is there any documentation (manual, reference, web pages, etc) you could suggest me to read to understand why your code works? I am looking for first-hand experience, something you have benefited from.
Hi @fboumol, good to hear that it works for you! Regarding Puppeteer
doc, you could check their official site https://pptr.dev/#?product=Puppeteer or visit their current API doc https://github.com/puppeteer/puppeteer/blob/v13.3.2/docs/api.md.
I would expect that when the options
-s
and-l
are present then the answer should be the link of the subtitle instead of the link of the video.Indeed, perhaps it is better to add some command line option
--json
(or simply '-j
) to get all the information related to the episode: video link, links of all subtitles, etc. Indeed, when this software is run with the-d
flag (for debugging) this "json" information is shown in the terminal.