我正在尝试使用YouTube视频播放链接从其他服务器获取数据,但我收到此错误:
无法加载
重定向来自' https://r12---sn-aigllnd7.googlevideo.com/videoplayback?requiressl=yes&clen=2193105&signature=109DA57913EC4535C3AC8FB84356B9ABCD11D6C4.A8547FC1740F9913D3FEB1335605AF3477F2BA88&ipbits=0&mime=video%2Fmp4&initcwndbps=2508750&itag=18&ratebypass=yes&expire=1509471177&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&key=yt6&beids=%5B9466593%5D&gir=yes&id=o-AK9XTzJjMCSwyCVnb7md1uikHohpJqRX-MzC6VOT3BNa&mn=sn-aigllnd7&mm=31&pl=48&dur=28.560&lmt=1500337266737259&ip=2a02%3A4780%3Abad%3A16%3Afced%3A1ff%3Afe16%3A333&ms=au&ei=aV_4WabyCcTckAOJ_IHoBQ&mt=1509449472&mv=m&source=youtube'到' https://r2---sn-ug5onfvgaq-aixl.googlevideo.com/videoplayback?requiressl=yes&clen=2193105&signature=2E5AA33529609CA727EB8BE12AA33FBDAAFA116F.02E023B012CCA899379E83DAC38CF55D9072907D&ipbits=0&mime=video%2Fmp4&itag=18&ratebypass=yes&expire=1509471177&sparams=clen,dur,ei,expire,gir,id,initcwndbps,ip,ipbits,ipbypass,itag,lmt,mime,mip,mm,mn,ms,mv,pl,ratebypass,requiressl,source&key=cms1&beids=%5B9466593%5D&gir=yes&id=o-AK9XTzJjMCSwyCVnb7md1uikHohpJqRX-MzC6VOT3BNa&pl=24&dur=28.560&lmt=1500337266737259&ip=2a02%3A4780%3Abad%3A16%3Afced%3A1ff%3Afe16%3A333&ei=aV_4WabyCcTckAOJ_IHoBQ&source=youtube&redirect_counter=1&rm=sn-aigeez7s&fexp=9466587&req_id=7a988fa941a7a3ee&cms_redirect=yes&ipbypass=yes&mip=210.56.10.190&mm=31&mn=sn-ug5onfvgaq-aixl&ms=au&mt=1509449472&mv=m'
已被CORS政策阻止:No' Access-Control-Allow-Origin'标头出现在请求的资源上。起源' http://localhost'因此不允许访问。
你能告诉我如何解决这个错误。 谢谢你宝贵的时间。
答案 0 :(得分:0)
在服务器端启用了CORS,因此您无法在代码上修复此问题。在某些情况下,您可以尝试使用 JSONP 的请求类型,但在这种情况下不会。