ERROR: Youku server reported error -6001: ccode参数错误 #25415

Open
opened 2026-02-21 13:47:47 -05:00 by deekerman · 6 comments
Owner

Originally created by @sisenming on GitHub (Aug 7, 2022).

Checklist

  • I'm reporting a broken site support issue
  • I've verified that I'm running youtube-dl version 2021.12.17
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar bug reports including closed ones
  • I've read bugs section in FAQ

Verbose log

PASTE VERBOSE LOG HERE

Description

WRITE DESCRIPTION HERE

Originally created by @sisenming on GitHub (Aug 7, 2022). <!-- ###################################################################### WARNING! IGNORING THE FOLLOWING TEMPLATE WILL RESULT IN ISSUE CLOSED AS INCOMPLETE ###################################################################### --> ## Checklist <!-- Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl: - First of, make sure you are using the latest version of youtube-dl. Run `youtube-dl --version` and ensure your version is 2021.12.17. If it's not, see https://yt-dl.org/update on how to update. Issues with outdated version will be REJECTED. - Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser. - Make sure that all URLs and arguments with special characters are properly quoted or escaped as explained in http://yt-dl.org/escape. - Search the bugtracker for similar issues: http://yt-dl.org/search-issues. DO NOT post duplicates. - Read bugs section in FAQ: http://yt-dl.org/reporting - Finally, put x into all relevant boxes (like this [x]) --> - [ ] I'm reporting a broken site support issue - [x] I've verified that I'm running youtube-dl version **2021.12.17** - [ ] I've checked that all provided URLs are alive and playable in a browser - [ ] I've checked that all URLs and arguments with special characters are properly quoted or escaped - [ ] I've searched the bugtracker for similar bug reports including closed ones - [ ] I've read bugs section in FAQ ## Verbose log <!-- Provide the complete verbose output of youtube-dl that clearly demonstrates the problem. Add the `-v` flag to your command line you run youtube-dl with (`youtube-dl -v <your command line>`), copy the WHOLE output and insert it below. It should look similar to this: [debug] System config: [] [debug] User config: [] [debug] Command-line args: [u'-v', u'http://www.youtube.com/watch?v=BaW_jenozKcj'] [debug] Encodings: locale cp1251, fs mbcs, out cp866, pref cp1251 [debug] youtube-dl version 2021.12.17 [debug] Python version 2.7.11 - Windows-2003Server-5.2.3790-SP2 [debug] exe versions: ffmpeg N-75573-g1d0487f, ffprobe N-75573-g1d0487f, rtmpdump 2.4 [debug] Proxy map: {} <more lines> --> ``` PASTE VERBOSE LOG HERE ``` ## Description <!-- Provide an explanation of your issue in an arbitrary form. Please make sure the description is worded well enough to be understood, see https://github.com/ytdl-org/youtube-dl#is-the-description-of-the-issue-itself-sufficient. Provide any additional information, suggested solution and as much context and examples as possible. If work on your issue requires account credentials please provide them or explain how one can obtain them. --> WRITE DESCRIPTION HERE
Author
Owner

@dirkf commented on GitHub (Aug 8, 2022):

PASTE VERBOSE LOG HERE

Please do it

@dirkf commented on GitHub (Aug 8, 2022): >PASTE VERBOSE LOG HERE Please do it
Author
Owner

@LennaHammer commented on GitHub (Aug 19, 2022):

See https://github.com/ytdl-org/youtube-dl/issues/28460 .

The ccode parameter need to be updated, as the server often chooses another value regularly.

I don't know how to find the new ccode. According to this file youku-player.min.js, it probably is 050F now on August 19, 2022.

You may try this value locally, it often changes.

@LennaHammer commented on GitHub (Aug 19, 2022): See https://github.com/ytdl-org/youtube-dl/issues/28460 . The `ccode` parameter need to be updated, as the server often chooses another value regularly. I don't know how to find the new `ccode`. According to this file [youku-player.min.js](http://g.alicdn.com/player/ykplayer/0.5.64/youku-player.min.js), it probably is `050F` now on August 19, 2022. You may try this value locally, it often changes.
Author
Owner

@dirkf commented on GitHub (Aug 19, 2022):

Is there something about this site that stops people mentioning its page URLs?

Anyhow at https://v.youku.com/v_show/id_XNDk5MTEwNDczNg==.html, after breaking through the bot guard (which I could only do once), the page uses React. In its window.__INITIAL_DATA__ hydration json, .config.source.playerSDK.url has the value g.alicdn.com/kplayer/kuplayer/4.1.8-xmedia/index.js. In that JS a ccode is set to 0502. In the linked youku-player.min.js and in the g.alicdn.com/player/beta-ykplayer/1.11.1/youku-player.min.js that is the value of .config.source.padPlayerSDK.url, there is code that tests ccode to select the logging URL event type, with 050F selecting a newtudou.web.event.

@dirkf commented on GitHub (Aug 19, 2022): Is there something about this site that stops people mentioning its page URLs? Anyhow at https://v.youku.com/v_show/id_XNDk5MTEwNDczNg==.html, after breaking through the bot guard (which I could only do once), the page uses React. In its `window.__INITIAL_DATA__` hydration json, `.config.source.playerSDK.url` has the value `g.alicdn.com/kplayer/kuplayer/4.1.8-xmedia/index.js`. In that JS a `ccode` is set to `0502`. In the linked youku-player.min.js and in the `g.alicdn.com/player/beta-ykplayer/1.11.1/youku-player.min.js` that is the value of `.config.source.padPlayerSDK.url`, there is code that tests `ccode` to select the logging URL event type, with `050F` selecting a `newtudou.web.event`.
Author
Owner

