|
阅读:2323回复:4
能否请论坛的朋友帮忙写一个起点中文网的txt下载脚本
是这样的,我想在浏览起点有这样一个功能,
比如在http://www.qidian.com/Book/1908768.aspx,这个书页上面可以直接在页面的合适位置有一个按钮, 点击就能直接下载txt(其实也就是打开http://download.qidian.com/pda/1908768.txt这串地址), 而不是先点击上面的下载阅读,再选择txt这样下载, 起点中文网上面小说的txt的地址是这样的,以上面这本书为例,http://download.qidian.com/pda/1908768.txt 不知道论坛上的朋友能不能帮我写一个这样的脚本,非常感谢,我觉得还挺有用的,如果写出来的话,还可以在提供的脚本上面略作修改试用于其他一些情况,比如其他网站的下载 |
|
|
1楼#
发布于:2012-01-09 22:01
dindog:请问是否有方法更进一步在下载时把保存的文件名自动改成小说的名字呢? |
|
|
2楼#
发布于:2012-01-09 22:01
谢谢上面两位朋友帮忙,挺有用的,另外问一下,如果想要做成按钮要怎么改代码?
|
|
|
3楼#
发布于:2012-01-09 22:01
同上,多支持几种类型而已
// ==UserScript==
// @id qidian_download_helper
// @name qidianDownloadHelper
// @version 1.0.0
// @namespace http://userscripts.org/users/Harv
// @author Harv
// @description 起点小说下载助手
// @include http://www.qidian.com/Book/*
// @run-at document-end
// ==/UserScript==
(function() {
var tabs = document.querySelector('#divBookInfo .tabs ul');
var li = document.createElement('li');
li.className = 'notab nohid';
var div = document.createElement('div');
with(div) {
className = 'sc';
var a = document.createElement('a');
a.className = 'scd';
a.href = 'javascript:;';
a.innerHTML = '下载';
appendChild(a);
var ul = document.createElement('ul');
ul.className = 'scmenu';
var list = ['txt', 'apk', 'epub', 'chm', 'umd'];
var number = document.location.pathname.match(/\d+/);
with(ul) {
for(var i = 0; i < list.length; i++) {
var lili = document.createElement('li');
var aa = document.createElement('a');
if(list[i] == 'txt')
aa.href = 'http://download.qidian.com/pda/' + number + '.' + list[i];
else
aa.href = 'http://download.qidian.com/' + list[i] + '/' + number + '.' + list[i];
aa.innerHTML = list[i];
lili.appendChild(aa);
appendChild(lili);
}
}
appendChild(ul);
}
li.appendChild(div);
tabs.appendChild(li);
})(); |
|
|
|
4楼#
发布于:2012-01-09 22:01
// ==UserScript==
// @name 起点下载
// @namespace qidiantxt
// @include http://www.qidian.com/Book/*
// ==/UserScript==
var link = document.location.pathname.match(/\d+/)
tab = document.querySelector('.tabs ul');
newtab = document.createElement('li');
newtab.innerHTML='<a href="http://download.qidian.com/pda/' + link + '.txt">下载TXT</a>';
tab.appendChild(newtab);内容介绍那里会多一个标签 |
|
|