├── .gitignore ├── video-url-parser-master ├── .gitignore ├── .npmignore ├── .travis.yml ├── index.js ├── .version ├── test │ ├── index.js │ ├── index.html │ └── video-url-parser.js ├── package.json ├── LICENSE ├── src │ └── cn-video-url-parser.js ├── example │ └── cn.html └── README.md ├── .gitattributes ├── preview ├── GIF.gif ├── png1.png ├── png2.png └── png_new_1.png ├── youkuvod-master ├── data │ └── 001.png ├── ckplayer │ ├── style.swf │ ├── ckplayer.swf │ ├── share │ │ ├── qq.png │ │ ├── rr.png │ │ ├── msn.png │ │ ├── qq2.png │ │ ├── qzone.png │ │ ├── sina.png │ │ ├── sohu.png │ │ ├── feixin.png │ │ ├── google.png │ │ ├── tianya.png │ │ └── kaixin001.png │ ├── share.xml │ ├── language.xml │ └── related.xml ├── README.md ├── .gitignore └── htmltest │ └── index.html ├── main ├── VideoJs_ie6 │ ├── js │ │ ├── video-js.swf │ │ └── videojs-segment.js │ └── index.html ├── index.php ├── Constants.php ├── example1.php ├── example2.php ├── class │ └── Ep.php └── example3.php ├── test ├── start4.php ├── start3.php ├── start1.php └── start2.php ├── js ├── getSid_Token.php ├── test.md ├── getJson.php ├── rc4.php ├── testGetFileSrc.php └── translate.php ├── Requests-master ├── .coveralls.yml ├── .gitignore ├── library │ └── Requests │ │ ├── Exception │ │ ├── Transport.php │ │ ├── HTTP │ │ │ ├── 410.php │ │ │ ├── 403.php │ │ │ ├── 404.php │ │ │ ├── 409.php │ │ │ ├── 305.php │ │ │ ├── 400.php │ │ │ ├── 502.php │ │ │ ├── 304.php │ │ │ ├── 401.php │ │ │ ├── 306.php │ │ │ ├── 406.php │ │ │ ├── 402.php │ │ │ ├── 408.php │ │ │ ├── 411.php │ │ │ ├── 501.php │ │ │ ├── 504.php │ │ │ ├── 405.php │ │ │ ├── 412.php │ │ │ ├── 417.php │ │ │ ├── 503.php │ │ │ ├── 414.php │ │ │ ├── 500.php │ │ │ ├── 415.php │ │ │ ├── 413.php │ │ │ ├── 505.php │ │ │ ├── 407.php │ │ │ ├── 416.php │ │ │ ├── 418.php │ │ │ ├── 428.php │ │ │ ├── 431.php │ │ │ ├── 511.php │ │ │ ├── 429.php │ │ │ └── Unknown.php │ │ ├── Transport │ │ │ └── cURL.php │ │ └── HTTP.php │ │ ├── Hooker.php │ │ ├── Auth.php │ │ ├── Proxy.php │ │ ├── Utility │ │ ├── FilteredIterator.php │ │ └── CaseInsensitiveDictionary.php │ │ ├── Exception.php │ │ ├── Transport.php │ │ ├── Hooks.php │ │ ├── Auth │ │ └── Basic.php │ │ ├── Response │ │ └── Headers.php │ │ ├── Response.php │ │ ├── Proxy │ │ └── HTTP.php │ │ ├── Cookie │ │ └── Jar.php │ │ ├── SSL.php │ │ └── IPv6.php ├── tests │ ├── Transport │ │ ├── cURL.php │ │ └── fsockopen.php │ ├── utils │ │ └── proxy │ │ │ ├── stop.sh │ │ │ ├── proxy.py │ │ │ └── start.sh │ ├── phpunit.xml.dist │ ├── Response │ │ └── Headers.php │ ├── Auth │ │ └── Basic.php │ ├── Encoding.php │ ├── IDNAEncoder.php │ ├── ChunkedEncoding.php │ ├── SSL.php │ ├── Proxy │ │ └── HTTP.php │ ├── Requests.php │ └── bootstrap.php ├── examples │ ├── get.php │ ├── post.php │ ├── basic-auth.php │ ├── cookie.php │ ├── timeout.php │ ├── cookie_jar.php │ ├── proxy.php │ ├── session.php │ └── multiple.php ├── composer.json ├── docs │ ├── proxy.md │ ├── README.md │ ├── authentication.md │ ├── goals.md │ ├── authentication-custom.md │ ├── usage-advanced.md │ ├── hooks.md │ └── usage.md ├── .travis.yml ├── bin │ └── create_pear_package.php ├── package.xml.tpl ├── LICENSE └── README.md ├── Youku-m3u8-php-master ├── README.md └── youku-m3u8.php ├── new ├── main.php ├── test.php └── index.php ├── parse └── index.php ├── readme.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ -------------------------------------------------------------------------------- /video-url-parser-master/.gitignore: -------------------------------------------------------------------------------- 1 | ##过滤文件夹 2 | node_modules -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-language=PHP 2 | *.css linguist-language=PHP -------------------------------------------------------------------------------- /video-url-parser-master/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .gitignore 3 | .version 4 | test -------------------------------------------------------------------------------- /preview/GIF.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weituotian/youku_parse/HEAD/preview/GIF.gif -------------------------------------------------------------------------------- /preview/png1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weituotian/youku_parse/HEAD/preview/png1.png -------------------------------------------------------------------------------- /preview/png2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weituotian/youku_parse/HEAD/preview/png2.png -------------------------------------------------------------------------------- /preview/png_new_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weituotian/youku_parse/HEAD/preview/png_new_1.png -------------------------------------------------------------------------------- /youkuvod-master/data/001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weituotian/youku_parse/HEAD/youkuvod-master/data/001.png -------------------------------------------------------------------------------- /main/VideoJs_ie6/js/video-js.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weituotian/youku_parse/HEAD/main/VideoJs_ie6/js/video-js.swf -------------------------------------------------------------------------------- /test/start4.php: -------------------------------------------------------------------------------- 1 | 3 | * version: <%= pkg.version %> 4 | * author: <%= pkg.author %> 5 | * home: <%= pkg.homepage %> 6 | * description: <%= pkg.description %> 7 | */ 8 | -------------------------------------------------------------------------------- /Requests-master/tests/utils/proxy/proxy.py: -------------------------------------------------------------------------------- 1 | def request(context, flow): 2 | flow.request.headers["x-requests-proxy"] = "http" 3 | 4 | def response(context, flow): 5 | flow.response.headers[b"x-requests-proxied"] = "http" -------------------------------------------------------------------------------- /Youku-m3u8-php-master/README.md: -------------------------------------------------------------------------------- 1 | # Youku m3u8 parser - lcz970 2 | 3 | 4 | 5 | 优酷m3u8解析 php 2015 6 | 7 | 使用:?vid=[$vid] 8 | 9 | 解析后返回的url末尾的type=mp4(高清)可替换为type=flv(标清)、type=hd2(超清)、type=hd3(1080p) 10 | 11 | 12 | 部分代码来自keygle/parseVideo(https://github.com/keygle/parseVideo) -------------------------------------------------------------------------------- /video-url-parser-master/test/index.js: -------------------------------------------------------------------------------- 1 | var fs = require("fs"), 2 | path = require("path"), 3 | dir = __dirname, 4 | ignore = ["index.js", "index.html"]; 5 | 6 | fs.readdirSync(dir).forEach(function(filename) { 7 | if (ignore.indexOf(filename) !== -1) return; 8 | describe("test " + filename, require("./" + filename)); 9 | }); -------------------------------------------------------------------------------- /new/main.php: -------------------------------------------------------------------------------- 1 | '; 11 | 12 | require_once "YoukuVideo.php"; 13 | $youkuVideo = new YoukuVideo('XMzQ3ODQ0OTA2MA=='); 14 | 15 | echo "
"; 16 | echo "finish!"; -------------------------------------------------------------------------------- /Requests-master/examples/get.php: -------------------------------------------------------------------------------- 1 | 'application/json')); 11 | 12 | // Check what we received 13 | var_dump($request); -------------------------------------------------------------------------------- /parse/index.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Requests-master/examples/post.php: -------------------------------------------------------------------------------- 1 | 'something')); 11 | 12 | // Check what we received 13 | var_dump($request); -------------------------------------------------------------------------------- /Requests-master/tests/utils/proxy/start.sh: -------------------------------------------------------------------------------- 1 | PROXYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 2 | PORT=${PORT:-9000} 3 | 4 | PROXYBIN=${PROXYBIN:-"$(which mitmdump)"} 5 | ARGS="-s '$PROXYDIR/proxy.py' -p $PORT" 6 | if [[ ! -z "$AUTH" ]]; then 7 | ARGS="$ARGS --singleuser=$AUTH" 8 | fi 9 | PIDFILE="$PROXYDIR/proxy.pid" 10 | 11 | start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --exec $PROXYBIN -- $ARGS 12 | -------------------------------------------------------------------------------- /Requests-master/examples/basic-auth.php: -------------------------------------------------------------------------------- 1 | array('someuser', 'password') 12 | ); 13 | $request = Requests::get('http://httpbin.org/basic-auth/someuser/password', array(), $options); 14 | 15 | // Check what we received 16 | var_dump($request); -------------------------------------------------------------------------------- /Requests-master/examples/cookie.php: -------------------------------------------------------------------------------- 1 | $c->formatForHeader())); 14 | 15 | // Check what we received 16 | var_dump($request); -------------------------------------------------------------------------------- /Requests-master/library/Requests/Exception/HTTP/410.php: -------------------------------------------------------------------------------- 1 | 2.5, 12 | ); 13 | 14 | // Now let's make a request to a page that will delay its response by 3 seconds 15 | $request = Requests::get('http://httpbin.org/delay/3', array(), $options); 16 | 17 | // An exception will be thrown, stating a timeout of the request ! 18 | -------------------------------------------------------------------------------- /Requests-master/library/Requests/Exception/HTTP/306.php: -------------------------------------------------------------------------------- 1 | get_json(); 13 | var_dump($json) 14 | ``` 15 | $json 是一个array, 优酷返回来的视频info,有很多关于视频的信息,按需处理吧 16 | 17 | ## 整合 18 | 19 | ### 整合到CI框架 20 | 复制`new/YoukuVideo.php`到library目录上,根据框架的文档调用这个类 21 | 22 | ### 整合到ThinkPHP 23 | 就一个`new/YoukuVideo.php`文件 24 | 25 | 26 | ## 例子 new/index.php (分析下载链接) 27 | 28 | ![](preview/png_new_1.png) -------------------------------------------------------------------------------- /Requests-master/library/Requests/Exception/HTTP/414.php: -------------------------------------------------------------------------------- 1 | 如果刷新3次都没有, 请反馈~~ 11 | 12 | ###2. 第一次使用请允点击许"访问域名", 如下图所示: 13 | ![](https://raw.githubusercontent.com/xinshangshangxin/youkuvod/master/data/001.png) 14 | ~~###3. 设置按钮在左边,详细设置在右边~~ 15 | ~~###4. 设置内容包括: 默认清晰度;播放器服务器~~ 16 | ###5. 偶尔会遇到拖动失败(因为视频是分割的) -------------------------------------------------------------------------------- /Requests-master/library/Requests/Exception/HTTP/505.php: -------------------------------------------------------------------------------- 1 | =5.2" 15 | }, 16 | "require-dev": { 17 | "requests/test-server": "dev-master" 18 | }, 19 | "type": "library", 20 | "autoload": { 21 | "psr-0": {"Requests": "library/"} 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Requests-master/examples/cookie_jar.php: -------------------------------------------------------------------------------- 1 | 'something']); 11 | 12 | // Now let's make a request! 13 | $request = Requests::get( 14 | 'http://httpbin.org/cookies', // Url 15 | [], // No need to set the headers the Jar does this for us 16 | ['cookies' => $c] // Pass in the Jar as an option 17 | ); 18 | 19 | // Check what we received 20 | var_dump($request); -------------------------------------------------------------------------------- /Requests-master/docs/proxy.md: -------------------------------------------------------------------------------- 1 | Proxy Support 2 | ============= 3 | 4 | You can easily make requests through HTTP proxies. 5 | 6 | To make requests through an open proxy, specify the following options: 7 | 8 | ```php 9 | $options = array( 10 | 'proxy' => '127.0.0.1:3128' 11 | ); 12 | Requests::get('http://httpbin.org/ip', array(), $options); 13 | ``` 14 | 15 | If your proxy needs you to authenticate, the option will become an array like 16 | the following: 17 | 18 | ```php 19 | $options = array( 20 | 'proxy' => array( '127.0.0.1:3128', 'my_username', 'my_password' ) 21 | ); 22 | Requests::get('http://httpbin.org/ip', array(), $options); 23 | ``` 24 | -------------------------------------------------------------------------------- /Requests-master/examples/proxy.php: -------------------------------------------------------------------------------- 1 | '127.0.0.1:8080', // syntax: host:port, eg 12.13.14.14:8080 or someproxy.com:3128 12 | // If you need to authenticate, use the following syntax: 13 | // 'proxy' => array( '127.0.0.1:8080', 'username', 'password' ), 14 | ); 15 | $request = Requests::get('http://httpbin.org/ip', array(), $options ); 16 | 17 | // See result 18 | var_dump($request->body); 19 | -------------------------------------------------------------------------------- /Requests-master/library/Requests/Exception/HTTP/418.php: -------------------------------------------------------------------------------- 1 | $url)); 16 | 17 | // Check what we received 18 | //var_dump($request); 19 | 20 | $body = $request->body; 21 | var_dump($body, 1); 22 | print_r($body); 23 | 24 | -------------------------------------------------------------------------------- /Requests-master/examples/session.php: -------------------------------------------------------------------------------- 1 | headers['Accept'] = 'application/json'; 12 | $session->useragent = 'Awesomesauce'; 13 | 14 | // Now let's make a request! 15 | $request = $session->get('/get'); 16 | 17 | // Check what we received 18 | var_dump($request); 19 | 20 | // Let's check our user agent! 21 | $request = $session->get('/user-agent'); 22 | 23 | // And check again 24 | var_dump($request); 25 | -------------------------------------------------------------------------------- /Requests-master/library/Requests/Exception/HTTP/431.php: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 测试1 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Requests-master/library/Requests/Hooker.php: -------------------------------------------------------------------------------- 1 | 0 is executed later 22 | */ 23 | public function register($hook, $callback, $priority = 0); 24 | 25 | /** 26 | * Dispatch a message 27 | * 28 | * @param string $hook Hook name 29 | * @param array $parameters Parameters to pass to callbacks 30 | * @return boolean Successfulness 31 | */ 32 | public function dispatch($hook, $parameters = array()); 33 | } -------------------------------------------------------------------------------- /youkuvod-master/.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | 38 | # Directories potentially created on remote AFP share 39 | .AppleDB 40 | .AppleDesktop 41 | Network Trash Folder 42 | Temporary Items 43 | .apdisk 44 | 45 | # node_modules 46 | *node_modules* 47 | 48 | # user 49 | .git 50 | .idea 51 | 52 | deploy 53 | -------------------------------------------------------------------------------- /Requests-master/docs/README.md: -------------------------------------------------------------------------------- 1 | Documentation 2 | ============= 3 | 4 | If you're here, you're looking for documentation for Requests! The documents 5 | here are prose; you might also want to check out the [API documentation][]. 6 | 7 | [API documentation]: http://requests.ryanmccue.info/api/ 8 | 9 | * Introduction 10 | * [Goals][goals] 11 | * [Why should I use Requests instead of X?][why-requests] 12 | * Usage 13 | * [Making a request][usage] 14 | * [Advanced usage][usage-advanced] 15 | * [Authenticating your request][authentication] 16 | * Advanced Usage 17 | * [Custom authentication][authentication-custom] 18 | * [Requests through proxy][proxy] 19 | * [Hooking system][hooks] 20 | 21 | [goals]: goals.md 22 | [why-requests]: why-requests.md 23 | [usage]: usage.md 24 | [usage-advanced]: usage-advanced.md 25 | [authentication]: authentication.md 26 | [authentication-custom]: authentication-custom.md 27 | [hooks]: hooks.md 28 | [proxy]: proxy.md -------------------------------------------------------------------------------- /main/VideoJs_ie6/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | video5.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Requests-master/library/Requests/Auth.php: -------------------------------------------------------------------------------- 1 | getStreams(); 27 | 28 | $urls = array(); 29 | foreach ($streams as $stream){ 30 | if ($stream->stream_type=="3gphd") {//取flvhd流的视频 31 | $urls = $videoInfo->getVideoSrcs($stream); 32 | break; 33 | } 34 | } 35 | 36 | foreach ($urls as $url){ 37 | echo "打开视频
"; 38 | } 39 | 40 | //print_r($url); 41 | -------------------------------------------------------------------------------- /Requests-master/library/Requests/Proxy.php: -------------------------------------------------------------------------------- 1 | callback = $callback; 33 | } 34 | 35 | /** 36 | * Get the current item's value after filtering 37 | * 38 | * @return string 39 | */ 40 | public function current() { 41 | $value = parent::current(); 42 | $value = call_user_func($this->callback, $value); 43 | return $value; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Requests-master/docs/authentication.md: -------------------------------------------------------------------------------- 1 | Authentication 2 | ============== 3 | Many requests that you make will require authentication of some type. Requests 4 | includes support out of the box for HTTP Basic authentication, with more 5 | built-ins coming soon. 6 | 7 | Making a Basic authenticated call is ridiculously easy: 8 | 9 | ```php 10 | $options = array( 11 | 'auth' => new Requests_Auth_Basic(array('user', 'password')) 12 | ); 13 | Requests::get('http://httpbin.org/basic-auth/user/password', array(), $options); 14 | ``` 15 | 16 | As Basic authentication is usually what you want when you specify a username 17 | and password, you can also just pass in an array as a shorthand: 18 | 19 | ```php 20 | $options = array( 21 | 'auth' => array('user', 'password') 22 | ); 23 | Requests::get('http://httpbin.org/basic-auth/user/password', array(), $options); 24 | ``` 25 | 26 | Note that POST/PUT can also take a data parameter, so you also need that 27 | before `$options`: 28 | 29 | ```php 30 | Requests::post('http://httpbin.org/basic-auth/user/password', array(), null, $options); 31 | ``` 32 | -------------------------------------------------------------------------------- /Requests-master/library/Requests/Exception/HTTP/Unknown.php: -------------------------------------------------------------------------------- 1 | code = $data->status_code; 40 | } 41 | 42 | parent::__construct($reason, $data); 43 | } 44 | } -------------------------------------------------------------------------------- /js/test.md: -------------------------------------------------------------------------------- 1 | $this->data->security->encrypt_string 2 | 3 | NwXYSAUZJrze2PjB8uJxVNGh7Bo11wzLXB4= 4 | 5 | translate("b4et" + "o0b" + 4, e).toString() 6 | = "becaf9be" 7 | 8 | rc4("becaf9be", decode64("NwXYSAUZJrze2PjB8uJxVNGh7Bo11wzLXB4=")) 9 | ="0486870749807126aee98_1041" 10 | 11 | Ep::generate($this->sid, $seg->fileid, $this->token): 12 | ciacHEGKVskE7Cvfjz8bYX23IX4HXP4J9h%2BHgdJjALshTuC9mDrQtJvEPPhAZ4sYBFMCFu7wqqGUGEcRYfdHr2wQ3UuvP%2Frm%2BfCQ5dsgt5N2EGg%2FBsnetFSfQzTw 13 | 14 | translate(YK.mk.a4 + "poz" + YKP.userCache.a2, s).toString() 15 | =translate("boa4" + "poz" + "1", s).toString() 16 | ="bf7e5f01" 17 | 18 | $data 19 | 048687152734412693b3c_03002001005682141C6DB72AB1FA46511ACB75-7464-2576-670C-FCC3FFA9D490_9040 20 | 21 | encode64(rc4("bf7e5f01", "048687152734412693b3c_03002001005682141C6DB72AB1FA46511ACB75-7464-2576-670C-FCC3FFA9D490_9040")) 22 | = 23 | ciacHEGKV8sC4iDbjD8bYSXhJnRcXP4J9h+HgdJjALshTuC9mDrQtJvEPPhAZ4sYBFMCFu7wqqGUGEcRYfdHr2wQ3UuvP/rm+fCQ5dsgt5N2EGg/BsnetFSXQzTx 24 | ciacHEGKV8sC4iDbjD8bYSXhJnRcXP4J9h+HgdJjALshTuC9mDrQtJvEPPhAZ4sYBFMCFu7wqqGUGEcRYfdHr2wQ3UuvP/rm+fCQ5dsgt5N2EGg/BsnetFSXQzTx -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 韦驮天 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /js/getJson.php: -------------------------------------------------------------------------------- 1 | "application/json")); 33 | 34 | // Check what we received 35 | //var_dump($request); 36 | 37 | $body = $request->body; 38 | var_dump($body); 39 | 40 | $regex = "/{$callback}\((.*)\)/i"; 41 | 42 | if (preg_match($regex, $body,$matches)) { 43 | $json = $matches[1]; 44 | $obj = json_decode($json); 45 | var_dump($obj); 46 | } 47 | 48 | 49 | -------------------------------------------------------------------------------- /video-url-parser-master/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 小明爱吃瓜(mingyuhisoft@163.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Requests-master/tests/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Auth 6 | 7 | 8 | Transport 9 | 10 | 11 | Proxy 12 | 13 | 14 | ChunkedEncoding.php 15 | Cookies.php 16 | IDNAEncoder.php 17 | IRI.php 18 | Requests.php 19 | Response/Headers.php 20 | Session.php 21 | SSL.php 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | . 34 | 35 | 36 | ../library 37 | 38 | 39 | -------------------------------------------------------------------------------- /Requests-master/library/Requests/Exception/Transport/cURL.php: -------------------------------------------------------------------------------- 1 | type = $type; 35 | } 36 | 37 | if ($code !== null) { 38 | $this->code = $code; 39 | } 40 | 41 | if ($message !== null) { 42 | $this->reason = $message; 43 | } 44 | 45 | $message = sprintf('%d %s', $this->code, $this->reason); 46 | parent::__construct($message, $this->type, $data, $this->code); 47 | } 48 | 49 | /** 50 | * Get the error message 51 | */ 52 | public function getReason() { 53 | return $this->reason; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Requests-master/docs/goals.md: -------------------------------------------------------------------------------- 1 | Goals 2 | ===== 3 | 4 | 1. **Simple interface** 5 | 6 | Requests is designed to provide a simple, unified interface to making 7 | requests, regardless of what is available on the system. This means not worrying. 8 | 9 | 2. **Fully tested code** 10 | 11 | Requests strives to have 90%+ code coverage from the unit tests, aiming for 12 | the ideal 100%. Introducing new features always means introducing new tests 13 | 14 | (Note: some parts of the code are not covered by design. These sections are 15 | marked with `@codeCoverageIgnore` tags) 16 | 17 | 3. **Maximum compatibility** 18 | 19 | No matter what you have installed on your system, you should be able to run 20 | Requests. We use cURL if it's available, and fallback to sockets otherwise. 21 | We require only a baseline of PHP 5.2, leaving the choice of PHP minimum 22 | requirement fully in your hands, and giving you the ability to support many 23 | more hosts. 24 | 25 | 4. **No dependencies** 26 | 27 | Requests is designed to be entirely self-contained and doesn't require 28 | anything else at all. You can run Requests on an entirely stock PHP build 29 | without any additional extensions outside the standard library. 30 | -------------------------------------------------------------------------------- /Requests-master/examples/multiple.php: -------------------------------------------------------------------------------- 1 | 'http://httpbin.org/get', 13 | 'headers' => array('Accept' => 'application/javascript'), 14 | ), 15 | 'post' => array( 16 | 'url' => 'http://httpbin.org/post', 17 | 'data' => array('mydata' => 'something'), 18 | ), 19 | 'delayed' => array( 20 | 'url' => 'http://httpbin.org/delay/10', 21 | 'options' => array( 22 | 'timeout' => 20, 23 | ), 24 | ), 25 | ); 26 | 27 | // Setup a callback 28 | function my_callback(&$request, $id) { 29 | var_dump($id, $request); 30 | } 31 | 32 | // Tell Requests to use the callback 33 | $options = array( 34 | 'complete' => 'my_callback', 35 | ); 36 | 37 | // Send the request! 38 | $responses = Requests::request_multiple($requests, $options); 39 | 40 | // Note: the response from the above call will be an associative array matching 41 | // $requests with the response data, however we've already handled it in 42 | // my_callback() anyway! 43 | // 44 | // If you don't believe me, uncomment this: 45 | # var_dump($responses); -------------------------------------------------------------------------------- /video-url-parser-master/src/cn-video-url-parser.js: -------------------------------------------------------------------------------- 1 | (function (factory) { 2 | var providers = { 3 | YoukuVideoProvider: "video-provider-youku.com" 4 | }; 5 | if (typeof module === "object" && typeof module.exports === "object") { 6 | var core = require("./video-url-parser.js"), 7 | ps = []; 8 | core.util.each(providers, function (value, key) { 9 | ps.push(require(value)); 10 | }); 11 | module.exports = factory(core.VideoUrlParser, core.VideoProvider, core.util, ps); 12 | } else if (typeof window === "object") { 13 | var util = window.VideoUrlParserUtil, 14 | ps = []; 15 | util.each(providers, function (value, key) { 16 | ps.push(window[key]); 17 | }); 18 | factory(window.VideoUrlParser, window.VideoProvider, util, ps, window); 19 | } else { 20 | throw new Error("未知宿主环境,无法运行!"); 21 | } 22 | })(function (VideoUrlParser, VideoProvider, util, providers, root) { 23 | var cnVideoUrlParser = new VideoUrlParser("CN"); 24 | util.each(providers, function (item) { 25 | cnVideoUrlParser.addProvider(item(util, cnVideoUrlParser)); 26 | }); 27 | if (root) { 28 | root.cnVideoUrlParser = cnVideoUrlParser; 29 | } 30 | return cnVideoUrlParser; 31 | }); -------------------------------------------------------------------------------- /Requests-master/library/Requests/Exception.php: -------------------------------------------------------------------------------- 1 | type = $type; 40 | $this->data = $data; 41 | } 42 | 43 | /** 44 | * Like {@see getCode()}, but a string code. 45 | * 46 | * @codeCoverageIgnore 47 | * @return string 48 | */ 49 | public function getType() { 50 | return $this->type; 51 | } 52 | 53 | /** 54 | * Gives any relevant data 55 | * 56 | * @codeCoverageIgnore 57 | * @return mixed 58 | */ 59 | public function getData() { 60 | return $this->data; 61 | } 62 | } -------------------------------------------------------------------------------- /Requests-master/library/Requests/Transport.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 测试用例 7 | 8 | 9 | 10 | 11 | 12 | 13 | 33 | 34 | 35 | 36 |
37 | 40 | 41 | 42 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Requests-master/docs/authentication-custom.md: -------------------------------------------------------------------------------- 1 | Custom Authentication 2 | ===================== 3 | Custom authentication handlers are designed to be extremely simple to write. 4 | In order to write a handler, you'll need to implement the `Requests_Auth` 5 | interface. 6 | 7 | An instance of this handler is then passed in by the user via the `auth` 8 | option, just like for normal authentication. 9 | 10 | Let's say we have a HTTP endpoint that checks for the `Hotdog` header and 11 | authenticates you if said header is set to `Yummy`. (I don't know of any 12 | services that do this; perhaps this is a market waiting to be tapped?) 13 | 14 | ```php 15 | class MySoftware_Auth_Hotdog implements Requests_Auth { 16 | protected $password; 17 | 18 | public function __construct($password) { 19 | $this->password = $password; 20 | } 21 | 22 | public function register(Requests_Hooks &$hooks) { 23 | $hooks->register('requests.before_request', array(&$this, 'before_request')); 24 | } 25 | 26 | public function before_request(&$url, &$headers, &$data, &$type, &$options) { 27 | $headers['Hotdog'] = $this->password; 28 | } 29 | } 30 | ``` 31 | 32 | We then use this in our request calls: 33 | 34 | ``` 35 | $options = array( 36 | 'auth' => new MySoftware_Auth_Hotdog('yummy') 37 | ); 38 | $response = Requests::get('http://hotdogbin.org/admin', array(), $options); 39 | ``` 40 | 41 | (For more information on how to register and use hooks, see the [hooking 42 | system documentation][hooks]) 43 | 44 | [hooks]: hooks.md -------------------------------------------------------------------------------- /Requests-master/.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | matrix: 3 | fast_finish: true 4 | include: 5 | - php: 5.2 6 | - php: 5.3 7 | - php: 5.4 8 | - php: 5.5 9 | - php: 5.6 10 | env: TEST_COVERAGE=1 11 | - php: 7.0 12 | - php: hhvm 13 | 14 | # Use new container infrastructure 15 | sudo: false 16 | 17 | cache: 18 | directories: 19 | - $HOME/.cache/pip 20 | - $HOME/.composer/cache 21 | - vendor 22 | 23 | install: 24 | # Setup the test server 25 | - phpenv local 5.5 26 | - composer install --dev --no-interaction 27 | - TESTPHPBIN=$(phpenv which php) 28 | - phpenv local --unset 29 | 30 | # Setup the proxy 31 | - pip install --user mitmproxy~=0.15 32 | 33 | before_script: 34 | - PHPBIN=$TESTPHPBIN PORT=8080 vendor/bin/start.sh 35 | - export REQUESTS_TEST_HOST_HTTP="localhost:8080" 36 | 37 | # Work out of the tests directory 38 | - cd tests 39 | - PROXYBIN="$HOME/.local/bin/mitmdump" PORT=9002 utils/proxy/start.sh 40 | - PROXYBIN="$HOME/.local/bin/mitmdump" PORT=9003 AUTH="test:pass" utils/proxy/start.sh 41 | - export REQUESTS_HTTP_PROXY="localhost:9002" 42 | - export REQUESTS_HTTP_PROXY_AUTH="localhost:9003" 43 | - export REQUESTS_HTTP_PROXY_AUTH_USER="test" 44 | - export REQUESTS_HTTP_PROXY_AUTH_PASS="pass" 45 | 46 | # Ensure the HTTPS test instance on Heroku is spun up 47 | - curl -s -I http://requests-php-tests.herokuapp.com/ > /dev/null 48 | 49 | script: 50 | - phpunit --coverage-clover clover.xml 51 | 52 | after_script: 53 | - utils/proxy/stop.sh 54 | - cd .. 55 | - phpenv local 5.5 56 | - PATH=$PATH vendor/bin/stop.sh 57 | - test $TEST_COVERAGE && bash <(curl -s https://codecov.io/bash) 58 | - phpenv local --unset 59 | -------------------------------------------------------------------------------- /test/start2.php: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | Page Title 19 | 20 | 21 | 22 | 23 | 24 | 25 | 29 | 30 | 31 | 32 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /js/rc4.php: -------------------------------------------------------------------------------- 1 | ".$strBase64; 56 | //成功 57 | echo "
".urlencode($strBase64); 58 | 59 | echo "
解密sid和token:"; 60 | $pwd = "becaf9be"; 61 | $data = "NwXYSAUeIL7T2PnJ8eJxAdX2vRps1w3OWhs="; 62 | $result=rc4($pwd, base64_decode($data)); 63 | var_dump($result); 64 | 65 | -------------------------------------------------------------------------------- /Requests-master/library/Requests/Hooks.php: -------------------------------------------------------------------------------- 1 | 0 is executed later 36 | */ 37 | public function register($hook, $callback, $priority = 0) { 38 | if (!isset($this->hooks[$hook])) { 39 | $this->hooks[$hook] = array(); 40 | } 41 | if (!isset($this->hooks[$hook][$priority])) { 42 | $this->hooks[$hook][$priority] = array(); 43 | } 44 | 45 | $this->hooks[$hook][$priority][] = $callback; 46 | } 47 | 48 | /** 49 | * Dispatch a message 50 | * 51 | * @param string $hook Hook name 52 | * @param array $parameters Parameters to pass to callbacks 53 | * @return boolean Successfulness 54 | */ 55 | public function dispatch($hook, $parameters = array()) { 56 | if (empty($this->hooks[$hook])) { 57 | return false; 58 | } 59 | 60 | foreach ($this->hooks[$hook] as $priority => $hooked) { 61 | foreach ($hooked as $callback) { 62 | call_user_func_array($callback, $parameters); 63 | } 64 | } 65 | 66 | return true; 67 | } 68 | } -------------------------------------------------------------------------------- /Requests-master/tests/Response/Headers.php: -------------------------------------------------------------------------------- 1 | assertEquals('text/plain', $headers['Content-Type']); 9 | } 10 | public function testCaseInsensitiveArrayAccess() { 11 | $headers = new Requests_Response_Headers(); 12 | $headers['Content-Type'] = 'text/plain'; 13 | 14 | $this->assertEquals('text/plain', $headers['CONTENT-TYPE']); 15 | $this->assertEquals('text/plain', $headers['content-type']); 16 | } 17 | 18 | /** 19 | * @depends testArrayAccess 20 | */ 21 | public function testIteration() { 22 | $headers = new Requests_Response_Headers(); 23 | $headers['Content-Type'] = 'text/plain'; 24 | $headers['Content-Length'] = 10; 25 | 26 | foreach ($headers as $name => $value) { 27 | switch (strtolower($name)) { 28 | case 'content-type': 29 | $this->assertEquals('text/plain', $value); 30 | break; 31 | case 'content-length': 32 | $this->assertEquals(10, $value); 33 | break; 34 | default: 35 | throw new Exception('Invalid name: ' . $name); 36 | } 37 | } 38 | } 39 | 40 | /** 41 | * @expectedException Requests_Exception 42 | */ 43 | public function testInvalidKey() { 44 | $headers = new Requests_Response_Headers(); 45 | $headers[] = 'text/plain'; 46 | } 47 | 48 | public function testMultipleHeaders() { 49 | $headers = new Requests_Response_Headers(); 50 | $headers['Accept'] = 'text/html;q=1.0'; 51 | $headers['Accept'] = '*/*;q=0.1'; 52 | 53 | $this->assertEquals('text/html;q=1.0,*/*;q=0.1', $headers['Accept']); 54 | } 55 | } -------------------------------------------------------------------------------- /main/Constants.php: -------------------------------------------------------------------------------- 1 | "4", 16 | 'a2' => "1" 17 | ); 18 | } 19 | 20 | public static function getMk() 21 | { 22 | return array("a3" => "b4et", "a4" => "boa4"); 23 | } 24 | 25 | public static function getHd() 26 | { 27 | return array( 28 | 'flv' => 0, 29 | 'flvhd' => 0, 30 | 'mp4hd' => 1, 31 | 'mp4hd2' => 2, 32 | 'mp4hd3' => 3, 33 | "3gphd" => 0, 34 | "3gp" => 0 35 | ); 36 | } 37 | 38 | public static function getHdName() 39 | { 40 | return array( 41 | 'flv' => "flv", 42 | 'mp4hd' => "mp4", 43 | 'mp4hd2' => "flv", 44 | 'mp4hd3' => "flv", 45 | "3gphd" => "mp4", 46 | "3gp" => "flv", 47 | 'flvhd' => "flv", 48 | ); 49 | } 50 | 51 | const UserAgent = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Mobile Safari/537.36"; 52 | 53 | const Host = "play-ali.youku.com"; 54 | 55 | //根据需要修改,需要正确的cookies才能解析正确的sid和token 56 | const Cookie = "cna=dz3oD4rmeyECAcponcLuty/n; __ali=148680349353177q; __aliCount=1; __ysuid=1486888912489GInpI1; __ayft=1486888912923; __aysid=1486803490209cip; __arpvid=1486888912924pS9jYx-1486888912936; __arycid=; __ayscnt=1; __arcms=; __aypstp=1; __ayspstp=29; __ayvstp=1; __aysvstp=17; rpvid=1486888913051K9Uyf7-1486889197716"; 57 | } 58 | 59 | -------------------------------------------------------------------------------- /Requests-master/library/Requests/Exception/HTTP.php: -------------------------------------------------------------------------------- 1 | reason = $reason; 40 | } 41 | 42 | $message = sprintf('%d %s', $this->code, $this->reason); 43 | parent::__construct($message, 'httpresponse', $data, $this->code); 44 | } 45 | 46 | /** 47 | * Get the status message 48 | */ 49 | public function getReason() { 50 | return $this->reason; 51 | } 52 | 53 | /** 54 | * Get the correct exception class for a given error code 55 | * 56 | * @param int|bool $code HTTP status code, or false if unavailable 57 | * @return string Exception class name to use 58 | */ 59 | public static function get_class($code) { 60 | if (!$code) { 61 | return 'Requests_Exception_HTTP_Unknown'; 62 | } 63 | 64 | $class = sprintf('Requests_Exception_HTTP_%d', $code); 65 | if (class_exists($class)) { 66 | return $class; 67 | } 68 | 69 | return 'Requests_Exception_HTTP_Unknown'; 70 | } 71 | } -------------------------------------------------------------------------------- /youkuvod-master/ckplayer/share.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {embed src="贵站网址,在ckplayer/share.xml里修改/ckplayer/ckplayer.swf" flashvars="[$share]" quality="high" width="480" height="400" align="middle" allowScriptAccess="always" allowFullscreen="true" type="application/x-shockwave-flash"}{/embed} 5 | 6 | 7 | 贵站网址/ckplayer/ckplayer.swf?[$share] 8 | 9 | 10 | f,my_url,my_pic,a 11 | 12 | ckplayer/share/ 13 | 14 | 15 | 0 16 | 17 | c25cf02c-1705-412d-bd4b-77a10b380f08 18 | 19 | 20 | 21 | qqmb 22 | qq.png 23 | 20,50 24 | 25 | 26 | sinaminiblog 27 | sina.png 28 | 101,50 29 | 30 | 31 | qzone 32 | qzone.png 33 | 182,50 34 | 35 | 36 | renren 37 | rr.png 38 | 263,50 39 | 40 | 41 | kaixin001 42 | kaixin001.png 43 | 20,85 44 | 45 | 46 | tianya 47 | tianya.png 48 | 101,85 49 | 50 | 51 | feixin 52 | feixin.png 53 | 182,85 54 | 55 | 56 | msn 57 | msn.png 58 | 263,85 59 | 60 | 61 | -------------------------------------------------------------------------------- /js/testGetFileSrc.php: -------------------------------------------------------------------------------- 1 | "4", 12 | 'a2' => "1", 13 | 'sid' => "048677541290712f09e4e", 14 | 'token' => "0539" 15 | ); 16 | 17 | $url = "//k.youku.com/player/getFlvPath/sid/"; 18 | 19 | $urlx = "http://k.youku.com/player/getFlvPath/sid/04867837197411251505b_00/st/mp4/fileid/0300080100568215A86DB72AB1FA46511ACB75-7464-2576-670C-FCC3FFA9D490?K=d721f417d7ea507a2412e7ca&sign=7e0c51be35bf16bb3996238c96e37243&hd=1&myp=0&ts=206.292&ypp=0&ep=ciacHE6FVckB7CTbiT8bYi3ndHJdXP4J9h%2BFidJjALshTuC9mDugz5vEPPhAZ4sYBFMCFu7wqqGUGEcRYfdHr2wQ3UuvP%2Frm%2BfCQ5dsgt5N2EGg%2FBsnetFSeRjD4&ctype=12&ev=1&token=0509&oip=1900652190"; 20 | 21 | 22 | /*require_once '../Requests-master/library/Requests.php'; 23 | 24 | Requests::register_autoloader(); 25 | 26 | $request = Requests::get($urlx, array("Accept" => "*")); 27 | var_dump($request->headers);*/ 28 | 29 | //初始化 30 | $ch = curl_init(); 31 | 32 | //设置选项,包括URL 33 | curl_setopt($ch, CURLOPT_URL, $urlx); 34 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 35 | // 返回 response_header, 该选项非常重要,如果不为 true, 只会获得响应的正文 36 | curl_setopt($ch, CURLOPT_HEADER, true); 37 | // 是否不需要响应的正文,为了节省带宽及时间,在只需要响应头的情况下可以不要正文 38 | curl_setopt($ch, CURLOPT_NOBODY, true); 39 | 40 | //执行并获取HTML文档内容 41 | $output = curl_exec($ch); 42 | 43 | $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE); 44 | 45 | 46 | //释放curl句柄 47 | curl_close($ch); 48 | 49 | //打印获得的数据 50 | //print_r($output); 51 | $header = substr($output, 0, $headerSize); 52 | 53 | //如果我们想获得 Location 项的内容,可以先把上面头正文件按回车换行切割成数组,然后再遍历匹配,如: 54 | $headArr = explode("\r\n", $header); 55 | 56 | foreach ($headArr as $loop) { 57 | if (strpos($loop, "Location") !== false) { 58 | $edengUrl = trim(substr($loop, 10)); 59 | print_r($edengUrl); 60 | // 输出: http://www.edeng.cn/s/chuna/ 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /Requests-master/bin/create_pear_package.php: -------------------------------------------------------------------------------- 1 | ' . PHP_EOL; 13 | echo PHP_EOL; 14 | echo ' version:' . PHP_EOL; 15 | echo ' Version of the package, in the form of major.minor.bug' . PHP_EOL; 16 | echo PHP_EOL; 17 | echo ' stability:' . PHP_EOL; 18 | echo ' One of alpha, beta, stable' . PHP_EOL; 19 | die(); 20 | } 21 | 22 | if (!isset($argv[2])) { 23 | die('You must provide the stability (alpha, beta, or stable)'); 24 | } 25 | 26 | $context = array( 27 | 'date' => gmdate('Y-m-d'), 28 | 'time' => gmdate('H:m:00'), 29 | 'version' => $argv[1], 30 | 'api_version' => $argv[1], 31 | 'stability' => $argv[2], 32 | 'api_stability' => $argv[2], 33 | ); 34 | 35 | $context['files'] = ''; 36 | $path = realpath(dirname(__FILE__).'/../library/Requests'); 37 | foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::LEAVES_ONLY) as $file) { 38 | if (preg_match('/\.php$/', $file)) { 39 | $name = str_replace($path . DIRECTORY_SEPARATOR, '', $file); 40 | $name = str_replace(DIRECTORY_SEPARATOR, '/', $name); 41 | $context['files'][] = "\t\t\t\t\t" . ''; 42 | } 43 | } 44 | 45 | $context['files'] = implode("\n", $context['files']); 46 | 47 | $template = file_get_contents(dirname(__FILE__).'/../package.xml.tpl'); 48 | $content = preg_replace_callback('/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/', 'replace_parameters', $template); 49 | file_put_contents(dirname(__FILE__).'/../package.xml', $content); 50 | 51 | function replace_parameters($matches) { 52 | global $context; 53 | 54 | return isset($context[$matches[1]]) ? $context[$matches[1]] : null; 55 | } 56 | -------------------------------------------------------------------------------- /new/test.php: -------------------------------------------------------------------------------- 1 | '; 10 | 11 | $curl = curl_init(); 12 | 13 | curl_setopt_array($curl, array( 14 | CURLOPT_URL => "https://ups.youku.com/ups/get.json?vid=XMzQ3ODQ0OTA2MA%3D%3D&ccode=0502&client_ip=192.168.1.1&utid=2V06EwrKJjICAbczegzDzfoV&client_ts=" . intval(time()) 15 | . "&ckey=DIl58SLFxFNndSV1GFNnMQVYkx1PP5tKe1siZu%2F86PR1u%2FWh1Ptd%2BWOZsHHWxysSfAOhNJpdVWsdVJNsfJ8Sxd8WKVvNfAS8aS8fAOzYARzPyPc3JvtnPHjTdKfESTdnuTW6ZPvk2pNDh4uFzotgdMEFkzQ5wZVXl2Pf1%2FY6hLK0OnCNxBj3%2Bnb0v72gZ6b0td%2BWOZsHHWxysSo%2F0y9D2K42SaB8Y%2F%2BaD2K42SaB8Y%2F%2BahU%2BWOZsHcrxysooUeND%20HTTP%2F1.1", 16 | CURLOPT_RETURNTRANSFER => true, 17 | 18 | CURLOPT_HEADER => true, 19 | CURLINFO_HEADER_OUT => true, 20 | 21 | CURLOPT_SSL_VERIFYPEER => false, 22 | CURLOPT_SSL_VERIFYHOST => false, 23 | CURLOPT_SSLVERSION => 1, 24 | 25 | CURLOPT_ENCODING => "", 26 | CURLOPT_MAXREDIRS => 10, 27 | CURLOPT_TIMEOUT => 30, 28 | // CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, 29 | CURLOPT_CUSTOMREQUEST => "GET", 30 | CURLOPT_COOKIE => "__ysuid=" . intval(time()), 31 | CURLOPT_HTTPHEADER => array( 32 | "accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", 33 | "accept-encoding: gzip, deflate", 34 | "accept-language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3", 35 | "cache-control: no-cache", 36 | "connection: close", 37 | //"cookie: __ysuid=" . intval(time()), 38 | "Host: ups.youku.com", 39 | "Referer: http://v.youku.com", 40 | "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0 Iceweasel/38.2.1" 41 | ), 42 | )); 43 | 44 | 45 | $response = curl_exec($curl); 46 | 47 | $curl_getinfo = curl_getinfo($curl); 48 | // var_dump($curl_getinfo) ; 49 | echo $curl_getinfo['request_header']; 50 | echo "
"; 51 | 52 | $err = curl_error($curl); 53 | 54 | curl_close($curl); 55 | 56 | if ($err) { 57 | echo "cURL Error #:" . $err; 58 | } else { 59 | echo $response; 60 | } -------------------------------------------------------------------------------- /Requests-master/package.xml.tpl: -------------------------------------------------------------------------------- 1 | 2 | 8 | Requests 9 | pear.ryanmccue.info 10 | A HTTP library written in PHP, for human beings. 11 | 12 | Requests is a HTTP library written in PHP, for human beings. It is 13 | roughly based on the API from the excellent Requests Python library. 14 | Requests is ISC Licensed (similar to the new BSD license) and has 15 | no dependencies. 16 | 17 | 18 | Ryan McCue 19 | rmccue 20 | me+pear@ryanmccue dot info 21 | yes 22 | 23 | {{ date }} 24 | 25 | 26 | {{ version }} 27 | {{ api_version }} 28 | 29 | 30 | {{ stability }} 31 | {{ stability }} 32 | 33 | ISC 34 | - 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | {{ files }} 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 5.2.0 53 | 54 | 55 | 1.4.0 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Requests-master/library/Requests/Auth/Basic.php: -------------------------------------------------------------------------------- 1 | user, $this->pass) = $args; 46 | } 47 | } 48 | 49 | /** 50 | * Register the necessary callbacks 51 | * 52 | * @see curl_before_send 53 | * @see fsockopen_header 54 | * @param Requests_Hooks $hooks Hook system 55 | */ 56 | public function register(Requests_Hooks &$hooks) { 57 | $hooks->register('curl.before_send', array(&$this, 'curl_before_send')); 58 | $hooks->register('fsockopen.after_headers', array(&$this, 'fsockopen_header')); 59 | } 60 | 61 | /** 62 | * Set cURL parameters before the data is sent 63 | * 64 | * @param resource $handle cURL resource 65 | */ 66 | public function curl_before_send(&$handle) { 67 | curl_setopt($handle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); 68 | curl_setopt($handle, CURLOPT_USERPWD, $this->getAuthString()); 69 | } 70 | 71 | /** 72 | * Add extra headers to the request before sending 73 | * 74 | * @param string $out HTTP header string 75 | */ 76 | public function fsockopen_header(&$out) { 77 | $out .= sprintf("Authorization: Basic %s\r\n", base64_encode($this->getAuthString())); 78 | } 79 | 80 | /** 81 | * Get the authentication string (user:pass) 82 | * 83 | * @return string 84 | */ 85 | public function getAuthString() { 86 | return $this->user . ':' . $this->pass; 87 | } 88 | } -------------------------------------------------------------------------------- /video-url-parser-master/example/cn.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 中国区视频网站地址解析 7 | 8 | 9 | 10 | 11 | 71 | 72 | 73 | 74 |
75 | 76 | 77 |

78 |     
79 | 80 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /Requests-master/LICENSE: -------------------------------------------------------------------------------- 1 | Requests 2 | ======== 3 | 4 | Copyright (c) 2010-2012 Ryan McCue and contributors 5 | 6 | Permission to use, copy, modify, and/or distribute this software for any 7 | purpose with or without fee is hereby granted, provided that the above 8 | copyright notice and this permission notice appear in all copies. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 | 18 | 19 | ComplexPie IRI Parser 20 | ===================== 21 | 22 | Copyright (c) 2007-2010, Geoffrey Sneddon and Steve Minutillo. 23 | All rights reserved. 24 | 25 | Redistribution and use in source and binary forms, with or without 26 | modification, are permitted provided that the following conditions are met: 27 | 28 | * Redistributions of source code must retain the above copyright notice, 29 | this list of conditions and the following disclaimer. 30 | 31 | * Redistributions in binary form must reproduce the above copyright notice, 32 | this list of conditions and the following disclaimer in the documentation 33 | and/or other materials provided with the distribution. 34 | 35 | * Neither the name of the SimplePie Team nor the names of its contributors 36 | may be used to endorse or promote products derived from this software 37 | without specific prior written permission. 38 | 39 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 40 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 41 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 42 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE 43 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 44 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 45 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 46 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 47 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 48 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 49 | POSSIBILITY OF SUCH DAMAGE. 50 | -------------------------------------------------------------------------------- /youkuvod-master/ckplayer/language.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 73 | -------------------------------------------------------------------------------- /Requests-master/library/Requests/Response/Headers.php: -------------------------------------------------------------------------------- 1 | data[$key])) { 29 | return null; 30 | } 31 | 32 | return $this->flatten($this->data[$key]); 33 | } 34 | 35 | /** 36 | * Set the given item 37 | * 38 | * @throws Requests_Exception On attempting to use dictionary as list (`invalidset`) 39 | * 40 | * @param string $key Item name 41 | * @param string $value Item value 42 | */ 43 | public function offsetSet($key, $value) { 44 | if ($key === null) { 45 | throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset'); 46 | } 47 | 48 | $key = strtolower($key); 49 | 50 | if (!isset($this->data[$key])) { 51 | $this->data[$key] = array(); 52 | } 53 | 54 | $this->data[$key][] = $value; 55 | } 56 | 57 | /** 58 | * Get all values for a given header 59 | * 60 | * @param string $key 61 | * @return array Header values 62 | */ 63 | public function getValues($key) { 64 | $key = strtolower($key); 65 | if (!isset($this->data[$key])) { 66 | return null; 67 | } 68 | 69 | return $this->data[$key]; 70 | } 71 | 72 | /** 73 | * Flattens a value into a string 74 | * 75 | * Converts an array into a string by imploding values with a comma, as per 76 | * RFC2616's rules for folding headers. 77 | * 78 | * @param string|array $value Value to flatten 79 | * @return string Flattened value 80 | */ 81 | public function flatten($value) { 82 | if (is_array($value)) { 83 | $value = implode(',', $value); 84 | } 85 | 86 | return $value; 87 | } 88 | 89 | /** 90 | * Get an iterator for the data 91 | * 92 | * Converts the internal 93 | * @return ArrayIterator 94 | */ 95 | public function getIterator() { 96 | return new Requests_Utility_FilteredIterator($this->data, array($this, 'flatten')); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Requests-master/library/Requests/Utility/CaseInsensitiveDictionary.php: -------------------------------------------------------------------------------- 1 | $value) { 30 | $this->offsetSet($key, $value); 31 | } 32 | } 33 | 34 | /** 35 | * Check if the given item exists 36 | * 37 | * @param string $key Item key 38 | * @return boolean Does the item exist? 39 | */ 40 | public function offsetExists($key) { 41 | $key = strtolower($key); 42 | return isset($this->data[$key]); 43 | } 44 | 45 | /** 46 | * Get the value for the item 47 | * 48 | * @param string $key Item key 49 | * @return string Item value 50 | */ 51 | public function offsetGet($key) { 52 | $key = strtolower($key); 53 | if (!isset($this->data[$key])) { 54 | return null; 55 | } 56 | 57 | return $this->data[$key]; 58 | } 59 | 60 | /** 61 | * Set the given item 62 | * 63 | * @throws Requests_Exception On attempting to use dictionary as list (`invalidset`) 64 | * 65 | * @param string $key Item name 66 | * @param string $value Item value 67 | */ 68 | public function offsetSet($key, $value) { 69 | if ($key === null) { 70 | throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset'); 71 | } 72 | 73 | $key = strtolower($key); 74 | $this->data[$key] = $value; 75 | } 76 | 77 | /** 78 | * Unset the given header 79 | * 80 | * @param string $key 81 | */ 82 | public function offsetUnset($key) { 83 | unset($this->data[strtolower($key)]); 84 | } 85 | 86 | /** 87 | * Get an iterator for the data 88 | * 89 | * @return ArrayIterator 90 | */ 91 | public function getIterator() { 92 | return new ArrayIterator($this->data); 93 | } 94 | 95 | /** 96 | * Get the headers as an array 97 | * 98 | * @return array Header data 99 | */ 100 | public function getAll() { 101 | return $this->data; 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /js/translate.php: -------------------------------------------------------------------------------- 1 | = "a" && $source[$d] <= "z" ? charCodeAt($source[$d], 0) - charCodeAt("a", 0) : $source[$d] - "0" + 26; 61 | for ($f = 0; $f < 36; $f++) if ($key[$f] == $char) { 62 | $char = $f; 63 | break; 64 | } 65 | $char > 25 ? $newStr[$d] = $char - 26 : $newStr[$d] = chr($char + 97); 66 | } 67 | return implode($newStr); 68 | } 69 | 70 | function translate2($source, $key) 71 | { 72 | $newStr = array(); 73 | $d = 0; 74 | for (; $d < strlen($source); $d++) { 75 | $char = $source[$d] >= "a" && $source[$d] <= "z" ? charCodeAt2($source[$d], 0) - charCodeAt2("a", 0) : $source[$d] - "0" + 26; 76 | for ($f = 0; $f < 36; $f++) if ($key[$f] == $char) { 77 | $char = $f; 78 | break; 79 | } 80 | $char > 25 ? $newStr[$d] = $char - 26 : $newStr[$d] = fromCharCode2($char + 97); 81 | } 82 | return implode($newStr); 83 | } 84 | 85 | $source = "boa4poz1"; 86 | var_dump(translate2($source, $key)); 87 | //=>bf7e5f01 right 88 | //translate1 和 translate2都可以 -------------------------------------------------------------------------------- /Requests-master/tests/Auth/Basic.php: -------------------------------------------------------------------------------- 1 | markTestSkipped($transport . ' is not available'); 18 | return; 19 | } 20 | 21 | $options = array( 22 | 'auth' => array('user', 'passwd'), 23 | 'transport' => $transport, 24 | ); 25 | $request = Requests::get(httpbin('/basic-auth/user/passwd'), array(), $options); 26 | $this->assertEquals(200, $request->status_code); 27 | 28 | $result = json_decode($request->body); 29 | $this->assertEquals(true, $result->authenticated); 30 | $this->assertEquals('user', $result->user); 31 | } 32 | 33 | /** 34 | * @dataProvider transportProvider 35 | */ 36 | public function testUsingInstantiation($transport) { 37 | if (!call_user_func(array($transport, 'test'))) { 38 | $this->markTestSkipped($transport . ' is not available'); 39 | return; 40 | } 41 | 42 | $options = array( 43 | 'auth' => new Requests_Auth_Basic(array('user', 'passwd')), 44 | 'transport' => $transport, 45 | ); 46 | $request = Requests::get(httpbin('/basic-auth/user/passwd'), array(), $options); 47 | $this->assertEquals(200, $request->status_code); 48 | 49 | $result = json_decode($request->body); 50 | $this->assertEquals(true, $result->authenticated); 51 | $this->assertEquals('user', $result->user); 52 | } 53 | 54 | /** 55 | * @dataProvider transportProvider 56 | */ 57 | public function testPOSTUsingInstantiation($transport) { 58 | if (!call_user_func(array($transport, 'test'))) { 59 | $this->markTestSkipped($transport . ' is not available'); 60 | return; 61 | } 62 | 63 | $options = array( 64 | 'auth' => new Requests_Auth_Basic(array('user', 'passwd')), 65 | 'transport' => $transport, 66 | ); 67 | $data = 'test'; 68 | $request = Requests::post(httpbin('/post'), array(), $data, $options); 69 | $this->assertEquals(200, $request->status_code); 70 | 71 | $result = json_decode($request->body); 72 | 73 | $auth = $result->headers->Authorization; 74 | $auth = explode(' ', $auth); 75 | 76 | $this->assertEquals(base64_encode('user:passwd'), $auth[1]); 77 | $this->assertEquals('test', $result->data); 78 | } 79 | 80 | /** 81 | * @expectedException Requests_Exception 82 | */ 83 | public function testMissingPassword() { 84 | $auth = new Requests_Auth_Basic(array('user')); 85 | } 86 | 87 | } -------------------------------------------------------------------------------- /Requests-master/tests/Encoding.php: -------------------------------------------------------------------------------- 1 | $set) { 66 | $real_set = self::mapData($key, $set); 67 | $data = array_merge($data, $real_set); 68 | } 69 | return $data; 70 | } 71 | 72 | /** 73 | * @dataProvider encodedData 74 | */ 75 | public function testDecompress($original, $encoded) { 76 | $decoded = Requests::decompress($encoded); 77 | $this->assertEquals($original, $decoded); 78 | } 79 | 80 | /** 81 | * @dataProvider encodedData 82 | */ 83 | public function testCompatibleInflate($original, $encoded) { 84 | $decoded = Requests::compatible_gzinflate($encoded); 85 | $this->assertEquals($original, $decoded); 86 | } 87 | 88 | protected function bin2hex($field) { 89 | $field = bin2hex($field); 90 | $field = chunk_split($field,2,"\\x"); 91 | $field = "\\x" . substr($field,0,-2); 92 | return $field; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /new/index.php: -------------------------------------------------------------------------------- 1 | get_json(); 18 | // var_dump($json['data']); 19 | $streams = $json['data']['stream']; 20 | 21 | } 22 | 23 | ?> 24 | 25 | 26 | 27 | 28 | 29 | 31 | 32 | 优酷视频info 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 | 42 |
43 | 44 |
45 | 46 |
47 | 49 |
50 |
51 | 52 |
53 |
54 | 55 |
56 | 57 |
58 | 59 | 60 |
61 |

流类型: 宽: 62 | 高:

63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | "; 75 | } ?> 76 | 77 |
url
"; 72 | $show_url = substr($url['cdn_url'], 0, 100) . "..."; 73 | echo "{$show_url}"; 74 | echo "
78 |
79 | 80 | 81 |
82 | 83 |
84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /Requests-master/docs/usage-advanced.md: -------------------------------------------------------------------------------- 1 | Advanced Usage 2 | ============== 3 | 4 | Session Handling 5 | ---------------- 6 | Making multiple requests to the same site with similar options can be a pain, 7 | since you end up repeating yourself. The Session object can be used to set 8 | default parameters for these. 9 | 10 | Let's simulate communicating with GitHub. 11 | 12 | ```php 13 | $session = new Requests_Session('https://api.github.com/'); 14 | $session->headers['X-ContactAuthor'] = 'rmccue'; 15 | $session->useragent = 'My-Awesome-App'; 16 | 17 | $response = $session->get('/zen'); 18 | ``` 19 | 20 | You can use the `url`, `headers`, `data` and `options` properties of the Session 21 | object to set the defaults for this session, and the constructor also takes 22 | parameters in the same order as `Requests::request()`. Accessing any other 23 | properties will set the corresponding key in the options array; that is: 24 | 25 | ```php 26 | // Setting the property... 27 | $session->useragent = 'My-Awesome-App'; 28 | 29 | // ...is the same as setting the option 30 | $session->options['useragent'] = 'My-Awesome-App'; 31 | ``` 32 | 33 | 34 | Secure Requests with SSL 35 | ------------------------ 36 | By default, HTTPS requests will use the most secure options available: 37 | 38 | ```php 39 | $response = Requests::get('https://httpbin.org/'); 40 | ``` 41 | 42 | Requests bundles certificates from the [Mozilla certificate authority list][], 43 | which is the same list of root certificates used in most browsers. If you're 44 | accessing sites with certificates from other CAs, or self-signed certificates, 45 | you can point Requests to a custom CA list in PEM form (the same format 46 | accepted by cURL and OpenSSL): 47 | 48 | ```php 49 | $options = array( 50 | 'verify' => '/path/to/cacert.pem' 51 | ); 52 | $response = Requests::get('https://httpbin.org/', array(), $options); 53 | ``` 54 | 55 | Alternatively, if you want to disable verification completely, this is possible 56 | with `'verify' => false`, but note that this is extremely insecure and should be 57 | avoided. 58 | 59 | ### Security Note 60 | Requests supports SSL across both cURL and fsockopen in a transparent manner. 61 | Unlike other PHP HTTP libraries, support for verifying the certificate name is 62 | built-in; that is, a request for `https://github.com/` will actually verify the 63 | certificate's name even with the fsockopen transport. This makes Requests the 64 | first and currently only PHP HTTP library that supports full SSL verification. 65 | 66 | (Note that WordPress now also supports this verification, thanks to efforts by 67 | the Requests development team.) 68 | 69 | (See also the [related PHP][php-bug-47030] and [OpenSSL-related][php-bug-55820] 70 | bugs in PHP for more information on Subject Alternate Name field.) 71 | 72 | [Mozilla certificate authority list]: http://www.mozilla.org/projects/security/certs/ 73 | [php-bug-47030]: https://bugs.php.net/bug.php?id=47030 74 | [php-bug-55820]:https://bugs.php.net/bug.php?id=55820 75 | -------------------------------------------------------------------------------- /Requests-master/docs/hooks.md: -------------------------------------------------------------------------------- 1 | Hooks 2 | ===== 3 | Requests has a hook system that you can use to manipulate parts of the request 4 | process along with internal transport hooks. 5 | 6 | Check out the [API documentation for `Requests_Hooks`][requests_hooks] for more 7 | information on how to use the hook system. 8 | 9 | Available Hooks 10 | --------------- 11 | 12 | * `requests.before_request` 13 | 14 | Alter the request before it's sent to the transport. 15 | 16 | Parameters: `string &$url`, `array &$headers`, `array|string &$data`, 17 | `string &$type`, `array &$options` 18 | 19 | * `requests.before_parse` 20 | 21 | Alter the raw HTTP response before parsing 22 | 23 | Parameters: `string &$response` 24 | 25 | * `requests.after_request` 26 | 27 | Alter the response object before it's returned to the user 28 | 29 | Parameters: `Requests_Response &$return` 30 | 31 | * `curl.before_request` 32 | 33 | Set cURL options before the transport sets any (note that Requests may 34 | override these) 35 | 36 | Parameters: `cURL resource &$fp` 37 | 38 | * `curl.before_send` 39 | 40 | Set cURL options just before the request is actually sent via `curl_exec` 41 | 42 | Parameters: `cURL resource &$fp` 43 | 44 | * `curl.after_request` 45 | 46 | Alter the raw HTTP response before returning for parsing 47 | 48 | Parameters: `string &$response, array &$info` 49 | 50 | `$info` contains the associated array as defined in [curl-getinfo-returnvalues](http://php.net/manual/en/function.curl-getinfo.php#refsect1-function.curl-getinfo-returnvalues) 51 | 52 | * `fsockopen.before_request` 53 | 54 | Run events before the transport does anything 55 | 56 | * `fsockopen.after_headers` 57 | 58 | Add extra headers before the body begins (i.e. before `\r\n\r\n`) 59 | 60 | Parameters: `string &$out` 61 | 62 | * `fsockopen.before_send` 63 | 64 | Add body data before sending the request 65 | 66 | Parameters: `string &$out` 67 | 68 | * `fsockopen.after_send` 69 | 70 | Run events after writing the data to the socket 71 | 72 | * `fsockopen.after_request` 73 | 74 | Alter the raw HTTP response before returning for parsing 75 | 76 | Parameters: `string &$response, array &$info` 77 | 78 | `$info` contains the associated array as defined in [stream-get-meta-data-returnvalues](http://php.net/manual/en/function.stream-get-meta-data.php#refsect1-function.stream-get-meta-data-returnvalues) 79 | 80 | 81 | Registering Hooks 82 | ----------------- 83 | Note: if you're doing this in an authentication handler, see the [Custom 84 | Authentication guide][authentication-custom] instead. 85 | 86 | [authentication-custom]: authentication-custom.md 87 | 88 | In order to register your own hooks, you need to instantiate `Requests_hooks` 89 | and pass this in via the 'hooks' option. 90 | 91 | ```php 92 | $hooks = new Requests_Hooks(); 93 | $hooks->register('requests.after_request', 'mycallback'); 94 | 95 | $request = Requests::get('http://httpbin.org/get', array(), array('hooks' => $hooks)); 96 | ``` 97 | -------------------------------------------------------------------------------- /main/example1.php: -------------------------------------------------------------------------------- 1 | getStreams(); 21 | foreach ($streams as $stream) { 22 | $stream->urls = $videoInfo->getVideoSrcs($stream); 23 | } 24 | 25 | } 26 | 27 | ?> 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 优酷视频解析 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
48 | 49 |
50 | 51 |
52 | 53 |
54 | 55 |
56 |
57 | 58 |
59 |
60 | 61 |
62 | 63 |
64 | 65 | 66 |
67 |

流类型:stream_type?> 宽:width?> 高:height?>

68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | urls as $url) { 76 | echo ""; 80 | } ?> 81 | 82 |
url
"; 77 | $show_url = substr($url, 0, 100)."..."; 78 | echo "{$show_url}"; 79 | echo "
83 |
84 | 85 | 86 |
87 | 88 |
89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /main/example2.php: -------------------------------------------------------------------------------- 1 | getStreams(); 32 | 33 | foreach ($streams as $stream) { 34 | if ($stream->stream_type == "3gphd") {//取3gphd流的视频 35 | $urls = $videoInfo->getVideoSrcs($stream); 36 | break; 37 | } 38 | } 39 | 40 | } 41 | 42 | ?> 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 优酷视频解析 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
63 | 64 |
65 | 66 |
67 | 68 |
69 | 70 |
71 |
72 | 73 |
74 |
75 | 76 |
77 | 78 |
79 | 80 | 81 |
82 |
83 |

84 |
85 |
86 |
87 | 88 |
89 |
90 |
91 | 92 | 93 |
94 | 95 |
96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /Requests-master/tests/IDNAEncoder.php: -------------------------------------------------------------------------------- 1 | assertEquals($expected, $result); 23 | } 24 | 25 | /** 26 | * @expectedException Requests_Exception 27 | */ 28 | public function testASCIITooLong() { 29 | $data = str_repeat("abcd", 20); 30 | $result = Requests_IDNAEncoder::encode($data); 31 | } 32 | 33 | /** 34 | * @expectedException Requests_Exception 35 | */ 36 | public function testEncodedTooLong() { 37 | $data = str_repeat("\xe4\xbb\x96", 60); 38 | $result = Requests_IDNAEncoder::encode($data); 39 | } 40 | 41 | /** 42 | * @expectedException Requests_Exception 43 | */ 44 | public function testAlreadyPrefixed() { 45 | $result = Requests_IDNAEncoder::encode("xn--\xe4\xbb\x96"); 46 | } 47 | 48 | public function testASCIICharacter() { 49 | $result = Requests_IDNAEncoder::encode("a"); 50 | $this->assertEquals('a', $result); 51 | } 52 | 53 | public function testTwoByteCharacter() { 54 | $result = Requests_IDNAEncoder::encode("\xc2\xb6"); // Pilcrow character 55 | $this->assertEquals('xn--tba', $result); 56 | } 57 | 58 | public function testThreeByteCharacter() { 59 | $result = Requests_IDNAEncoder::encode("\xe2\x82\xac"); // Euro symbol 60 | $this->assertEquals('xn--lzg', $result); 61 | } 62 | 63 | public function testFourByteCharacter() { 64 | $result = Requests_IDNAEncoder::encode("\xf0\xa4\xad\xa2"); // Chinese symbol? 65 | $this->assertEquals('xn--ww6j', $result); 66 | } 67 | 68 | /** 69 | * @expectedException Requests_Exception 70 | */ 71 | public function testFiveByteCharacter() { 72 | $result = Requests_IDNAEncoder::encode("\xfb\xb6\xb6\xb6\xb6"); 73 | } 74 | 75 | /** 76 | * @expectedException Requests_Exception 77 | */ 78 | public function testSixByteCharacter() { 79 | $result = Requests_IDNAEncoder::encode("\xfd\xb6\xb6\xb6\xb6\xb6"); 80 | } 81 | 82 | /** 83 | * @expectedException Requests_Exception 84 | */ 85 | public function testInvalidASCIICharacterWithMultibyte() { 86 | $result = Requests_IDNAEncoder::encode("\0\xc2\xb6"); 87 | } 88 | 89 | /** 90 | * @expectedException Requests_Exception 91 | */ 92 | public function testUnfinishedMultibyte() { 93 | $result = Requests_IDNAEncoder::encode("\xc2"); 94 | } 95 | 96 | /** 97 | * @expectedException Requests_Exception 98 | */ 99 | public function testPartialMultibyte() { 100 | $result = Requests_IDNAEncoder::encode("\xc2\xc2\xb6"); 101 | } 102 | } -------------------------------------------------------------------------------- /Requests-master/library/Requests/Response.php: -------------------------------------------------------------------------------- 1 | headers = new Requests_Response_Headers(); 21 | $this->cookies = new Requests_Cookie_Jar(); 22 | } 23 | 24 | /** 25 | * Response body 26 | * 27 | * @var string 28 | */ 29 | public $body = ''; 30 | 31 | /** 32 | * Raw HTTP data from the transport 33 | * 34 | * @var string 35 | */ 36 | public $raw = ''; 37 | 38 | /** 39 | * Headers, as an associative array 40 | * 41 | * @var Requests_Response_Headers Array-like object representing headers 42 | */ 43 | public $headers = array(); 44 | 45 | /** 46 | * Status code, false if non-blocking 47 | * 48 | * @var integer|boolean 49 | */ 50 | public $status_code = false; 51 | 52 | /** 53 | * Protocol version, false if non-blocking 54 | * @var float|boolean 55 | */ 56 | public $protocol_version = false; 57 | 58 | /** 59 | * Whether the request succeeded or not 60 | * 61 | * @var boolean 62 | */ 63 | public $success = false; 64 | 65 | /** 66 | * Number of redirects the request used 67 | * 68 | * @var integer 69 | */ 70 | public $redirects = 0; 71 | 72 | /** 73 | * URL requested 74 | * 75 | * @var string 76 | */ 77 | public $url = ''; 78 | 79 | /** 80 | * Previous requests (from redirects) 81 | * 82 | * @var array Array of Requests_Response objects 83 | */ 84 | public $history = array(); 85 | 86 | /** 87 | * Cookies from the request 88 | * 89 | * @var Requests_Cookie_Jar Array-like object representing a cookie jar 90 | */ 91 | public $cookies = array(); 92 | 93 | /** 94 | * Is the response a redirect? 95 | * 96 | * @return boolean True if redirect (3xx status), false if not. 97 | */ 98 | public function is_redirect() { 99 | $code = $this->status_code; 100 | return in_array($code, array(300, 301, 302, 303, 307)) || $code > 307 && $code < 400; 101 | } 102 | 103 | /** 104 | * Throws an exception if the request was not successful 105 | * 106 | * @throws Requests_Exception If `$allow_redirects` is false, and code is 3xx (`response.no_redirects`) 107 | * @throws Requests_Exception_HTTP On non-successful status code. Exception class corresponds to code (e.g. {@see Requests_Exception_HTTP_404}) 108 | * @param boolean $allow_redirects Set to false to throw on a 3xx as well 109 | */ 110 | public function throw_for_status($allow_redirects = true) { 111 | if ($this->is_redirect()) { 112 | if (!$allow_redirects) { 113 | throw new Requests_Exception('Redirection not allowed', 'response.no_redirects', $this); 114 | } 115 | } 116 | elseif (!$this->success) { 117 | $exception = Requests_Exception_HTTP::get_class($this->status_code); 118 | throw new $exception(null, $this); 119 | } 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /Requests-master/tests/ChunkedEncoding.php: -------------------------------------------------------------------------------- 1 | body = $body; 39 | $transport->chunked = true; 40 | 41 | $options = array( 42 | 'transport' => $transport 43 | ); 44 | $response = Requests::get('http://example.com/', array(), $options); 45 | 46 | $this->assertEquals($expected, $response->body); 47 | } 48 | 49 | public static function notChunkedProvider() { 50 | return array( 51 | 'invalid chunk size' => array( 'Hello! This is a non-chunked response!' ), 52 | 'invalid chunk extension' => array( '1BNot chunked\r\nLooks chunked but it is not\r\n' ), 53 | 'unquoted chunk-ext-val with space' => array( "02;foo=unquoted with space\r\nab\r\n04\r\nra\nc\r\n06\r\nadabra\r\n0c\r\n\nall we got\n" ), 54 | 'unquoted chunk-ext-val with forbidden character' => array( "02;foo={unquoted}\r\nab\r\n04\r\nra\nc\r\n06\r\nadabra\r\n0c\r\n\nall we got\n" ), 55 | 'invalid chunk-ext-name' => array( "02;{foo}=bar\r\nab\r\n04\r\nra\nc\r\n06\r\nadabra\r\n0c\r\n\nall we got\n" ), 56 | 'incomplete quote for chunk-ext-value' => array( "02;foo=\"no end quote\r\nab\r\n04\r\nra\nc\r\n06\r\nadabra\r\n0c\r\n\nall we got\n" ), 57 | ); 58 | } 59 | 60 | /** 61 | * Response says it's chunked, but actually isn't 62 | * @dataProvider notChunkedProvider 63 | */ 64 | public function testNotActuallyChunked($body) { 65 | $transport = new MockTransport(); 66 | $transport->body = $body; 67 | $transport->chunked = true; 68 | 69 | $options = array( 70 | 'transport' => $transport 71 | ); 72 | $response = Requests::get('http://example.com/', array(), $options); 73 | 74 | $this->assertEquals($transport->body, $response->body); 75 | } 76 | 77 | 78 | /** 79 | * Response says it's chunked and starts looking like it is, but turns out 80 | * that they're lying to us 81 | */ 82 | public function testMixedChunkiness() { 83 | $transport = new MockTransport(); 84 | $transport->body = "02\r\nab\r\nNot actually chunked!"; 85 | $transport->chunked = true; 86 | 87 | $options = array( 88 | 'transport' => $transport 89 | ); 90 | $response = Requests::get('http://example.com/', array(), $options); 91 | $this->assertEquals($transport->body, $response->body); 92 | } 93 | } -------------------------------------------------------------------------------- /video-url-parser-master/test/video-url-parser.js: -------------------------------------------------------------------------------- 1 | (function(factory) { 2 | var isBrowser = typeof window === "object", 3 | chai, core; 4 | if (isBrowser) { 5 | chai = window.chai; 6 | factory(chai.assert, window.VideoUrlParser, window.VideoProvider, window.VideoUrlParserUtil, true); 7 | } else { 8 | chai = require("chai"); 9 | core = require("../src/video-url-parser.js"); 10 | factory(chai.assert, core.VideoUrlParser, core.VideoProvider, core.util, false); 11 | } 12 | })(function(assert, VideoUrlParser, VideoProvider, util, isBrowser) { 13 | function tester() { 14 | describe("VideoProvider", function() { 15 | it('validProvider', function() { 16 | assert.equal(VideoProvider.validProvider({}), false); 17 | assert.equal(VideoProvider.validProvider({ 18 | name: "abc" 19 | }), false); 20 | assert.equal(VideoProvider.validProvider({ 21 | host: "abc" 22 | }), false); 23 | assert.equal(VideoProvider.validProvider({ 24 | parser: function() {} 25 | }), false); 26 | assert.equal(VideoProvider.validProvider({ 27 | host: "abc", 28 | parser: function() {} 29 | }), true); 30 | assert.equal(VideoProvider.validProvider({ 31 | parser: function() {}, 32 | passParser: function() {} 33 | }), true); 34 | }); 35 | 36 | it('constructor', function() { 37 | var p1 = new VideoProvider({}); 38 | assert.isTrue(!p1.host); 39 | 40 | var p2 = new VideoProvider({ 41 | parser: function() {}, 42 | passParser: function() {} 43 | }); 44 | assert.isTrue(p2.host && p2.host != ""); 45 | assert.isTrue(typeof p2.passParser === "function"); 46 | }); 47 | }); 48 | 49 | describe("VideoUrlParser", function() { 50 | var v1 = new VideoUrlParser("abc"); 51 | 52 | it('addProvider', function() { 53 | v1.addProvider({ 54 | host: "youku.com", 55 | parser: function() { 56 | return 1; 57 | }, 58 | hostMatch: function(s) { 59 | return s === "abc" ? "youku.com" : ""; 60 | } 61 | }); 62 | 63 | assert.isTrue(typeof v1.providers["youku.com"] === "object" && v1.providers["youku.com"] instanceof VideoProvider); 64 | }); 65 | 66 | it('parser', function() { 67 | assert.isTrue(v1.parser("abc") === 1); 68 | }); 69 | }); 70 | 71 | describe("util", function() { 72 | var v1 = new VideoUrlParser("abc"); 73 | 74 | it('each', function() { 75 | var obj = { 76 | a: 1 77 | }; 78 | util.each(obj, function(value, key) { 79 | assert.isTrue(value === 1); 80 | assert.isTrue(key === "a"); 81 | }); 82 | }); 83 | }); 84 | } 85 | 86 | if (isBrowser) { 87 | describe("test video-url-parser.js", tester); 88 | } else { 89 | return tester(); 90 | } 91 | }); -------------------------------------------------------------------------------- /main/VideoJs_ie6/js/videojs-segment.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.7.1 2 | (function() { 3 | var segmentPlugin; 4 | 5 | segmentPlugin = function(options) { 6 | var Player, duration, end, index, segments, start; 7 | Player = this.constructor; 8 | Player.__super__ = { 9 | src: Player.prototype.src, 10 | currentTime: Player.prototype.currentTime, 11 | duration: Player.prototype.duration, 12 | bufferedPercent: Player.prototype.bufferedPercent 13 | }; 14 | index = start = end = duration = 0; 15 | segments = []; 16 | 17 | /* 18 | The source function updates the video source 19 | 20 | **Array of Source Segment Objects:** To provide multiple source segments so 21 | that it can be played like a single file. 22 | 23 | myPlayer.src([ 24 | { seconds: 300, src: "http://www.example.com/path/to/video1.mp4" }, 25 | { seconds: 100, src: "http://www.example.com/path/to/video2.mp4" }, 26 | { seconds: 400, src: "http://www.example.com/path/to/video3.mp4" } 27 | ]); 28 | */ 29 | return Player.prototype.src = function(source) { 30 | var seg, _i, _len, _ref; 31 | if (source instanceof Array && ((_ref = source[0]) != null ? _ref.seconds : void 0)) { 32 | segments = source; 33 | Player.prototype.currentTime = function(seconds) { 34 | if (seconds) { 35 | Player.__super__.currentTime.call(this, seconds - start); 36 | return this.segmentSeek(seconds); 37 | } else { 38 | return Player.__super__.currentTime.apply(this, arguments) + start; 39 | } 40 | }; 41 | Player.prototype.duration = function(seconds) { 42 | if (seconds) { 43 | seconds = duration; 44 | } 45 | return Player.__super__.duration.call(this, seconds); 46 | }; 47 | Player.prototype.bufferedPercent = function() { 48 | return Player.__super__.bufferedPercent.apply(this, arguments) + start / duration; 49 | }; 50 | Player.prototype.segmentSeek = function(seconds) { 51 | if (seconds < 0 || seconds > duration || seconds > start && seconds < end) { 52 | return; 53 | } 54 | index = start = 0; 55 | while (seconds >= start + segments[index].seconds) { 56 | start += segments[index].seconds; 57 | index++; 58 | } 59 | end = start + segments[index].seconds; 60 | this.src(segments[index].src); 61 | this.one('canplay', function() { 62 | if (this.currentTime() !== seconds) { 63 | return this.currentTime(seconds); 64 | } 65 | }); 66 | return this.play(); 67 | }; 68 | duration = 0; 69 | for (_i = 0, _len = segments.length; _i < _len; _i++) { 70 | seg = segments[_i]; 71 | duration += seg.seconds; 72 | } 73 | end = start + segments[index].seconds; 74 | this.on('ended', function() { 75 | if (index < segments.length - 1) { 76 | start = end; 77 | index++; 78 | end += segments[index].seconds; 79 | this.src(segments[index].src); 80 | return this.play(); 81 | } 82 | }); 83 | return Player.__super__.src.call(this, source[0].src); 84 | } else { 85 | return Player.__super__.src.apply(this, arguments); 86 | } 87 | }; 88 | }; 89 | 90 | window.videojs.plugin('segment', segmentPlugin); 91 | 92 | }).call(this); 93 | -------------------------------------------------------------------------------- /main/class/Ep.php: -------------------------------------------------------------------------------- 1 | = "a" && $source[$d] <= "z" ? self::charCodeAt($source[$d], 0) - self::charCodeAt("a", 0) : $source[$d] - "0" + 26; 20 | for ($f = 0; $f < 36; $f++) if (self::$key[$f] == $char) { 21 | $char = $f; 22 | break; 23 | } 24 | $char > 25 ? $newStr[$d] = $char - 26 : $newStr[$d] = chr($char + 97); 25 | } 26 | return implode($newStr); 27 | } 28 | 29 | public static function generate($sid, $fileId, $token) 30 | { 31 | $userCache = Constants::getUserCache(); 32 | $mk = Constants::getMk(); 33 | 34 | $source = $mk['a4'] . "poz" . $userCache['a2']; 35 | $pwd = self::translate($source); 36 | $data = $sid . "_" . $fileId . "_" . $token; 37 | $strBase64 = base64_encode(self::rc4($pwd, $data)); 38 | return urlencode($strBase64); 39 | } 40 | 41 | public static function decode($encrypt_string) 42 | { 43 | $userCache = Constants::getUserCache(); 44 | $mk = Constants::getMk(); 45 | 46 | $pwd = self::translate($mk['a3'] . "o0b" . $userCache['a1']); 47 | 48 | $data = base64_decode($encrypt_string); 49 | $result = self::rc4($pwd, $data); 50 | $arr = explode("_", $result); 51 | return $arr; 52 | } 53 | 54 | public static function rc4($pwd, $data)//$pwd密钥 $data需加密字符串 55 | { 56 | $key[] = ""; 57 | $box[] = ""; 58 | 59 | $pwd_length = strlen($pwd); 60 | $data_length = strlen($data); 61 | 62 | for ($i = 0; $i < 256; $i++) { 63 | $key[$i] = ord($pwd[$i % $pwd_length]); 64 | $box[$i] = $i; 65 | } 66 | 67 | for ($j = $i = 0; $i < 256; $i++) { 68 | $j = ($j + $box[$i] + $key[$i]) % 256; 69 | $tmp = $box[$i]; 70 | $box[$i] = $box[$j]; 71 | $box[$j] = $tmp; 72 | } 73 | 74 | $cipher = ""; 75 | 76 | for ($a = $j = $i = 0; $i < $data_length; $i++) { 77 | $a = ($a + 1) % 256; 78 | $j = ($j + $box[$a]) % 256; 79 | 80 | $tmp = $box[$a]; 81 | $box[$a] = $box[$j]; 82 | $box[$j] = $tmp; 83 | 84 | $k = $box[(($box[$a] + $box[$j]) % 256)]; 85 | $cipher .= chr(ord($data[$i]) ^ $k); 86 | } 87 | 88 | return $cipher; 89 | } 90 | 91 | public static function fromCharCode($codes) 92 | { 93 | if (is_scalar($codes)) $codes = func_get_args(); 94 | $str = ''; 95 | foreach ($codes as $code) $str .= chr($code); 96 | 97 | return $str; 98 | } 99 | 100 | public static function charCodeAt($str, $index) 101 | { 102 | $char = mb_substr($str, $index, 1, 'UTF-8'); 103 | 104 | if (mb_check_encoding($char, 'UTF-8')) { 105 | $ret = mb_convert_encoding($char, 'UTF-32BE', 'UTF-8'); 106 | return hexdec(bin2hex($ret)); 107 | } else { 108 | return null; 109 | } 110 | } 111 | 112 | } -------------------------------------------------------------------------------- /Requests-master/tests/SSL.php: -------------------------------------------------------------------------------- 1 | assertTrue(Requests_SSL::match_domain($base, $dnsname)); 39 | } 40 | 41 | /** 42 | * @dataProvider domainNoMatchProvider 43 | */ 44 | public function testNoMatch($base, $dnsname) { 45 | $this->assertFalse(Requests_SSL::match_domain($base, $dnsname)); 46 | } 47 | 48 | protected function fakeCertificate($dnsname, $with_san = true) { 49 | $certificate = array( 50 | 'subject' => array( 51 | 'CN' => $dnsname 52 | ), 53 | ); 54 | 55 | if ($with_san !== false) { 56 | // If SAN is set to true, default it to the dNSName 57 | if ($with_san === true) { 58 | $with_san = $dnsname; 59 | } 60 | $certificate['extensions'] = array( 61 | 'subjectAltName' => 'DNS: ' . $with_san, 62 | ); 63 | } 64 | 65 | return $certificate; 66 | } 67 | 68 | /** 69 | * @dataProvider domainMatchProvider 70 | */ 71 | public function testMatchViaCertificate($base, $dnsname) { 72 | $certificate = $this->fakeCertificate($dnsname); 73 | $this->assertTrue(Requests_SSL::verify_certificate($base, $certificate)); 74 | } 75 | 76 | /** 77 | * @dataProvider domainNoMatchProvider 78 | */ 79 | public function testNoMatchViaCertificate($base, $dnsname) { 80 | $certificate = $this->fakeCertificate($dnsname); 81 | $this->assertFalse(Requests_SSL::verify_certificate($base, $certificate)); 82 | } 83 | 84 | public function testCNFallback() { 85 | $certificate = $this->fakeCertificate('example.com', false); 86 | $this->assertTrue(Requests_SSL::verify_certificate('example.com', $certificate)); 87 | } 88 | 89 | public function testInvalidCNFallback() { 90 | $certificate = $this->fakeCertificate('example.com', false); 91 | $this->assertFalse(Requests_SSL::verify_certificate('example.net', $certificate)); 92 | } 93 | 94 | /** 95 | * Test a certificate with both CN and SAN fields 96 | * 97 | * As per RFC2818, if the SAN field exists, we should parse that and ignore 98 | * the value of the CN field. 99 | * 100 | * @link http://tools.ietf.org/html/rfc2818#section-3.1 101 | */ 102 | public function testIgnoreCNWithSAN() { 103 | $certificate = $this->fakeCertificate('example.net', 'example.com'); 104 | 105 | $this->assertTrue(Requests_SSL::verify_certificate('example.com', $certificate), 'Checking SAN validation'); 106 | $this->assertFalse(Requests_SSL::verify_certificate('example.net', $certificate), 'Checking CN non-validation'); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /youkuvod-master/ckplayer/related.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | {font color="#FFDD00" face="新宋体"}精彩视频推荐{/font} 4 | 5 | 600,400,0xFFDD00,20 6 | 14 | 120,90 15 | 16 | 150,175,100 17 | 23 | {a href="[url]" target="_blank"}{font color="#FFFFFF" face="新宋体"}[title]{/font}{/a} 24 | 25 | 26 | 27 | 120,42,3 28 | 29 | 30 | 31 | temp/1.jpg 32 | http://www.ckplayer.com/index.php?id=1 33 | 1:这里调用的文件配置在ckplayer/related.xml里 34 | 35 | 36 | temp/2.jpg 37 | http://www.ckplayer.com/index.php?id=2 38 | 2:支持多页调用 39 | 40 | 41 | temp/3.jpg 42 | http://www.ckplayer.com/index.php?id=3 43 | 3:文本请保持在二行,不能多于三行,多于三行将不显示 44 | 45 | 46 | temp/4.jpg 47 | http://www.ckplayer.com/index.php?id=3 48 | 4:支持多行调用,多页调用 49 | 50 | 51 | temp/5.jpg 52 | http://www.ckplayer.com/index.php?id=2 53 | 5:感谢对ckplayer的支持 54 | 55 | 56 | temp/6.jpg 57 | http://www.ckplayer.com/index.php?id=1 58 | 6:最多两行,请不要超过二行 59 | 60 | 61 | temp/3.jpg 62 | http://www.ckplayer.com/index.php?id=1 63 | 7:这里调用的文件配置在ckplayer/related.xml里 64 | 65 | 66 | temp/5.jpg 67 | http://www.ckplayer.com/index.php?id=2 68 | 8:支持多页调用 69 | 70 | 71 | temp/4.jpg 72 | http://www.ckplayer.com/index.php?id=3 73 | 9:文本请保持在二行,不能多于三行,多于三行将不显示 74 | 75 | 76 | temp/1.jpg 77 | http://www.ckplayer.com/index.php?id=3 78 | 10:支持多行调用,多页调用 79 | 80 | 81 | temp/2.jpg 82 | http://www.ckplayer.com/index.php?id=2 83 | 11:感谢对ckplayer的支持 84 | 85 | 86 | temp/6.jpg 87 | http://www.ckplayer.com/index.php?id=1 88 | 12:最多两行,请不要超过二行 89 | 90 | 91 | temp/5.jpg 92 | http://www.ckplayer.com/index.php?id=1 93 | 13:这里调用的文件配置在ckplayer/related.xml里 94 | 95 | 96 | temp/4.jpg 97 | http://www.ckplayer.com/index.php?id=2 98 | 14:支持多页调用 99 | 100 | 101 | temp/6.jpg 102 | http://www.ckplayer.com/index.php?id=3 103 | 15:文本请保持在二行,不能多于三行,多于三行将不显示 104 | 105 | 106 | temp/3.jpg 107 | http://www.ckplayer.com/index.php?id=3 108 | 16:支持多行调用,多页调用 109 | 110 | 111 | temp/1.jpg 112 | http://www.ckplayer.com/index.php?id=2 113 | 17:感谢对ckplayer的支持 114 | 115 | 116 | temp/2.jpg 117 | http://www.ckplayer.com/index.php?id=1 118 | 18:最多两行,请不要超过二行 119 | 120 | 121 | -------------------------------------------------------------------------------- /Youku-m3u8-php-master/youku-m3u8.php: -------------------------------------------------------------------------------- 1 | $h; $h++) { 6 | $b[$h]=$h; 7 | } 8 | for ($h=0; 256 > $h; $h++) { 9 | $f=(($f + $b[$h]) + charCodeAt($a, $h % strlen($a))) % 256; 10 | $i=$b[$h]; 11 | $b[$h]=$b[$f]; 12 | $b[$f]=$i; 13 | } 14 | for ($q=($f=($h=0)); $q < strlen($c); $q++) { 15 | $h=($h + 1) % 256; 16 | $f=($f + $b[$h]) % 256; 17 | $i=$b[$h]; 18 | $b[$h]=$b[$f]; 19 | $b[$f]=$i; 20 | $e .= fromCharCode(charCodeAt($c, $q) ^ $b[($b[$h] + $b[$f]) % 256]); 21 | } 22 | return $e; 23 | } 24 | 25 | function fromCharCode($codes){ 26 | if (is_scalar($codes)) { 27 | $codes=func_get_args(); 28 | } 29 | $str=''; 30 | foreach ($codes as $code) { 31 | $str .= chr($code); 32 | } 33 | return $str; 34 | } 35 | 36 | function charCodeAt($str, $index){ 37 | $charCode=array(); 38 | $key=md5($str); 39 | $index=$index + 1; 40 | if (isset($charCode[$key])) { 41 | return $charCode[$key][$index]; 42 | } 43 | $charCode[$key]=unpack('C*', $str); 44 | return $charCode[$key][$index]; 45 | } 46 | 47 | function charAt($str, $index=0){ 48 | return substr($str, $index, 1); 49 | } 50 | 51 | 52 | if(!empty($_GET['vid'])){ 53 | $vid=$_GET['vid']; 54 | $curl=curl_init(); 55 | curl_setopt($curl,CURLOPT_URL,'http://p.l.youku.com/ypvlog'); 56 | curl_setopt($curl,CURLOPT_ENCODING, 'gzip,deflate'); 57 | curl_setopt($curl,CURLOPT_HEADER,1); 58 | curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); 59 | curl_setopt($curl,CURLOPT_TIMEOUT,10); 60 | $return=curl_exec($curl); 61 | $headerSize=curl_getinfo($curl, CURLINFO_HEADER_SIZE); 62 | curl_close($curl); 63 | $header=explode("\r\n",substr($return, 0, $headerSize)); 64 | foreach($header as $headeritem){ 65 | if(substr($headeritem,12,7)=='__ysuid') 66 | $ysuid=substr($headeritem,20); 67 | } 68 | $curl=curl_init(); 69 | curl_setopt($curl,CURLOPT_URL,'http://v.youku.com/v_show/id_'.$vid.'.html?x'); 70 | curl_setopt($curl,CURLOPT_ENCODING, 'gzip,deflate'); 71 | curl_setopt($curl,CURLOPT_HTTPHEADER,array('User-Agent: Mozilla/5.0 (iPod; CPU iPhone OS_5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3')); 72 | curl_setopt($curl,CURLOPT_HEADER,1); 73 | curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); 74 | curl_setopt($curl,CURLOPT_TIMEOUT,10); 75 | $return=curl_exec($curl); 76 | $headerSize=curl_getinfo($curl, CURLINFO_HEADER_SIZE); 77 | curl_close($curl); 78 | $header=explode("\r\n",substr($return, 0, $headerSize)); 79 | foreach($header as $headeritem){ 80 | if(substr($headeritem,12,4)=='ykss') 81 | $ykss=substr($headeritem,20); 82 | } 83 | $cookie=''; 84 | if(empty($ysuid)||empty($ykss)){ 85 | echo 'Fetch Required Cookie Failed'; 86 | exit; 87 | } 88 | $ysuid=substr($ysuid,0,strpos($ysuid,';')); 89 | $ykss=substr($ykss,0,strpos($ykss,';')); 90 | $cookie='Cookie: ykss='.$ykss.'; __ysuid='.$ysuid.';'; 91 | 92 | $link='http://play.youku.com/play/get.json?vid='.$vid.'&ct=12'; 93 | $curl=curl_init(); 94 | curl_setopt($curl,CURLOPT_URL,$link); 95 | curl_setopt($curl,CURLOPT_ENCODING, 'gzip,deflate'); 96 | curl_setopt($curl,CURLOPT_HEADER,0); 97 | curl_setopt($curl,CURLOPT_HTTPHEADER,array('Referer: http://v.youku.com/v_show/'.$vid.'.html?x',$cookie)); 98 | curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); 99 | curl_setopt($curl,CURLOPT_TIMEOUT,10); 100 | $retval=curl_exec($curl); 101 | curl_close($curl); 102 | 103 | if(!empty($retval)){ 104 | $rs=json_decode($retval, true); 105 | $ep=$rs['data']['security']['encrypt_string']; 106 | if (!empty($ep)){ 107 | $ip=$rs['data']['security']['ip']; 108 | $videoid=$rs['data']['id']; 109 | list($sid, $token)=explode('_',yk_e('becaf9be', base64_decode($ep))); 110 | $ep=urlencode(base64_encode(yk_e('bf7e5f01',$sid.'_'.$videoid.'_'.$token))); 111 | $final_url='http://pl.youku.com/playlist/m3u8?ctype=12&ep='.$ep.'&ev=1&keyframe=1&oip='.$ip.'&sid='.$sid.'&token='.$token.'&vid='.$videoid.'&type=mp4'; 112 | echo $final_url; 113 | } else 114 | echo 'Invalid vid.'; 115 | } else 116 | echo 'Error fetching.'; 117 | } else 118 | echo 'No input.'; 119 | ?> -------------------------------------------------------------------------------- /Requests-master/tests/Proxy/HTTP.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('Proxy not available'); 17 | } 18 | } 19 | 20 | public function transportProvider() { 21 | return array( 22 | array('Requests_Transport_cURL'), 23 | array('Requests_Transport_fsockopen'), 24 | ); 25 | } 26 | 27 | /** 28 | * @dataProvider transportProvider 29 | */ 30 | public function testConnectWithString($transport) { 31 | $this->checkProxyAvailable(); 32 | 33 | $options = array( 34 | 'proxy' => REQUESTS_HTTP_PROXY, 35 | 'transport' => $transport, 36 | ); 37 | $response = Requests::get(httpbin('/get'), array(), $options); 38 | $this->assertEquals('http', $response->headers['x-requests-proxied']); 39 | 40 | $data = json_decode($response->body, true); 41 | $this->assertEquals('http', $data['headers']['x-requests-proxy']); 42 | } 43 | 44 | /** 45 | * @dataProvider transportProvider 46 | */ 47 | public function testConnectWithArray($transport) { 48 | $this->checkProxyAvailable(); 49 | 50 | $options = array( 51 | 'proxy' => array(REQUESTS_HTTP_PROXY), 52 | 'transport' => $transport, 53 | ); 54 | $response = Requests::get(httpbin('/get'), array(), $options); 55 | $this->assertEquals('http', $response->headers['x-requests-proxied']); 56 | 57 | $data = json_decode($response->body, true); 58 | $this->assertEquals('http', $data['headers']['x-requests-proxy']); 59 | } 60 | 61 | /** 62 | * @dataProvider transportProvider 63 | * @expectedException Requests_Exception 64 | */ 65 | public function testConnectInvalidParameters($transport) { 66 | $this->checkProxyAvailable(); 67 | 68 | $options = array( 69 | 'proxy' => array(REQUESTS_HTTP_PROXY, 'testuser', 'password', 'something'), 70 | 'transport' => $transport, 71 | ); 72 | $response = Requests::get(httpbin('/get'), array(), $options); 73 | } 74 | 75 | /** 76 | * @dataProvider transportProvider 77 | */ 78 | public function testConnectWithInstance($transport) { 79 | $this->checkProxyAvailable(); 80 | 81 | $options = array( 82 | 'proxy' => new Requests_Proxy_HTTP(REQUESTS_HTTP_PROXY), 83 | 'transport' => $transport, 84 | ); 85 | $response = Requests::get(httpbin('/get'), array(), $options); 86 | $this->assertEquals('http', $response->headers['x-requests-proxied']); 87 | 88 | $data = json_decode($response->body, true); 89 | $this->assertEquals('http', $data['headers']['x-requests-proxy']); 90 | } 91 | 92 | /** 93 | * @dataProvider transportProvider 94 | */ 95 | public function testConnectWithAuth($transport) { 96 | $this->checkProxyAvailable('auth'); 97 | 98 | $options = array( 99 | 'proxy' => array( 100 | REQUESTS_HTTP_PROXY_AUTH, 101 | REQUESTS_HTTP_PROXY_AUTH_USER, 102 | REQUESTS_HTTP_PROXY_AUTH_PASS 103 | ), 104 | 'transport' => $transport, 105 | ); 106 | $response = Requests::get(httpbin('/get'), array(), $options); 107 | $this->assertEquals(200, $response->status_code); 108 | $this->assertEquals('http', $response->headers['x-requests-proxied']); 109 | 110 | $data = json_decode($response->body, true); 111 | $this->assertEquals('http', $data['headers']['x-requests-proxy']); 112 | } 113 | 114 | /** 115 | * @dataProvider transportProvider 116 | */ 117 | public function testConnectWithInvalidAuth($transport) { 118 | $this->checkProxyAvailable('auth'); 119 | 120 | $options = array( 121 | 'proxy' => array( 122 | REQUESTS_HTTP_PROXY_AUTH, 123 | REQUESTS_HTTP_PROXY_AUTH_USER . '!', 124 | REQUESTS_HTTP_PROXY_AUTH_PASS . '!' 125 | ), 126 | 'transport' => $transport, 127 | ); 128 | $response = Requests::get(httpbin('/get'), array(), $options); 129 | $this->assertEquals(407, $response->status_code); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /Requests-master/library/Requests/Proxy/HTTP.php: -------------------------------------------------------------------------------- 1 | proxy = $args; 60 | } 61 | elseif (is_array($args)) { 62 | if (count($args) == 1) { 63 | list($this->proxy) = $args; 64 | } 65 | elseif (count($args) == 3) { 66 | list($this->proxy, $this->user, $this->pass) = $args; 67 | $this->use_authentication = true; 68 | } 69 | else { 70 | throw new Requests_Exception('Invalid number of arguments', 'proxyhttpbadargs'); 71 | } 72 | } 73 | } 74 | 75 | /** 76 | * Register the necessary callbacks 77 | * 78 | * @since 1.6 79 | * @see curl_before_send 80 | * @see fsockopen_remote_socket 81 | * @see fsockopen_remote_host_path 82 | * @see fsockopen_header 83 | * @param Requests_Hooks $hooks Hook system 84 | */ 85 | public function register(Requests_Hooks &$hooks) { 86 | $hooks->register('curl.before_send', array(&$this, 'curl_before_send')); 87 | 88 | $hooks->register('fsockopen.remote_socket', array(&$this, 'fsockopen_remote_socket')); 89 | $hooks->register('fsockopen.remote_host_path', array(&$this, 'fsockopen_remote_host_path')); 90 | if ($this->use_authentication) { 91 | $hooks->register('fsockopen.after_headers', array(&$this, 'fsockopen_header')); 92 | } 93 | } 94 | 95 | /** 96 | * Set cURL parameters before the data is sent 97 | * 98 | * @since 1.6 99 | * @param resource $handle cURL resource 100 | */ 101 | public function curl_before_send(&$handle) { 102 | curl_setopt($handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); 103 | curl_setopt($handle, CURLOPT_PROXY, $this->proxy); 104 | 105 | if ($this->use_authentication) { 106 | curl_setopt($handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY); 107 | curl_setopt($handle, CURLOPT_PROXYUSERPWD, $this->get_auth_string()); 108 | } 109 | } 110 | 111 | /** 112 | * Alter remote socket information before opening socket connection 113 | * 114 | * @since 1.6 115 | * @param string $remote_socket Socket connection string 116 | */ 117 | public function fsockopen_remote_socket(&$remote_socket) { 118 | $remote_socket = $this->proxy; 119 | } 120 | 121 | /** 122 | * Alter remote path before getting stream data 123 | * 124 | * @since 1.6 125 | * @param string $path Path to send in HTTP request string ("GET ...") 126 | * @param string $url Full URL we're requesting 127 | */ 128 | public function fsockopen_remote_host_path(&$path, $url) { 129 | $path = $url; 130 | } 131 | 132 | /** 133 | * Add extra headers to the request before sending 134 | * 135 | * @since 1.6 136 | * @param string $out HTTP header string 137 | */ 138 | public function fsockopen_header(&$out) { 139 | $out .= sprintf("Proxy-Authorization: Basic %s\r\n", base64_encode($this->get_auth_string())); 140 | } 141 | 142 | /** 143 | * Get the authentication string (user:pass) 144 | * 145 | * @since 1.6 146 | * @return string 147 | */ 148 | public function get_auth_string() { 149 | return $this->user . ':' . $this->pass; 150 | } 151 | } -------------------------------------------------------------------------------- /video-url-parser-master/README.md: -------------------------------------------------------------------------------- 1 | # video-url-parser 2 | 解析Youtube,Youku,Tudou,iQiyi,Souhu,QQ,Sina,LeTV等视频网站的url,得到视频的id等源信息;同时可以根据得到的源信息创建不同格式的播放链接。 3 | 4 | [![Build Status](https://travis-ci.org/imingyu/video-url-parser.svg?branch=master)](https://travis-ci.org/imingyu/video-url-parser) 5 | [![image](https://img.shields.io/npm/v/video-url-parser.svg)](https://www.npmjs.com/package/video-url-parser) 6 | [![image](https://img.shields.io/npm/dt/video-url-parser.svg)](https://www.npmjs.com/package/video-url-parser) 7 | 8 | 目前解析服务对视频网站的支持情况: 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 |
中国(CN)
网站网址支持状态解析器更新日期
优酷(Youku)www.youku.com已支持 28 |

video-provider-youku.com

29 | 30 | NPM Version 31 | 32 | 33 | NPM Downloads 34 | 35 |
2016/12/22
土豆、56、乐视、腾讯、搜狐、i奇艺、新浪等--开发中----
47 | 48 | 49 | 安装 50 | === 51 | ``` 52 | npm install video-url-parser 53 | ``` 54 | 55 | 使用 56 | === 57 | 使用可以解析中国区视频网站的解析器 58 | --- 59 | ```javascript 60 | 61 | var cnVideoUrlParser = require("video-url-parser").cnVideoUrlParser; 62 | 63 | //解析一个url 64 | cnVideoUrlParser.parser("http://v.youku.com/v_show/id_XMTg4ODE3NDYwOA==.html"); 65 | //[ { "id":"XMTg4ODE3NDYwOA==", "provider":{ "host":"youku.com", ...} } ] 66 | 67 | //解析一段字符串中包含的视频信息 68 | var str='播放 放弃我,抓紧我
播放 飞到又见飞刀
'; 69 | 70 | cnVideoUrlParser.parser(str); 71 | /*[ 72 | { "id":"XMTg4ODE3NDYwOA==", "provider":{ "host":"youku.com", ...} }, 73 | { "id":"XMTg3OTgwODE0NA==", "provider":{ "host":"youku.com", ...} } 74 | ]*/ 75 | 76 | //根据视频源信息创建播放URL 77 | cnVideoUrlParser.create({ 78 | provider: "youku.com", 79 | id: "XMTg4ODE3NDYwOA==", 80 | params: { 81 | from: "github" 82 | } 83 | });// http://player.youku.com/embed/XMTg4ODE3NDYwOA==?from=github 84 | 85 | ``` 86 | 87 | 88 | 自定义解析器 89 | --- 90 | > 下面的示例演示了如何创建一个自定义解析器并使用它,这会让你了解`video-url-parser`包的运行机制。 91 | 92 | ```javascript 93 | var vup = require("video-url-parser"), 94 | VideoUrlParser = vup.VideoUrlParser, 95 | VideoProvider = vup.VideoProvider, 96 | util = vup.util; 97 | 98 | //创建一个解析器 99 | var parser = new VideoUrlParser("我的视频URL解析器"); 100 | 101 | //像解析器中添加一个VideoProvider实例,负责对特定URL的解析 102 | parser.addProvider(new VideoProvider({ 103 | host: "xxx.com", //唯一 104 | hostMatch: function(source) { 105 | if (/xxx.com/.test(source)) { 106 | return this.host; 107 | } 108 | }, 109 | parser: function(source) { 110 | source = source + ""; 111 | var provider = JSON.parse(JSON.stringify(this)); 112 | return [{ 113 | provider: provider, 114 | id: "1" 115 | }]; 116 | }, 117 | create: function(videoInfo) { 118 | return "http://" + this.host + "/play/" + videoInfo.id + ".html"; 119 | } 120 | })); 121 | 122 | var videoInfo = parser.parser("http://xxx.com/123"); 123 | console.log(videoInfo); //[ { provider: { host: 'xxx.com' }, id: '1' } ] 124 | 125 | var url = parser.create(videoInfo[0]); 126 | console.log(url); //http://xxx.com/play/1.html 127 | 128 | ``` 129 | 130 | 文件说明 131 | --- 132 | - `src/video-url-parser.js`提供核心功能:`VideoUrlParser`(URL解析器类),`VideoProvider`(视频供应商类)和`util`(工具函数),`VideoUrlParser`实例可以包括多个`VideoProvider`实例; 133 | - `src/cn-video-url-parser.js`提供中国区的视频网站URL解析。 -------------------------------------------------------------------------------- /Requests-master/docs/usage.md: -------------------------------------------------------------------------------- 1 | Usage 2 | ===== 3 | 4 | Ready to go? Make sure you have Requests installed before attempting any of the 5 | steps in this guide. 6 | 7 | 8 | Loading Requests 9 | ---------------- 10 | Before we can load Requests up, we'll need to make sure it's loaded. This is a 11 | simple two-step: 12 | 13 | ```php 14 | // First, include Requests 15 | include('/path/to/library/Requests.php'); 16 | 17 | // Next, make sure Requests can load internal classes 18 | Requests::register_autoloader(); 19 | ``` 20 | 21 | If you'd like to bring along your own autoloader, you can forget about this 22 | completely. 23 | 24 | 25 | Make a GET Request 26 | ------------------ 27 | One of the most basic things you can do with HTTP is make a GET request. 28 | 29 | Let's grab GitHub's public timeline: 30 | 31 | ```php 32 | $response = Requests::get('https://github.com/timeline.json'); 33 | ``` 34 | 35 | `$response` is now a **Requests_Response** object. Response objects are what 36 | you'll be working with whenever you want to get data back from your request. 37 | 38 | 39 | Using the Response Object 40 | ------------------------- 41 | Now that we have the response from GitHub, let's get the body of the response. 42 | 43 | ```php 44 | var_dump($response->body); 45 | // string(42865) "[{"repository":{"url":"... 46 | ``` 47 | 48 | 49 | Custom Headers 50 | -------------- 51 | If you want to add custom headers to the request, simply pass them in as an 52 | associative array as the second parameter: 53 | 54 | ```php 55 | $response = Requests::get('https://github.com/timeline.json', array('X-Requests' => 'Is Awesome!')); 56 | ``` 57 | 58 | 59 | Make a POST Request 60 | ------------------- 61 | Making a POST request is very similar to making a GET: 62 | 63 | ```php 64 | $response = Requests::post('http://httpbin.org/post'); 65 | ``` 66 | 67 | You'll probably also want to pass in some data. You can pass in either a 68 | string, an array or an object (Requests uses [`http_build_query`][build_query] 69 | internally) as the third parameter (after the URL and headers): 70 | 71 | [build_query]: http://php.net/http_build_query 72 | 73 | ```php 74 | $data = array('key1' => 'value1', 'key2' => 'value2'); 75 | $response = Requests::post('http://httpbin.org/post', array(), $data); 76 | var_dump($response->body); 77 | ``` 78 | 79 | This gives the output: 80 | 81 | string(503) "{ 82 | "origin": "124.191.162.147", 83 | "files": {}, 84 | "form": { 85 | "key2": "value2", 86 | "key1": "value1" 87 | }, 88 | "headers": { 89 | "Content-Length": "23", 90 | "Accept-Encoding": "deflate;q=1.0, compress;q=0.5, gzip;q=0.5", 91 | "X-Forwarded-Port": "80", 92 | "Connection": "keep-alive", 93 | "User-Agent": "php-requests/1.6-dev", 94 | "Host": "httpbin.org", 95 | "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" 96 | }, 97 | "url": "http://httpbin.org/post", 98 | "args": {}, 99 | "data": "" 100 | }" 101 | 102 | To send raw data, simply pass in a string instead. You'll probably also want to 103 | set the Content-Type header to ensure the remote server knows what you're 104 | sending it: 105 | 106 | ```php 107 | $url = 'https://api.github.com/some/endpoint'; 108 | $headers = array('Content-Type' => 'application/json'); 109 | $data = array('some' => 'data'); 110 | $response = Requests::post($url, $headers, json_encode($data)); 111 | ``` 112 | 113 | Note that if you don't manually specify a Content-Type header, Requests has 114 | undefined behaviour for the header. It may be set to various values depending 115 | on the internal execution path, so it's recommended to set this explicitly if 116 | you need to. 117 | 118 | 119 | Status Codes 120 | ------------ 121 | The Response object also gives you access to the status code: 122 | 123 | ```php 124 | var_dump($response->status_code); 125 | // int(200) 126 | ``` 127 | 128 | You can also easily check if this status code is a success code, or if it's an 129 | error: 130 | 131 | ```php 132 | var_dump($response->success); 133 | // bool(true) 134 | ``` 135 | 136 | 137 | Response Headers 138 | ---------------- 139 | We can also grab headers pretty easily: 140 | 141 | ```php 142 | var_dump($response->headers['Date']); 143 | // string(29) "Thu, 09 Feb 2012 15:22:06 GMT" 144 | ``` 145 | 146 | Note that this is case-insensitive, so the following are all equivalent: 147 | 148 | * `$response->headers['Date']` 149 | * `$response->headers['date']` 150 | * `$response->headers['DATE']` 151 | * `$response->headers['dAtE']` 152 | 153 | If a header isn't set, this will give `null`. You can also check with 154 | `isset($response->headers['date'])` 155 | -------------------------------------------------------------------------------- /Requests-master/library/Requests/Cookie/Jar.php: -------------------------------------------------------------------------------- 1 | cookies = $cookies; 30 | } 31 | 32 | /** 33 | * Normalise cookie data into a Requests_Cookie 34 | * 35 | * @param string|Requests_Cookie $cookie 36 | * @return Requests_Cookie 37 | */ 38 | public function normalize_cookie($cookie, $key = null) { 39 | if ($cookie instanceof Requests_Cookie) { 40 | return $cookie; 41 | } 42 | 43 | return Requests_Cookie::parse($cookie, $key); 44 | } 45 | 46 | /** 47 | * Normalise cookie data into a Requests_Cookie 48 | * 49 | * @codeCoverageIgnore 50 | * @deprecated Use {@see Requests_Cookie_Jar::normalize_cookie} 51 | * @return Requests_Cookie 52 | */ 53 | public function normalizeCookie($cookie, $key = null) { 54 | return $this->normalize_cookie($cookie, $key); 55 | } 56 | 57 | /** 58 | * Check if the given item exists 59 | * 60 | * @param string $key Item key 61 | * @return boolean Does the item exist? 62 | */ 63 | public function offsetExists($key) { 64 | return isset($this->cookies[$key]); 65 | } 66 | 67 | /** 68 | * Get the value for the item 69 | * 70 | * @param string $key Item key 71 | * @return string Item value 72 | */ 73 | public function offsetGet($key) { 74 | if (!isset($this->cookies[$key])) { 75 | return null; 76 | } 77 | 78 | return $this->cookies[$key]; 79 | } 80 | 81 | /** 82 | * Set the given item 83 | * 84 | * @throws Requests_Exception On attempting to use dictionary as list (`invalidset`) 85 | * 86 | * @param string $key Item name 87 | * @param string $value Item value 88 | */ 89 | public function offsetSet($key, $value) { 90 | if ($key === null) { 91 | throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset'); 92 | } 93 | 94 | $this->cookies[$key] = $value; 95 | } 96 | 97 | /** 98 | * Unset the given header 99 | * 100 | * @param string $key 101 | */ 102 | public function offsetUnset($key) { 103 | unset($this->cookies[$key]); 104 | } 105 | 106 | /** 107 | * Get an iterator for the data 108 | * 109 | * @return ArrayIterator 110 | */ 111 | public function getIterator() { 112 | return new ArrayIterator($this->cookies); 113 | } 114 | 115 | /** 116 | * Register the cookie handler with the request's hooking system 117 | * 118 | * @param Requests_Hooker $hooks Hooking system 119 | */ 120 | public function register(Requests_Hooker $hooks) { 121 | $hooks->register('requests.before_request', array($this, 'before_request')); 122 | $hooks->register('requests.before_redirect_check', array($this, 'before_redirect_check')); 123 | } 124 | 125 | /** 126 | * Add Cookie header to a request if we have any 127 | * 128 | * As per RFC 6265, cookies are separated by '; ' 129 | * 130 | * @param string $url 131 | * @param array $headers 132 | * @param array $data 133 | * @param string $type 134 | * @param array $options 135 | */ 136 | public function before_request($url, &$headers, &$data, &$type, &$options) { 137 | if (!$url instanceof Requests_IRI) { 138 | $url = new Requests_IRI($url); 139 | } 140 | 141 | if (!empty($this->cookies)) { 142 | $cookies = array(); 143 | foreach ($this->cookies as $key => $cookie) { 144 | $cookie = $this->normalize_cookie($cookie, $key); 145 | 146 | // Skip expired cookies 147 | if ($cookie->is_expired()) { 148 | continue; 149 | } 150 | 151 | if ($cookie->domain_matches($url->host)) { 152 | $cookies[] = $cookie->format_for_header(); 153 | } 154 | } 155 | 156 | $headers['Cookie'] = implode('; ', $cookies); 157 | } 158 | } 159 | 160 | /** 161 | * Parse all cookies from a response and attach them to the response 162 | * 163 | * @var Requests_Response $response 164 | */ 165 | public function before_redirect_check(Requests_Response &$return) { 166 | $url = $return->url; 167 | if (!$url instanceof Requests_IRI) { 168 | $url = new Requests_IRI($url); 169 | } 170 | 171 | $cookies = Requests_Cookie::parse_from_headers($return->headers, $url); 172 | $this->cookies = array_merge($this->cookies, $cookies); 173 | $return->cookies = $this; 174 | } 175 | } -------------------------------------------------------------------------------- /Requests-master/library/Requests/SSL.php: -------------------------------------------------------------------------------- 1 | assertEquals(200, $request->status_code); 14 | } 15 | 16 | /** 17 | * Standard response header parsing 18 | */ 19 | public function testHeaderParsing() { 20 | $transport = new RawTransport(); 21 | $transport->data = 22 | "HTTP/1.0 200 OK\r\n". 23 | "Host: localhost\r\n". 24 | "Host: ambiguous\r\n". 25 | "Nospace:here\r\n". 26 | "Muchspace: there \r\n". 27 | "Empty:\r\n". 28 | "Empty2: \r\n". 29 | "Folded: one\r\n". 30 | "\ttwo\r\n". 31 | " three\r\n\r\n". 32 | "stop\r\n"; 33 | 34 | $options = array( 35 | 'transport' => $transport 36 | ); 37 | $response = Requests::get('http://example.com/', array(), $options); 38 | $expected = new Requests_Response_Headers(); 39 | $expected['host'] = 'localhost,ambiguous'; 40 | $expected['nospace'] = 'here'; 41 | $expected['muchspace'] = 'there'; 42 | $expected['empty'] = ''; 43 | $expected['empty2'] = ''; 44 | $expected['folded'] = 'one two three'; 45 | foreach ($expected as $key => $value) { 46 | $this->assertEquals($value, $response->headers[$key]); 47 | } 48 | 49 | foreach ($response->headers as $key => $value) { 50 | $this->assertEquals($value, $expected[$key]); 51 | } 52 | } 53 | 54 | public function testProtocolVersionParsing() { 55 | $transport = new RawTransport(); 56 | $transport->data = 57 | "HTTP/1.0 200 OK\r\n". 58 | "Host: localhost\r\n\r\n"; 59 | 60 | $options = array( 61 | 'transport' => $transport 62 | ); 63 | 64 | $response = Requests::get('http://example.com/', array(), $options); 65 | $this->assertEquals(1.0, $response->protocol_version); 66 | } 67 | 68 | public function testRawAccess() { 69 | $transport = new RawTransport(); 70 | $transport->data = 71 | "HTTP/1.0 200 OK\r\n". 72 | "Host: localhost\r\n\r\n". 73 | "Test"; 74 | 75 | $options = array( 76 | 'transport' => $transport 77 | ); 78 | $response = Requests::get('http://example.com/', array(), $options); 79 | $this->assertEquals($transport->data, $response->raw); 80 | } 81 | 82 | /** 83 | * Headers with only \n delimiting should be treated as if they're \r\n 84 | */ 85 | public function testHeaderOnlyLF() { 86 | $transport = new RawTransport(); 87 | $transport->data = "HTTP/1.0 200 OK\r\nTest: value\nAnother-Test: value\r\n\r\n"; 88 | 89 | $options = array( 90 | 'transport' => $transport 91 | ); 92 | $response = Requests::get('http://example.com/', array(), $options); 93 | $this->assertEquals('value', $response->headers['test']); 94 | $this->assertEquals('value', $response->headers['another-test']); 95 | } 96 | 97 | /** 98 | * Check that invalid protocols are not accepted 99 | * 100 | * We do not support HTTP/0.9. If this is really an issue for you, file a 101 | * new issue, and update your server/proxy to support a proper protocol. 102 | * 103 | * @expectedException Requests_Exception 104 | */ 105 | public function testInvalidProtocolVersion() { 106 | $transport = new RawTransport(); 107 | $transport->data = "HTTP/0.9 200 OK\r\n\r\n

Test"; 108 | 109 | $options = array( 110 | 'transport' => $transport 111 | ); 112 | $response = Requests::get('http://example.com/', array(), $options); 113 | } 114 | 115 | /** 116 | * HTTP/0.9 also appears to use a single CRLF instead of two 117 | * 118 | * @expectedException Requests_Exception 119 | */ 120 | public function testSingleCRLFSeparator() { 121 | $transport = new RawTransport(); 122 | $transport->data = "HTTP/0.9 200 OK\r\n

Test"; 123 | 124 | $options = array( 125 | 'transport' => $transport 126 | ); 127 | $response = Requests::get('http://example.com/', array(), $options); 128 | } 129 | 130 | /** 131 | * @expectedException Requests_Exception 132 | */ 133 | public function testInvalidStatus() { 134 | $transport = new RawTransport(); 135 | $transport->data = "HTTP/1.1 OK\r\nTest: value\nAnother-Test: value\r\n\r\nTest"; 136 | 137 | $options = array( 138 | 'transport' => $transport 139 | ); 140 | $response = Requests::get('http://example.com/', array(), $options); 141 | } 142 | 143 | public function test30xWithoutLocation() { 144 | $transport = new MockTransport(); 145 | $transport->code = 302; 146 | 147 | $options = array( 148 | 'transport' => $transport 149 | ); 150 | $response = Requests::get('http://example.com/', array(), $options); 151 | $this->assertEquals(302, $response->status_code); 152 | $this->assertEquals(0, $response->redirects); 153 | } 154 | 155 | /** 156 | * @expectedException Requests_Exception 157 | */ 158 | public function testTimeoutException() { 159 | $options = array('timeout' => 0.5); 160 | $response = Requests::get(httpbin('/delay/3'), array(), $options); 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /main/example3.php: -------------------------------------------------------------------------------- 1 | getStreams(); 33 | 34 | foreach ($streams as $stream) { 35 | if ($stream->stream_type == "mp4hd") {//优先解析MP4hd 36 | $urls = $videoInfo->getVideoSrcs($stream); 37 | $curStream = $stream; 38 | break; 39 | } 40 | /*if ($stream->stream_type == "3gphd") {//取3gphd流的视频 41 | $urls = $videoInfo->getVideoSrcs($stream); 42 | $curStream = $stream; 43 | break; 44 | }*/ 45 | } 46 | 47 | } 48 | 49 | ?> 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 优酷视频解析 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |

71 | 72 |
73 | 74 |
75 | 76 |
77 | 78 |
79 |
80 | 81 |
82 |
83 | 84 |
85 | 86 |
87 | 88 | 89 |
90 |
91 |

92 |
93 |
94 |
95 | 97 |
98 |
99 |
100 | 101 | 102 |
103 | 104 |
105 | 106 | 107 | 108 | 109 | 110 | 111 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /Requests-master/README.md: -------------------------------------------------------------------------------- 1 | Requests for PHP 2 | ================ 3 | 4 | [![Build Status](https://travis-ci.org/rmccue/Requests.svg?branch=master)](https://travis-ci.org/rmccue/Requests) 5 | [![codecov.io](http://codecov.io/github/rmccue/Requests/coverage.svg?branch=master)](http://codecov.io/github/rmccue/Requests?branch=master) 6 | 7 | Requests is a HTTP library written in PHP, for human beings. It is roughly 8 | based on the API from the excellent [Requests Python 9 | library](http://python-requests.org/). Requests is [ISC 10 | Licensed](https://github.com/rmccue/Requests/blob/master/LICENSE) (similar to 11 | the new BSD license) and has no dependencies, except for PHP 5.2+. 12 | 13 | Despite PHP's use as a language for the web, its tools for sending HTTP requests 14 | are severely lacking. cURL has an 15 | [interesting API](http://php.net/manual/en/function.curl-setopt.php), to say the 16 | least, and you can't always rely on it being available. Sockets provide only low 17 | level access, and require you to build most of the HTTP response parsing 18 | yourself. 19 | 20 | We all have better things to do. That's why Requests was born. 21 | 22 | ```php 23 | $headers = array('Accept' => 'application/json'); 24 | $options = array('auth' => array('user', 'pass')); 25 | $request = Requests::get('https://api.github.com/gists', $headers, $options); 26 | 27 | var_dump($request->status_code); 28 | // int(200) 29 | 30 | var_dump($request->headers['content-type']); 31 | // string(31) "application/json; charset=utf-8" 32 | 33 | var_dump($request->body); 34 | // string(26891) "[...]" 35 | ``` 36 | 37 | Requests allows you to send **HEAD**, **GET**, **POST**, **PUT**, **DELETE**, 38 | and **PATCH** HTTP requests. You can add headers, form data, multipart files, 39 | and parameters with simple arrays, and access the response data in the same way. 40 | Requests uses cURL and fsockopen, depending on what your system has available, 41 | but abstracts all the nasty stuff out of your way, providing a consistent API. 42 | 43 | 44 | Features 45 | -------- 46 | 47 | - International Domains and URLs 48 | - Browser-style SSL Verification 49 | - Basic/Digest Authentication 50 | - Automatic Decompression 51 | - Connection Timeouts 52 | 53 | 54 | Installation 55 | ------------ 56 | 57 | ### Install with Composer 58 | If you're using [Composer](https://github.com/composer/composer) to manage 59 | dependencies, you can add Requests with it. 60 | 61 | ```sh 62 | composer require rmccue/requests 63 | ``` 64 | 65 | or 66 | 67 | { 68 | "require": { 69 | "rmccue/requests": ">=1.0" 70 | } 71 | } 72 | 73 | ### Install source from GitHub 74 | To install the source code: 75 | 76 | $ git clone git://github.com/rmccue/Requests.git 77 | 78 | And include it in your scripts: 79 | 80 | require_once '/path/to/Requests/library/Requests.php'; 81 | 82 | You'll probably also want to register an autoloader: 83 | 84 | Requests::register_autoloader(); 85 | 86 | 87 | ### Install source from zip/tarball 88 | Alternatively, you can fetch a [tarball][] or [zipball][]: 89 | 90 | $ curl -L https://github.com/rmccue/Requests/tarball/master | tar xzv 91 | (or) 92 | $ wget https://github.com/rmccue/Requests/tarball/master -O - | tar xzv 93 | 94 | [tarball]: https://github.com/rmccue/Requests/tarball/master 95 | [zipball]: https://github.com/rmccue/Requests/zipball/master 96 | 97 | 98 | ### Using a Class Loader 99 | If you're using a class loader (e.g., [Symfony Class Loader][]) for 100 | [PSR-0][]-style class loading: 101 | 102 | $loader->registerPrefix('Requests', 'path/to/vendor/Requests/library'); 103 | 104 | [Symfony Class Loader]: https://github.com/symfony/ClassLoader 105 | [PSR-0]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md 106 | 107 | 108 | Documentation 109 | ------------- 110 | The best place to start is our [prose-based documentation][], which will guide 111 | you through using Requests. 112 | 113 | After that, take a look at [the documentation for 114 | `Requests::request()`][request_method], where all the parameters are fully 115 | documented. 116 | 117 | Requests is [100% documented with PHPDoc](http://requests.ryanmccue.info/api/). 118 | If you find any problems with it, [create a new 119 | issue](https://github.com/rmccue/Requests/issues/new)! 120 | 121 | [prose-based documentation]: https://github.com/rmccue/Requests/blob/master/docs/README.md 122 | [request_method]: http://requests.ryanmccue.info/api/class-Requests.html#_request 123 | 124 | Testing 125 | ------- 126 | 127 | Requests strives to have 100% code-coverage of the library with an extensive 128 | set of tests. We're not quite there yet, but [we're getting close][codecov]. 129 | 130 | [codecov]: http://codecov.io/github/rmccue/Requests 131 | 132 | To run the test suite, first check that you have the [PHP 133 | JSON extension ](http://php.net/manual/en/book.json.php) enabled. Then 134 | simply: 135 | 136 | $ cd tests 137 | $ phpunit 138 | 139 | If you'd like to run a single set of tests, specify just the name: 140 | 141 | $ phpunit Transport/cURL 142 | 143 | Contribute 144 | ---------- 145 | 146 | 1. Check for open issues or open a new issue for a feature request or a bug 147 | 2. Fork [the repository][] on Github to start making your changes to the 148 | `master` branch (or branch off of it) 149 | 3. Write a test which shows that the bug was fixed or that the feature works as expected 150 | 4. Send a pull request and bug me until I merge it 151 | 152 | [the repository]: https://github.com/rmccue/Requests 153 | -------------------------------------------------------------------------------- /Requests-master/tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | '100 Continue', 54 | 101 => '101 Switching Protocols', 55 | 200 => '200 OK', 56 | 201 => '201 Created', 57 | 202 => '202 Accepted', 58 | 203 => '203 Non-Authoritative Information', 59 | 204 => '204 No Content', 60 | 205 => '205 Reset Content', 61 | 206 => '206 Partial Content', 62 | 300 => '300 Multiple Choices', 63 | 301 => '301 Moved Permanently', 64 | 302 => '302 Found', 65 | 303 => '303 See Other', 66 | 304 => '304 Not Modified', 67 | 305 => '305 Use Proxy', 68 | 306 => '306 (Unused)', 69 | 307 => '307 Temporary Redirect', 70 | 400 => '400 Bad Request', 71 | 401 => '401 Unauthorized', 72 | 402 => '402 Payment Required', 73 | 403 => '403 Forbidden', 74 | 404 => '404 Not Found', 75 | 405 => '405 Method Not Allowed', 76 | 406 => '406 Not Acceptable', 77 | 407 => '407 Proxy Authentication Required', 78 | 408 => '408 Request Timeout', 79 | 409 => '409 Conflict', 80 | 410 => '410 Gone', 81 | 411 => '411 Length Required', 82 | 412 => '412 Precondition Failed', 83 | 413 => '413 Request Entity Too Large', 84 | 414 => '414 Request-URI Too Long', 85 | 415 => '415 Unsupported Media Type', 86 | 416 => '416 Requested Range Not Satisfiable', 87 | 417 => '417 Expectation Failed', 88 | 418 => '418 I\'m a teapot', 89 | 428 => '428 Precondition Required', 90 | 429 => '429 Too Many Requests', 91 | 431 => '431 Request Header Fields Too Large', 92 | 500 => '500 Internal Server Error', 93 | 501 => '501 Not Implemented', 94 | 502 => '502 Bad Gateway', 95 | 503 => '503 Service Unavailable', 96 | 504 => '504 Gateway Timeout', 97 | 505 => '505 HTTP Version Not Supported', 98 | 511 => '511 Network Authentication Required', 99 | ); 100 | 101 | public function request($url, $headers = array(), $data = array(), $options = array()) { 102 | $status = isset(self::$messages[$this->code]) ? self::$messages[$this->code] : $this->code . ' unknown'; 103 | $response = "HTTP/1.0 $status\r\n"; 104 | $response .= "Content-Type: text/plain\r\n"; 105 | if ($this->chunked) { 106 | $response .= "Transfer-Encoding: chunked\r\n"; 107 | } 108 | $response .= $this->raw_headers; 109 | $response .= "Connection: close\r\n\r\n"; 110 | $response .= $this->body; 111 | return $response; 112 | } 113 | 114 | public function request_multiple($requests, $options) { 115 | $responses = array(); 116 | foreach ($requests as $id => $request) { 117 | $handler = new MockTransport(); 118 | $handler->code = $request['options']['mock.code']; 119 | $handler->chunked = $request['options']['mock.chunked']; 120 | $handler->body = $request['options']['mock.body']; 121 | $handler->raw_headers = $request['options']['mock.raw_headers']; 122 | $responses[$id] = $handler->request($request['url'], $request['headers'], $request['data'], $request['options']); 123 | 124 | if (!empty($options['mock.parse'])) { 125 | $request['options']['hooks']->dispatch('transport.internal.parse_response', array(&$responses[$id], $request)); 126 | $request['options']['hooks']->dispatch('multiple.request.complete', array(&$responses[$id], $id)); 127 | } 128 | } 129 | 130 | return $responses; 131 | } 132 | 133 | public static function test() { 134 | return true; 135 | } 136 | } 137 | 138 | class RawTransport implements Requests_Transport { 139 | public $data = ''; 140 | public function request($url, $headers = array(), $data = array(), $options = array()) { 141 | return $this->data; 142 | } 143 | public function request_multiple($requests, $options) { 144 | foreach ($requests as $id => &$request) { 145 | $handler = new RawTransport(); 146 | $handler->data = $request['options']['raw.data']; 147 | $request = $handler->request($request['url'], $request['headers'], $request['data'], $request['options']); 148 | } 149 | 150 | return $requests; 151 | } 152 | public static function test() { 153 | return true; 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /Requests-master/library/Requests/IPv6.php: -------------------------------------------------------------------------------- 1 | FF01:0:0:0:0:0:0:101 27 | * ::1 -> 0:0:0:0:0:0:0:1 28 | * 29 | * @author Alexander Merz 30 | * @author elfrink at introweb dot nl 31 | * @author Josh Peck 32 | * @copyright 2003-2005 The PHP Group 33 | * @license http://www.opensource.org/licenses/bsd-license.php 34 | * @param string $ip An IPv6 address 35 | * @return string The uncompressed IPv6 address 36 | */ 37 | public static function uncompress($ip) { 38 | if (substr_count($ip, '::') !== 1) { 39 | return $ip; 40 | } 41 | 42 | list($ip1, $ip2) = explode('::', $ip); 43 | $c1 = ($ip1 === '') ? -1 : substr_count($ip1, ':'); 44 | $c2 = ($ip2 === '') ? -1 : substr_count($ip2, ':'); 45 | 46 | if (strpos($ip2, '.') !== false) { 47 | $c2++; 48 | } 49 | // :: 50 | if ($c1 === -1 && $c2 === -1) { 51 | $ip = '0:0:0:0:0:0:0:0'; 52 | } 53 | // ::xxx 54 | else if ($c1 === -1) { 55 | $fill = str_repeat('0:', 7 - $c2); 56 | $ip = str_replace('::', $fill, $ip); 57 | } 58 | // xxx:: 59 | else if ($c2 === -1) { 60 | $fill = str_repeat(':0', 7 - $c1); 61 | $ip = str_replace('::', $fill, $ip); 62 | } 63 | // xxx::xxx 64 | else { 65 | $fill = ':' . str_repeat('0:', 6 - $c2 - $c1); 66 | $ip = str_replace('::', $fill, $ip); 67 | } 68 | return $ip; 69 | } 70 | 71 | /** 72 | * Compresses an IPv6 address 73 | * 74 | * RFC 4291 allows you to compress consecutive zero pieces in an address to 75 | * '::'. This method expects a valid IPv6 address and compresses consecutive 76 | * zero pieces to '::'. 77 | * 78 | * Example: FF01:0:0:0:0:0:0:101 -> FF01::101 79 | * 0:0:0:0:0:0:0:1 -> ::1 80 | * 81 | * @see uncompress() 82 | * @param string $ip An IPv6 address 83 | * @return string The compressed IPv6 address 84 | */ 85 | public static function compress($ip) { 86 | // Prepare the IP to be compressed 87 | $ip = self::uncompress($ip); 88 | $ip_parts = self::split_v6_v4($ip); 89 | 90 | // Replace all leading zeros 91 | $ip_parts[0] = preg_replace('/(^|:)0+([0-9])/', '\1\2', $ip_parts[0]); 92 | 93 | // Find bunches of zeros 94 | if (preg_match_all('/(?:^|:)(?:0(?::|$))+/', $ip_parts[0], $matches, PREG_OFFSET_CAPTURE)) { 95 | $max = 0; 96 | $pos = null; 97 | foreach ($matches[0] as $match) { 98 | if (strlen($match[0]) > $max) { 99 | $max = strlen($match[0]); 100 | $pos = $match[1]; 101 | } 102 | } 103 | 104 | $ip_parts[0] = substr_replace($ip_parts[0], '::', $pos, $max); 105 | } 106 | 107 | if ($ip_parts[1] !== '') { 108 | return implode(':', $ip_parts); 109 | } 110 | else { 111 | return $ip_parts[0]; 112 | } 113 | } 114 | 115 | /** 116 | * Splits an IPv6 address into the IPv6 and IPv4 representation parts 117 | * 118 | * RFC 4291 allows you to represent the last two parts of an IPv6 address 119 | * using the standard IPv4 representation 120 | * 121 | * Example: 0:0:0:0:0:0:13.1.68.3 122 | * 0:0:0:0:0:FFFF:129.144.52.38 123 | * 124 | * @param string $ip An IPv6 address 125 | * @return string[] [0] contains the IPv6 represented part, and [1] the IPv4 represented part 126 | */ 127 | protected static function split_v6_v4($ip) { 128 | if (strpos($ip, '.') !== false) { 129 | $pos = strrpos($ip, ':'); 130 | $ipv6_part = substr($ip, 0, $pos); 131 | $ipv4_part = substr($ip, $pos + 1); 132 | return array($ipv6_part, $ipv4_part); 133 | } 134 | else { 135 | return array($ip, ''); 136 | } 137 | } 138 | 139 | /** 140 | * Checks an IPv6 address 141 | * 142 | * Checks if the given IP is a valid IPv6 address 143 | * 144 | * @param string $ip An IPv6 address 145 | * @return bool true if $ip is a valid IPv6 address 146 | */ 147 | public static function check_ipv6($ip) { 148 | $ip = self::uncompress($ip); 149 | list($ipv6, $ipv4) = self::split_v6_v4($ip); 150 | $ipv6 = explode(':', $ipv6); 151 | $ipv4 = explode('.', $ipv4); 152 | if (count($ipv6) === 8 && count($ipv4) === 1 || count($ipv6) === 6 && count($ipv4) === 4) { 153 | foreach ($ipv6 as $ipv6_part) { 154 | // The section can't be empty 155 | if ($ipv6_part === '') { 156 | return false; 157 | } 158 | 159 | // Nor can it be over four characters 160 | if (strlen($ipv6_part) > 4) { 161 | return false; 162 | } 163 | 164 | // Remove leading zeros (this is safe because of the above) 165 | $ipv6_part = ltrim($ipv6_part, '0'); 166 | if ($ipv6_part === '') { 167 | $ipv6_part = '0'; 168 | } 169 | 170 | // Check the value is valid 171 | $value = hexdec($ipv6_part); 172 | if (dechex($value) !== strtolower($ipv6_part) || $value < 0 || $value > 0xFFFF) { 173 | return false; 174 | } 175 | } 176 | if (count($ipv4) === 4) { 177 | foreach ($ipv4 as $ipv4_part) { 178 | $value = (int) $ipv4_part; 179 | if ((string) $value !== $ipv4_part || $value < 0 || $value > 0xFF) { 180 | return false; 181 | } 182 | } 183 | } 184 | return true; 185 | } 186 | else { 187 | return false; 188 | } 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /youkuvod-master/htmltest/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | TEST 8 | 42 | 43 | 44 | 45 |
46 | 47 |
48 |
49 |
50 | 解析服务器 51 | 55 |
56 |
57 | 默认清晰度 58 | 64 |
65 |
66 | 播放器服务器 67 | 72 |
73 |
74 | 港剧语言 75 | 粤语 76 |
77 |
78 | 注意 79 | 点击确定产生 80 |
刷新页面应用设置 81 | 82 |
83 |
84 | 85 | 86 | 87 | 161 | 162 | 163 | 164 | --------------------------------------------------------------------------------