@LennaHammer commented on GitHub (Aug 19, 2022):

Thank you for those valuable clues.

Unfortunately, neither 0502 nor 050F works on my computer. I replace the old value with the new one and try to download this URL, but then it still fails.

Every time an election will happen in China, some websites there will change their anti-crawl mechanism to avoid leaking unexpected information to automatic spiders. It's very boring for adjusting the downloader script at this time because they may change their mechanism as soon as the script is updated.

Well, maybe I am wrong. I just want to complain about this, as I don't want anyone to waste their time on this tedious thing. I've tried and I've no idea how to update the script any further.

I think a possible solution is to use a web browser to load this website and monitor the network when the media is playing if youtube-dl had offered some API to try in this way.

If I can do anything helpful, please let me know.

@LennaHammer commented on GitHub (Aug 19, 2022): Thank you for those valuable clues. Unfortunately, neither `0502` nor `050F` works on my computer. I replace the old value with the new one and try to download this URL, but then it still fails. Every time an election will happen in China, some websites there will change their anti-crawl mechanism to avoid leaking unexpected information to automatic spiders. It's very boring for adjusting the downloader script at this time because they may change their mechanism as soon as the script is updated. Well, maybe I am wrong. I just want to complain about this, as I don't want anyone to waste their time on this tedious thing. I've tried and I've no idea how to update the script any further. I think a possible solution is to use a web browser to load this website and monitor the network when the media is playing if `youtube-dl` had offered some API to try in this way. If I can do anything helpful, please let me know.
Author
Owner

@LennaHammer commented on GitHub (Aug 22, 2022):

I've just written a downloader script for myself using selenium. It works well for me.

The old script is broken due to the new authentication mechanism, and it seems hard to walk around it.

if youtube-dl offers some APIs to integrate selenium, I think I can adapt it very soon.

The following code is using ruby just for a demonstration:

require 'selenium-webdriver'
require 'yaml'
require 'fileutils'
FileUtils.mkdir_p 'download'
driver = Selenium::WebDriver.for :chrome
driver.navigate.to('https://v.youku.com')
if File.exist? 'cookies.yml'
  open('cookies.yml', 'r') do |f|
    YAML.load(f).each do |e|
      driver.manage.add_cookie(name: e[:name], value: e[:value])
    end
  end
end
driver.intercept do |request, &continue|
  if request.url.include?('mtop.youku.play.ups.appinfo.get')
    continue.call(request) do |response|
      text = response.body[/\{.*\}/]
      data = JSON.load(text)
      begin
        data = data['data']['data']
        p user_name = data['uploader']['username']
        p title = data['video']['title'].strip
        p video_id = data['video']['encodeid']
        p m3u8_url = data['stream'].reverse.max_by { |e| e['height'] }['m3u8_url']
        filename = "download/[#{user_name}][#{video_id}]#{title}.mp4"
        if !File.exist?(filename) && !File.exist?(filename + '.log') && !File.exist?(filename + '.part')
          open(filename + '.log', 'w').close
          File.unlink(filename + '.log') if system('youtube-dl', '-o', filename, m3u8_url)
        else
          puts "skip #{filename}"
        end
      rescue StandardError => e
        p e
      end
    end
  else
    continue.call(request)
  end
end
driver.navigate.to('https://v.youku.com/v_show/id_XNDk5MTEwNDczNg==.html')
open('cookies.yml', 'w') { |f| f.write YAML.dump driver.manage.all_cookies }
gets
@LennaHammer commented on GitHub (Aug 22, 2022): I've just written a downloader script for myself using selenium. It works well for me. The old script is broken due to the new authentication mechanism, and it seems hard to walk around it. if youtube-dl offers some APIs to integrate selenium, I think I can adapt it very soon. The following code is using ruby just for a demonstration: ```ruby require 'selenium-webdriver' require 'yaml' require 'fileutils' FileUtils.mkdir_p 'download' driver = Selenium::WebDriver.for :chrome driver.navigate.to('https://v.youku.com') if File.exist? 'cookies.yml' open('cookies.yml', 'r') do |f| YAML.load(f).each do |e| driver.manage.add_cookie(name: e[:name], value: e[:value]) end end end driver.intercept do |request, &continue| if request.url.include?('mtop.youku.play.ups.appinfo.get') continue.call(request) do |response| text = response.body[/\{.*\}/] data = JSON.load(text) begin data = data['data']['data'] p user_name = data['uploader']['username'] p title = data['video']['title'].strip p video_id = data['video']['encodeid'] p m3u8_url = data['stream'].reverse.max_by { |e| e['height'] }['m3u8_url'] filename = "download/[#{user_name}][#{video_id}]#{title}.mp4" if !File.exist?(filename) && !File.exist?(filename + '.log') && !File.exist?(filename + '.part') open(filename + '.log', 'w').close File.unlink(filename + '.log') if system('youtube-dl', '-o', filename, m3u8_url) else puts "skip #{filename}" end rescue StandardError => e p e end end else continue.call(request) end end driver.navigate.to('https://v.youku.com/v_show/id_XNDk5MTEwNDczNg==.html') open('cookies.yml', 'w') { |f| f.write YAML.dump driver.manage.all_cookies } gets ```
Author
Owner

@dirkf commented on GitHub (Aug 22, 2022):

If we know what the intercepted request is, we can potentially make it, using cookies from visiting https://v.youku.com, and parse the result.

@dirkf commented on GitHub (Aug 22, 2022): If we know what the intercepted request is, we can potentially make it, using cookies from visiting https://v.youku.com, and parse the result.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#25415
No description provided.