// ==UserScript== // @name 网易新闻视频地址解析 // @namespace http://tampermonkey.net/ // @version 0.3.1 // @url https://greasyfork.org/zh-CN/scripts/382595 // @description 网易新闻内容 视频地址 解析 // @author Jack.Chan // @match *://c.m.163.com/news/* // @include https://3g.163.com/all/article/* // @grant none // @run-at document-end // @downloadURL none // ==/UserScript== (function() { 'use strict'; var videoList = [], pageTitle = document.title; if(window.DATA){ if(window.DATA.video && window.DATA.video.length){ videoList = window.DATA.video; pageTitle = window.DATA.title; } }else{ if(document.querySelector('.js-video')){ var video = document.querySelector('.js-video').querySelector('video'); videoList.push({url:video.src, title: document.title}); pageTitle = document.title; } } if(videoList.length){ var html = [], url, title; html.push('
'); html.push('
'+ pageTitle +'
'); videoList.forEach(function(item, i){ item.url = (item.mp4Hd_url || item.mp4_url || item.url_mp4 || item.url || '#'); item.title = (item.title || item.alt || document.title); html.push('
视频'+ parseInt(i+1) +':'+ item.title +'  下载
'); }); html.push('
'); var style = []; style.push(''); if(document.getElementById('parser')){ document.body.removeChild(document.getElementById('parser')); } var $parser = document.createElement('div'); $parser.id = 'parser'; $parser.className = 'parser'; $parser.innerHTML = style.join('') + html.join(''); document.body.appendChild($parser); }else{ if(location.host=='c.m.163.com'){ if(confirm('切换到:3g.163.com 可查看视频')){ var href = location.href.replace('c.m.163.com/news/a/', '3g.163.com/all/article/'); location.href = href; } } } try{ document.querySelector('.g-top-slider').remove(); document.querySelector('.js-slider').remove(); document.querySelector('.doc-footer-wrapper').remove(); document.querySelector('.m-slider-footer').remove(); }catch(ex){} })();