MichaelYochpaz / iSubRip

A Python command-line tool for scraping and downloading subtitles from AppleTV and iTunes movie pages.
MIT License
112 stars 15 forks source link

Downloading the subtitles from iTunes fails #1

Closed Essam311 closed 3 years ago

Essam311 commented 3 years ago

Hi, when I try to download the subtitles from iTunes for the movie "Interstellar" using your script I get this message

https://itunes.apple.com/gb/movie/interstellar-2014/id965491522

subs

Does downloading the subtitles from iTunes using your script requires purchasing the movies?

MichaelYochpaz commented 3 years ago

@Essam311 No, it doesn't require purchasing the movie. I just tested the same link and it worked fine for me. Did you install the required Python packages from requirements.txt and FFmpeg before running the script?

Essam311 commented 3 years ago

@MichaelYochpaz I Installed the requirements and FFmpeg before running the script.

jjehadtq commented 3 years ago

@Essam311 No, it doesn't require purchasing the movie. I just tested the same link and it worked fine for me. Did you install the required Python packages from requirements.txt and FFmpeg before running the script?

Same for me, and yes I downloaded the requirements and FFmpeg, I also tried many different movies and I still get "Download failed"

D-LUFFY89 commented 3 years ago

Hi, I have been trying out a iSubRip. The following message came out: what should I do ?

https://i.imgur.com/ltsykgZ.jpg

All supplies have been installed pip3 install -r requirements.txt + FFmpeg

python3 iSubRip.py https://itunes.apple.com/gb/movie/interstellar-2014/id965491522
Scarping https://itunes.apple.com/gb/movie/interstellar-2014/id965491522
Found Movie: "Interstellar (2014)"
Traceback (most recent call last):
  File "iSubRip.py", line 155, in <module>
    main()
  File "iSubRip.py", line 51, in main
    if get_subtitles(url):
  File "iSubRip.py", line 83, in get_subtitles
    for item in page_script_dict["included"]:
KeyError: 'included'
Essam311 commented 3 years ago

@MichaelYochpaz Is there likely to be missing python packages in requirements.txt like lxml for running the script on windows?

MichaelYochpaz commented 3 years ago

@Essam311 Seems like lxml was indeed missing from the requirements.txt file (it's required for beautifulsoup to run). I've updated the requirements file, but that seems to only be relevant to the original issue (where there's just a "Download failed." error), now there's seem to be an additional issue that I'm also getting.

@jjehadtq @D-LUFFY89 Seems like either the site no longer has the subtitles stored on the webpage / they moved them to a different location on the page, or iTunes started detecting and blocking page scraping.

I'll look into it once I have some free time and fix the script (if possible), but I'm pretty busy lately so it might take a while.

Essam311 commented 3 years ago

@MichaelYochpaz Seems that the site still has the subtitles.

https://play.itunes.apple.com/WebObjects/MZPlay.woa/hls/playlist.m3u8?cc=GB&a=965491522&id=236366768&l=en&aec=SD

EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subtitles_ap3",LANGUAGE="ar",NAME="العربية",AUTOSELECT=YES,FORCED=NO,STABLE-RENDITION-ID="55653e6317a4e49b7bb9b7124feea77224bee9c044764a3f07c49f052face22b",URI="https://vod-ap3-amt.tv.apple.com/itunes-assets/HLSVideo124/v4/2d/07/c9/2d07c9c5-cd6b-0bdd-0071-3ef7955c3d86/P236366768_A965491522_FF_ar_subtitles.m3u8"

EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subtitles_ak",LANGUAGE="ar",NAME="العربية",AUTOSELECT=YES,FORCED=NO,STABLE-RENDITION-ID="55653e6317a4e49b7bb9b7124feea77224bee9c044764a3f07c49f052face22b",URI="https://vod-ak-amt.tv.apple.com/itunes-assets/HLSVideo124/v4/2d/07/c9/2d07c9c5-cd6b-0bdd-0071-3ef7955c3d86/P236366768_A965491522_FF_ar_subtitles.m3u8"

And I can download the subtitles with ffmpeg.exe in SRT format using

ffmpeg -i https://vod-ap3-amt.tv.apple.com/itunes-assets/HLSVideo124/v4/2d/07/c9/2d07c9c5-cd6b-0bdd-0071-3ef7955c3d86/P236366768_A965491522_FF_ar_subtitles.m3u8 C:\subtitles\interstellar.srt

I got the link

https://play.itunes.apple.com/WebObjects/MZPlay.woa/hls/playlist.m3u8?cc=GB&a=965491522&id=236366768&l=en&aec=SD

by opening the movie's page

https://itunes.apple.com/gb/movie/interstellar-2014/id965491522

then pressing "ctrl+U" and searching for "m3u8", after that in

https://play.itunes.apple.com/WebObjects/MZPlay.woa/hls/playlist.m3u8?cc=GB\u0026a=965491522\u0026id=236366768\u0026l=en\u0026aec=SD

I replaced \u0026 with & and downloaded the link, opened "playlist.m3u8" with Notepad++ and got the subtitle's link.

N_m3u8DL-CLI could be used for downloading the subtitles in SRT format too

https://github.com/nilaoda/N_m3u8DL-CLI/releases https://github.com/nilaoda/N_m3u8DL-CLI/releases/download/2.9.7/N_m3u8DL-CLI_v2.9.7_with_ffmpeg_and_SimpleG.zip

By opening N_m3u8DL-CLI_v2.9.7.exe then pasting the subtitle's link

https://vod-ap3-amt.tv.apple.com/itunes-assets/HLSVideo124/v4/2d/07/c9/2d07c9c5-cd6b-0bdd-0071-3ef7955c3d86/P236366768_A965491522_FF_ar_subtitles.m3u8

and pressing enter.

sub1

sub2

MichaelYochpaz commented 3 years ago

@Essam311 @jjehadtq @D-LUFFY89 I've updated the script, try running it now.

Note that the site has some issues in the past few weeks (sometimes loading iTunes pages returns an error), so it could cause the script to fail sometimes at random. If the script fails try running it again after a few minutes and check if there's any difference.

Essam311 commented 3 years ago

@MichaelYochpaz Thank you so much, downloading the subtitles from itunes.apple.com working great with version v1.0.2.