{"action":"created","issue":{"url":"https://api.github.com/repos/zhangn1985/ykdl/issues/270","repository_url":"https://api.github.com/repos/zhangn1985/ykdl","labels_url":"https://api.github.com/repos/zhangn1985/ykdl/issues/270/labels{/name}","comments_url":"https://api.github.com/repos/zhangn1985/ykdl/issues/270/comments","events_url":"https://api.github.com/repos/zhangn1985/ykdl/issues/270/events","html_url":"https://github.com/zhangn1985/ykdl/issues/270","id":321631085,"number":270,"title":"优酷不能用了，显示“账号异常，需要重新登陆” ","user":{"login":"ShaoSMpet","id":25815523,"avatar_url":"https://avatars2.githubusercontent.com/u/25815523?v=4","gravatar_id":"","url":"https://api.github.com/users/ShaoSMpet","html_url":"https://github.com/ShaoSMpet","followers_url":"https://api.github.com/users/ShaoSMpet/followers","following_url":"https://api.github.com/users/ShaoSMpet/following{/other_user}","gists_url":"https://api.github.com/users/ShaoSMpet/gists{/gist_id}","starred_url":"https://api.github.com/users/ShaoSMpet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShaoSMpet/subscriptions","organizations_url":"https://api.github.com/users/ShaoSMpet/orgs","repos_url":"https://api.github.com/users/ShaoSMpet/repos","events_url":"https://api.github.com/users/ShaoSMpet/events{/privacy}","received_events_url":"https://api.github.com/users/ShaoSMpet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":44,"created_at":"2018-05-09T16:02:15Z","updated_at":"2018-05-19T09:53:59Z","closed_at":null,"author_association":"NONE","body":"\r\n"},"comment":{"url":"https://api.github.com/repos/zhangn1985/ykdl/issues/comments/390393846","html_url":"https://github.com/zhangn1985/ykdl/issues/270#issuecomment-390393846","issue_url":"https://api.github.com/repos/zhangn1985/ykdl/issues/270","id":390393846,"user":{"login":"airdge","id":7813960,"avatar_url":"https://avatars2.githubusercontent.com/u/7813960?v=4","gravatar_id":"","url":"https://api.github.com/users/airdge","html_url":"https://github.com/airdge","followers_url":"https://api.github.com/users/airdge/followers","following_url":"https://api.github.com/users/airdge/following{/other_user}","gists_url":"https://api.github.com/users/airdge/gists{/gist_id}","starred_url":"https://api.github.com/users/airdge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airdge/subscriptions","organizations_url":"https://api.github.com/users/airdge/orgs","repos_url":"https://api.github.com/users/airdge/repos","events_url":"https://api.github.com/users/airdge/events{/privacy}","received_events_url":"https://api.github.com/users/airdge/received_events","type":"User","site_admin":false},"created_at":"2018-05-19T09:53:59Z","updated_at":"2018-05-19T09:53:59Z","author_association":"NONE","body":"倒是不建议用acs接口,这个接口要事先获取 _m_h5_tk和_m_h5_tk_enc 所以必须先访问一次acs接口\r\n现在ccode=0401/0502都必须带cookies,才能正常访问\r\nacs接口需P_sck,_m_h5_tk,_m_h5_tk_enc \r\nups接口需P_sck\r\nckey只要默认的就可以 \r\n```\r\ni.ckey ? i.ckey = d.defaultUA : i.ckey = o.default.getUA();\r\n\r\n           UPS_API_URL: \"https://ups.youku.com/ups/get.json\",\r\n            OPEN_API_URL: \"https://api.youku.com/players/custom.json\",\r\n            OPEN_API_URL_TOKEN: \"https://api.youku.com/players/consume.json\",\r\n            defaultUA: \"DIl58SLFxFNndSV1GFNnMQVYkx1PP5tKe1siZu/86PR1u/Wh1Ptd+WOZsHHWxysSfAOhNJpdVWsdVJNsfJ8Sxd8WKVvNfAS8aS8fAOzYARzPyPc3JvtnPHjTdKfESTdnuTW6ZPvk2pNDh4uFzotgdMEFkzQ5wZVXl2Pf1/Y6hLK0OnCNxBj3+nb0v72gZ6b0td+WOZsHHWxysSo/0y9D2K42SaB8Y/+aD2K42SaB8Y/+ahU+WOZsHcrxysooUeND\"\r\n```\r\n\r\nccode=050F现在倒是还能用,也不需要带cookies,可以先用这个\r\n\r\n\r\n```\r\nvar https = require('https');\r\nlet ccode = '0401';\r\nlet vid = 'XMjk4NzA1OTMzNg==';\r\nvid = 'XMjk4NzA1OTMzNg==';\r\nvid = 'XMTM0Nzk3MjY4NA==';\r\nvar referer;\r\nswitch (ccode) {\r\n    case '0501':\r\n        referer = 'http://m.youku.com/v_show/id_' + vid + '.html?from=s1.8-3-1.1';\r\n        break;\r\n    case '050F':\r\n        referer = 'http://video.tudou.com/v/' + vid + '.html?t=1&seccateId=10016';\r\n        break;\r\n    default:\r\n        referer = 'http://v.youku.com/v_show/id_' + vid + '.html?from=s1.8-3-1.1';\r\n        break;\r\n}\r\nvar option = {\r\n    hostname: 'ups.youku.com',\r\n    path: '/ups/get.json?vid=' + vid + '&ccode=' + ccode + '&client_ip=0.0.0.0&client_ts=1519977544&utid=OMofE8kM4gMCARueFdD7Bexs&ckey=DIl58SLFxFNndSV1GFNnMQVYkx1PP5tKe1siZu%2F86PR1u%2FWh1Ptd%2BWOZsHHWxysSfAOhNJpdVWsdVJNsfJ8Sxd8WKVvNfAS8aS8fAOzYARzPyPc3JvtnPHjTdKfESTdnuTW6ZPvk2pNDh4uFzotgdMEFkzQ5wZVXl2Pf1%2FY6hLK0OnCNxBj3%2Bnb0v72gZ6b0td%2BWOZsHHWxysSo%2F0y9D2K42SaB8Y%2F%2BaD2K42SaB8Y%2F%2BahU%2BWOZsHcrxysooUeND',\r\n    headers: {\r\n        'Accept': '*/*',\r\n        'Accept-Encoding': 'utf-8',\r\n        'Accept-Language': 'zh-CN,zh;q=0.8',\r\n        'Connection': 'keep-alive',\r\n        'Host': 'ups.youku.com',\r\n        'User-Agent': 'Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B137 Safari/601.1',\r\n        'Cookie': 'P_sck=用户sck;(acs要带_m_h5_tk,_m_h5_tk_enc)',\r\n        'Referer': referer\r\n    }\r\n};\r\nhttps.get(option, function(res) {\r\n    data = \"\";\r\n    res.on(\"data\", function(html) {\r\n        data += html\r\n    })\r\n    res.on('end', function() {\r\n        console.log(data);\r\n        console.log(JSON.parse(data).data.stream[0].m3u8_url.replace('pl-ali.youku.com', 'pl.cp31.ott.cibntv.net'))\r\n    })\r\n})\r\n```\r\n另外上面提到的\r\n`http://ups.youku.com/ups/get.json?callback=json1526721917&vid=XMjk4NzA1OTMzNg%3D%3D&ccode=01010101&client_ip=192.168.1.1&utid=Wv%2FtUnMhvDADAGooPXGs1Stz&client_ts=1526721917&ckey=7B19C0AB12633B22E7FE81271162026020570708D6CC189E4924503C49D243A0DE6CD84A766832C2C99898FC5ED31F3709BB3CDD82C96492E721BDD381735026&_=1526721916574`\r\n这类ccode以01/02开头app链接,其utid为Android/Ios设备deviceid,非eg.js生成cna\r\n封禁了就不能用,可以用虚拟机获取,不过相对麻烦\r\n\r\n要想稳定,还是让用户带cookies下载 \r\n\r\n \r\n\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"airdge"}}