使用Javascript获取m3u8
327 |这里变得空空如也...
328 | 329 | 330 |这里变得空空如也...
328 | 329 | 330 |首先,最简单的使用方式是直接双击EXE,将你要下载的m3u8文件或m3u8链接复制进去,然后按下回车键。就像这样:
正常情况下,程序将产生如下的目录结构:
.
327 | ├── Downloads
328 | └── Logs
329 | └── *.log
330 |
程序默认将视频文件放在了EXE同目录的Downloads
文件夹中,将程序运行日志信息放在了Logs
目录中。
一款帮助你将m3u8链接下载为m3u8文件的小软件。
https://github.com/nilaoda/M3U8URL2File/releases
').html(content); 65 | 66 | $link.appendTo($title); 67 | $title.appendTo($li); 68 | $content.appendTo($li); 69 | $li.appendTo($searchList); 70 | }); 71 | } 72 | 73 | function launchSearch(q) { 74 | // Add class for loading 75 | $body.addClass('with-search'); 76 | $body.addClass('search-loading'); 77 | 78 | // Launch search query 79 | throttle(gitbook.search.query(q, 0, MAX_RESULTS) 80 | .then(function(results) { 81 | displayResults(results); 82 | }) 83 | .always(function() { 84 | $body.removeClass('search-loading'); 85 | }), 1000); 86 | } 87 | 88 | function closeSearch() { 89 | $body.removeClass('with-search'); 90 | $bookSearchResults.removeClass('open'); 91 | } 92 | 93 | function launchSearchFromQueryString() { 94 | var q = getParameterByName('q'); 95 | if (q && q.length > 0) { 96 | // Update search input 97 | $searchInput.val(q); 98 | 99 | // Launch search 100 | launchSearch(q); 101 | } 102 | } 103 | 104 | function bindSearch() { 105 | // Bind DOM 106 | $searchInput = $('#book-search-input input'); 107 | $bookSearchResults = $('#book-search-results'); 108 | $searchList = $bookSearchResults.find('.search-results-list'); 109 | $searchTitle = $bookSearchResults.find('.search-results-title'); 110 | $searchResultsCount = $searchTitle.find('.search-results-count'); 111 | $searchQuery = $searchTitle.find('.search-query'); 112 | 113 | // Launch query based on input content 114 | function handleUpdate() { 115 | var q = $searchInput.val(); 116 | 117 | if (q.length == 0) { 118 | closeSearch(); 119 | } 120 | else { 121 | launchSearch(q); 122 | } 123 | } 124 | 125 | // Detect true content change in search input 126 | // Workaround for IE < 9 127 | var propertyChangeUnbound = false; 128 | $searchInput.on('propertychange', function(e) { 129 | if (e.originalEvent.propertyName == 'value') { 130 | handleUpdate(); 131 | } 132 | }); 133 | 134 | // HTML5 (IE9 & others) 135 | $searchInput.on('input', function(e) { 136 | // Unbind propertychange event for IE9+ 137 | if (!propertyChangeUnbound) { 138 | $(this).unbind('propertychange'); 139 | propertyChangeUnbound = true; 140 | } 141 | 142 | handleUpdate(); 143 | }); 144 | 145 | // Push to history on blur 146 | $searchInput.on('blur', function(e) { 147 | // Update history state 148 | if (usePushState) { 149 | var uri = updateQueryString('q', $(this).val()); 150 | history.pushState({ path: uri }, null, uri); 151 | } 152 | }); 153 | } 154 | 155 | gitbook.events.on('page.change', function() { 156 | bindSearch(); 157 | closeSearch(); 158 | 159 | // Launch search based on query parameter 160 | if (gitbook.search.isInitialized()) { 161 | launchSearchFromQueryString(); 162 | } 163 | }); 164 | 165 | gitbook.events.on('search.ready', function() { 166 | bindSearch(); 167 | 168 | // Launch search from query param at start 169 | launchSearchFromQueryString(); 170 | }); 171 | 172 | function getParameterByName(name) { 173 | var url = window.location.href; 174 | name = name.replace(/[\[\]]/g, '\\$&'); 175 | var regex = new RegExp('[?&]' + name + '(=([^]*)|&|#|$)', 'i'), 176 | results = regex.exec(url); 177 | if (!results) return null; 178 | if (!results[2]) return ''; 179 | return decodeURIComponent(results[2].replace(/\+/g, ' ')); 180 | } 181 | 182 | function updateQueryString(key, value) { 183 | value = encodeURIComponent(value); 184 | 185 | var url = window.location.href; 186 | var re = new RegExp('([?&])' + key + '=.*?(&|#|$)(.*)', 'gi'), 187 | hash; 188 | 189 | if (re.test(url)) { 190 | if (typeof value !== 'undefined' && value !== null) 191 | return url.replace(re, '$1' + key + '=' + value + '$2$3'); 192 | else { 193 | hash = url.split('#'); 194 | url = hash[0].replace(re, '$1$3').replace(/(&|\?)$/, ''); 195 | if (typeof hash[1] !== 'undefined' && hash[1] !== null) 196 | url += '#' + hash[1]; 197 | return url; 198 | } 199 | } 200 | else { 201 | if (typeof value !== 'undefined' && value !== null) { 202 | var separator = url.indexOf('?') !== -1 ? '&' : '?'; 203 | hash = url.split('#'); 204 | url = hash[0] + separator + key + '=' + value; 205 | if (typeof hash[1] !== 'undefined' && hash[1] !== null) 206 | url += '#' + hash[1]; 207 | return url; 208 | } 209 | else 210 | return url; 211 | } 212 | } 213 | }); 214 | -------------------------------------------------------------------------------- /docs/gitbook/gitbook-plugin-sharing-plus/buttons.js: -------------------------------------------------------------------------------- 1 | require(['gitbook', 'jquery'], function(gitbook, $) { 2 | function site(label, icon, link) { 3 | return { 4 | label: label, 5 | icon: 'fa fa-' + icon, 6 | onClick: function (e) { 7 | e.preventDefault(); 8 | window.open(link); 9 | } 10 | }; 11 | } 12 | 13 | var url = encodeURIComponent(location.href); 14 | var title = encodeURIComponent(document.title); 15 | 16 | var SITES = { 17 | douban: site('豆瓣', 'share', 'http://shuo.douban.com/!service/share?href=' + url + '&name=' + title), 18 | facebook: site('Facebook', 'facebook', 'http://www.facebook.com/sharer/sharer.php?s=100&p[url]=' + url), 19 | google: site('Google+', 'google-plus', 'https://plus.google.com/share?url=' + url), 20 | hatenaBookmark: site('はてなブックマーク', 'bold', 'http://b.hatena.ne.jp/entry/' + url), 21 | instapaper: site('instapaper', 'instapaper', 'http://www.instapaper.com/text?u=' + url), 22 | line: site('LINE', 'comment', 'http://line.me/R/msg/text/?' + title + ' ' + url), 23 | linkedin: site('Linkedin', 'linkedin', 'https://www.linkedin.com/shareArticle?mini=true&url=' + url), 24 | messenger: site('Facebook Messenger', 'commenting', 'fb-messenger://share?link=' + url), 25 | pocket: site('Pocket', 'get-pocket', 'https://getpocket.com/save?url=' + url + '&title=' + title), 26 | qq: site('QQ', 'qq', 'http://connect.qq.com/widget/shareqq/index.html?url=' + url + '&title=' + title), 27 | qzone: site('QQ空间', 'star', 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=' + url + '&title=' + title), 28 | stumbleupon: site('StumbleUpon', 'stumbleupon', 'http://www.stumbleupon.com/submit?url=' + url + '&title=' + title), 29 | twitter: site('Twitter', 'twitter', 'https://twitter.com/intent/tweet?url=' + title + '&text=' + title), 30 | viber: site('Viber', 'volume-control-phone', 'viber://forward?text='+ url + ' ' + title), 31 | vk: site('VK', 'vk', 'http://vkontakte.ru/share.php?url=' + url), 32 | weibo: site('新浪微博', 'weibo', 'http://service.weibo.com/share/share.php?content=utf-8&url=' + url + '&title=' + title), 33 | whatsapp: site('WhatsApp', 'whatsapp', 'whatsapp://send?text='+ url + ' ' + title), 34 | }; 35 | 36 | gitbook.events.bind('start', function(e, config) { 37 | var opts = config.sharing; 38 | 39 | // Create dropdown menu 40 | var menu = $.map(opts.all, function(id) { 41 | var site = SITES[id]; 42 | 43 | return { 44 | text: site.label, 45 | onClick: site.onClick 46 | }; 47 | }); 48 | 49 | // Create main button with dropdown 50 | if (menu.length > 0) { 51 | gitbook.toolbar.createButton({ 52 | icon: 'fa fa-share-alt', 53 | label: 'Share', 54 | position: 'right', 55 | dropdown: [menu] 56 | }); 57 | } 58 | 59 | // Direct actions to share 60 | $.each(SITES, function(sideId, site) { 61 | if (!opts[sideId]) return; 62 | 63 | gitbook.toolbar.createButton({ 64 | icon: site.icon, 65 | label: site.text, 66 | position: 'right', 67 | onClick: site.onClick 68 | }); 69 | }); 70 | }); 71 | }); 72 | -------------------------------------------------------------------------------- /docs/gitbook/images/apple-touch-icon-precomposed-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nilaoda/N_m3u8DL-CLI/985f6e57c33de552561edd8f7b141a69bd75484c/docs/gitbook/images/apple-touch-icon-precomposed-152.png -------------------------------------------------------------------------------- /docs/gitbook/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nilaoda/N_m3u8DL-CLI/985f6e57c33de552561edd8f7b141a69bd75484c/docs/gitbook/images/favicon.ico -------------------------------------------------------------------------------- /docs/source/images/GUI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nilaoda/N_m3u8DL-CLI/985f6e57c33de552561edd8f7b141a69bd75484c/docs/source/images/GUI.png -------------------------------------------------------------------------------- /docs/source/images/M3U8URL2File.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nilaoda/N_m3u8DL-CLI/985f6e57c33de552561edd8f7b141a69bd75484c/docs/source/images/M3U8URL2File.gif -------------------------------------------------------------------------------- /docs/source/images/alipay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nilaoda/N_m3u8DL-CLI/985f6e57c33de552561edd8f7b141a69bd75484c/docs/source/images/alipay.png -------------------------------------------------------------------------------- /docs/source/images/muxSetJson.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nilaoda/N_m3u8DL-CLI/985f6e57c33de552561edd8f7b141a69bd75484c/docs/source/images/muxSetJson.png -------------------------------------------------------------------------------- /docs/source/images/直接使用.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nilaoda/N_m3u8DL-CLI/985f6e57c33de552561edd8f7b141a69bd75484c/docs/source/images/直接使用.gif --------------------------------------------------------------------------------