ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.22k stars 9.94k forks source link

Funimation extractor is broken #21787

Open AlexBlandin opened 5 years ago

AlexBlandin commented 5 years ago

Checklist

Verbose log

[debug] System config: []
[debug] User config: ['--restrict-filenames', '-f', '299+251/bestvideo+251/bestvideo+bestaudio/best', '-o', 'C:\\Users\\me\\Videos\\%(title)s.%(ext)s']
[debug] Custom config: []
[debug] Command-line args: ['https://www.funimation.com/shows/death-parade/death-seven-darts/?qid=b97f9d167bf5c72b', '--verbose']
[debug] Encodings: locale cp1252, fs mbcs, out cp850, pref cp1252
[debug] youtube-dl version 2019.07.14
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.17134
[debug] exe versions: ffmpeg N-92712-g011c9112a0, ffprobe N-92712-g011c9112a0
[debug] Proxy map: {}
[Funimation] death-seven-darts: Downloading webpage
[Funimation] 159505: Downloading JSON metadata
ERROR: An extractor error has occurred. (caused by KeyError('items',)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmphq4ewlx_\build\youtube_dl\extractor\common.py", line 530, in extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmphq4ewlx_\build\youtube_dl\extractor\funimation.py", line 117, in _real_extract
KeyError: 'items'
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmphq4ewlx_\build\youtube_dl\extractor\common.py", line 530, in extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmphq4ewlx_\build\youtube_dl\extractor\funimation.py", line 117, in _real_extract
KeyError: 'items'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmphq4ewlx_\build\youtube_dl\YoutubeDL.py", line 796, in extract_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmphq4ewlx_\build\youtube_dl\extractor\common.py", line 543, in extract
youtube_dl.utils.ExtractorError: An extractor error has occurred. (caused by KeyError('items',)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Description

Funimation pages are broken. Manually extracting the video URL still works.

Just a heads up.

Dwin357 commented 4 years ago

I just want to ++ this thread for version 2020.07.28

[debug] User config: [] [debug] Custom config: [] [debug] Command-line args: [u'--verbose', u'-u', u'PRIVATE', u'-p', u'PRIVATE', u'--cookies', u'/home/dwin/Desktop/anime/funimation_cookies.txt', u'https://www.funimation.com/shows/kinos-journey-the-beautiful-world-the-animated-series/a-country-where-people-can-kill-others/uncut/?lang=english'] [debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8 [debug] youtube-dl version 2020.07.28 [debug] Python version 2.7.17 (CPython) - Linux-4.15.0-112-generic-x86_64-with-Ubuntu-18.04-bionic [debug] exe versions: ffmpeg 3.4.8, ffprobe 3.4.8, phantomjs 2.1.1, rtmpdump 2.4 [debug] Proxy map: {} [Funimation] Logging in [Funimation] a-country-where-people-can-kill-others: Downloading webpage [Funimation] 592163: Downloading JSON metadata ERROR: An extractor error has occurred. (caused by KeyError(u'items',)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. Traceback (most recent call last): File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 530, in extract ie_result = self._real_extract(url) File "/usr/local/bin/youtube-dl/youtube_dl/extractor/funimation.py", line 117, in _real_extract })['items'] KeyError: u'items' Traceback (most recent call last): File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 797, in extract_info ie_result = ie.extract(url) File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 543, in extract raise ExtractorError('An extractor error has occurred.', cause=e) ExtractorError: An extractor error has occurred. (caused by KeyError(u'items',)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

NobleKangaroo commented 3 years ago

As @jnaypauer's #27845 (for the same issue) went AWOL for an unknown reason, I'll post my findings here.

Changing line 117 from:

                })['items']

to:

                })
            import json
            print(f"Sources: {json.dumps(sources, indent=4)}")
            sources = sources['items']

and running C:\Users\NobleKangaroo\Downloads\youtube-dl\youtube-dl>python3 __main__.py -u XXXXXXXX@XXX.XXX -p XXXXXXXX --cookies cookies.txt https://www.funimation.com/shows/black-butler/his-butler-able/

results in the following output:

Sources: {
    "errors": [
        {
            "existingStreamDevice": "Web",
            "code": 6,
            "detail": "Uh oh! Your account is being accessed by too many devices. You can only stream to 1 screens at a time. To continue watching this video, stop playing video on one of the devices below:\nWeb",
            "subscriptionProduct": {
                "id": 1,
                "title": "Free",
                "description": "Free/basic user",
                "tier": 10,
                "streamLimit": 1,
                "mostPopular": false,
                "createdDatetime": "2019-04-16T14:38:48.936895Z",
                "modifiedDatetime": "2019-08-12T20:56:52.208968Z"
            },
            "title": "Exceeded stream limit."
        }
    ]
}

Simply put, free accounts can only have a single "screen" viewing at any given time. Before trying to download with youtube-dl, you need to close your browser window. I've also found that you may need to wait a minute or two for Funimation site to realize that the device isn't still streaming before the download will begin working.

Other thoughts: We could add a try ... except to this and display any errors to the user.

jnaypauer commented 3 years ago

@NobleKangaroo thanks for continuing here. My account is brand new and apparently got flagged somehow, which is probably why my original issue disappeared. I opened a support ticket and they said it's resolved, but I'm still flagged. Cool.

Anyways, I am having no such luck with your solution above. I do have a free account, but no amount of time in between obtaining my cookies file and closing the browser so that the website drops my viewing device works. I continue to get the exact same error KeyError('items',). Were you successful in "waiting" some time before downloading?

Thanks

JJDelisle commented 3 years ago

Same issue. However, I was able to download one episode of a show but not the next.