首先在有道云笔记里写文章,再用下列Java工具将文章所有的图片下载到本地:

package youdao;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.json.JSONObject;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
public class YoudaoNoteSingle {private static String mTitle = null; private static final String PREFIX = "C:\\Users\\i042416\\Pictures\\";private static void createFolder(String title){ DownloadTask.FOLDER = PREFIX + title; File file = new File( DownloadTask.FOLDER); file.mkdir();}private static List<DownloadTask> getYoudaoPicUrlList(String formattedUrl){HttpClient client = HttpClients.createDefault(); List<DownloadTask> resultPic = new ArrayList<DownloadTask>(); int index = 0;HttpGet get = new HttpGet(formattedUrl); try {HttpResponse response = client.execute(get); HttpEntity entity = response.getEntity();
String result = EntityUtils.toString(entity, "UTF-8"); JSONObject obj = new JSONObject(result);
mTitle = obj.get("tl").toString(); createFolder(mTitle); String content = obj.get("content").toString();
Matcher m = Pattern.compile("src\\s*=\\s*\"?(.*?)(\"|>|\\s+)").matcher(content);
while (m.find()) { DownloadTask task = new DownloadTask(m.group(1), index++); resultPic.add(task); } } catch (Exception e){ e.printStackTrace(); }
return resultPic; } private static void start(List<DownloadTask> task){if( task.isEmpty()){System.out.println("No picture to download!"); return;}
System.out.println("Total pic to be downloaded: " + task.size()); ExecutorService executor = Executors.newFixedThreadPool(10);
for( int i = 0; i < task.size(); i++){PictureDownloader cc = new PictureDownloader(task.get(i)); executor.execute(cc);}executor.shutdown();
while (!executor.isTerminated()) {} System.out.println("Download Finished.");} private static void download(){String zero = "c91a710af51c1e1b20f5d1da2140a9e4"; String one = "4cc557ab9b7cbde0515b49a155c5dce3"; String two = "6eaae532daaa678cc610f2a34cbc9119"; String urlStr = "";
/***************/  int YOUR_CHOICE = 2; /************/ switch(YOUR_CHOICE){case 0: urlStr = "http://note.youdao.com/yws/public/note/" + zero + "?keyfrom=public"; break;
case 1: urlStr = "http://note.youdao.com/yws/public/note/" + one + "?keyfrom=public"; break;
case 2: urlStr = "http://note.youdao.com/yws/public/note/" + two + "?keyfrom=public"; break; }
System.out.println("url: " + urlStr); List<DownloadTask> task = getYoudaoPicUrlList(urlStr); start(task);}public static void main(String[] args) {download(); }}

文章里的图片用[图片]代替。

然后在使用这个html网页,将云笔记的文章源代码里包含的[图片]转换成markdown格式:

<html id="whole">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Jianshu Publish Tool</title>
<link rel="shortcut icon" type="image/png" href="d3.png" />
</head>
<style>
#raw, #result {background-color: rgb(199,237,204);
}#whole {background-color: black;
}
</style><textarea id="raw" rows="70" cols="80" onkeydown="keySend(event);">
</textarea>
<textarea id="result" rows="70" cols="80">
Paste the raw string copied from Cloud note in the Raw area
</textarea>
<button id="jerrybutton" onclick="myFunction()">Click me</button>
<script>function keySend(event) {if (event.ctrlKey && event.keyCode == 13) {var button=document.getElementById("jerrybutton"); button.focus(); button.onclick(); }}
</script><script>/*
![clipboard3](https://user-images.githubusercontent.com/5669954/32415087-7b4d8a06-c26e-11e7-9122-c818d5f31586.png)2017-11-11 1:11PM [图片] and ![imageTag] must be matched.
*/function getNodeTobeReplaced(current, parent, newPicUrl ){return {"current": current,"parent": parent,"newPicUrl": newPicUrl};
}/*
wefsdfs
![clipboard3](https://user-images.githubusercontent.com/5669954/32415087-7b4d8a06-c26e-11e7-9122-c818d5f31586.png)
*/var IMAGE_PATTERN = /^!\[(.*)\].*$/;
var IMAGE_NAME = /^clipboard(\d+)\..*$/;
var IMAGE_TAG = "[图片]";
var IMAGE_URL = /^.*(\(.*\))$/;function SortedImage(index, url){this.index = index;this.url = url;
}function sortByIndex(v1,v2){if(v1.index < v2.index ){return -1;}else if(v1.index > v2.index ){return 1;}else return 0;
}function extractImage(source,raw,imagePool){var splitted = source.split("\n");for( var i = 0; i < splitted.length; i++){var trimed = splitted[i]; //Jerry 2019-1-19 11:25AM don't trim, or code // format will be destroyed .trim();if( trimed.indexOf("clipboard") > 0 ) { var result = IMAGE_PATTERN.exec(trimed);// result 0 : whole image markdown// result 1 : "clipboard1"if( result.length != 2){continue;}var imageName = IMAGE_NAME.exec(result[1]);if( imageName.length != 2) {continue;}var index = parseInt(imageName[1]);var urls = IMAGE_URL.exec(result[0]);if( urls.length != 2){alert("something bad happends :(");}var url = "![]" + urls[1];var storedImage = new SortedImage(index, url);imagePool.push(storedImage);}else{raw.push(trimed);}}imagePool.sort(sortByIndex);
}function replaceImageTag(raw,imagePool){var formatted = "";var line = "";for( var i = 0; i < raw.length; i++){if( raw[i].indexOf(IMAGE_TAG) < 0){line = raw[i];}else{line = imagePool.shift().url;}formatted = formatted + "\n" + line;}return formatted;
}function myFunction(){var source = document.getElementById("raw");var html = source.value;var rawItem = [];var imagePool = [];extractImage(html,rawItem, imagePool);var formatted = replaceImageTag(rawItem,imagePool);var target = document.getElementById("result");target.value = addSignature(formatted);copyToClipboard(target);
}function addSignature(raw){var result = raw + "\n" + "\n" + "要获取更多Jerry的原创文章,请关注公众号\"汪子熙\":";var jerry = "![](https://upload-images.jianshu.io/upload_images/2085791-fc7ecd97deb67090.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)";result = result + "\n" + jerry;return result;
}
function copyToClipboard(node) {node.select();try {var successful = document.execCommand('copy');var msg = successful ? 'successful' : 'unsuccessful';// alert('Copying text command was ' + msg);} catch (err) {alert('Oops, unable to copy: ' + msg);}
}</script>
</html>

有道云笔记到简书的迁移工具相关推荐

  1. 最全的有道云笔记实用功能大盘点!PS:遇到优质的文章想收藏下来怎么办?在这里您就可以找到答案!

    道阻且长,行则将至.埋头苦干,不鸣则已,一鸣惊人!加油,骚年! 我肝文章了,我体会到了快乐! 文章目录 1 前言 2 参考资料 3 基本信息 3.1 账户相关 3.2 增加存储空间 4 新建文档 4. ...

  2. 有道云笔记网页版无法使用方向键

    最近使用有道云笔记网页版的时候,突然发现使用方向键无法移动光标了,这给使用带来极大的困扰,移动光标必须使用鼠标小心的定位,简直要崩溃,甚至有了放弃有道云笔记的念头,但无奈太多的笔记已经在这个平台,还是 ...

  3. 『简书API:jianshu 基于golang -- 用法介绍 (2)』

    首先我做这个项目的目的是朴素的: 熟悉golang 语法 通过这个项目呢,大家可以分析任意网站, 任意解析网站形成自己的API. 这个项目受项目:zhihu-go 影响.阅读完该项目的源码后,我立刻觉 ...

  4. 数据分析入门极简书单

    本文授权转载自麻瓜编程 如果你找一个熟悉的朋友给你推荐书单,他会倾向于越短越好,因为他想把他知道的最好的推荐给你,让你少花时间在不重要的事情上. 但如果你在网上看到一个书单,往往会发现都很长长长长长, ...

  5. Python玩转简书钻,简述钻是否对文章权重有影响?结果确实有!

    2018年11月15号,简书迎来大变革,取消了以往的积分制度,换为去中心化的简书钻,每日发放一万简书钻.首先,简书给出了获取钻石的途径:写文点赞,与以往的阅读,评论,点赞,关注,写作都能获取积分(不同 ...

  6. 简书CEO 林立:简书钻改,让付出有所得

    文 小玲儿 出品 耳朵财经 "难得,在物欲横流的今天,还有人愿意带着灵魂活着.支持简书." 这是简友给"简叔"文章<简友常见问题汇总>的留言,简叔, ...

  7. 乱炖“简书交友”数据之代码(1)

    上一篇文章乱炖数据之2700余篇"简书交友"专题文章数据的花式玩法发布后,不少人想学习下代码,由于此前不曾在GitHub上开源过,流程还不熟悉,再者本项目中很多尝试性的代码,异常杂 ...

  8. 印象笔记好还是有道云笔记好_有道云笔记和印象笔记哪个好?

    展开全部 用户在使用笔记类APP的时候主要有三种e5a48de588b63231313335323631343130323136353331333361306365操作,记录.管理.查看.在分析用户需 ...

  9. 有道云笔记、石墨笔记、 Effie …采编怎么选?

    采编即采集信息及编辑信息的工作,这类工作人员的工作集采访与编辑一体,既要采集稿件.广告等又要进行稿件编辑.修改和规格化.在一般情况下,采编的工作范围广.工作内容多.时间紧任务重.所有的文档编辑与校对工 ...

最新文章

  1. 车主无忧:天下武功,唯快不破,神策让我们快人一步
  2. NYOJ 108 士兵杀敌(一)
  3. JavaScript基础04【逻辑、复制、关系、相等运算符、Unicode编码表】
  4. SAP S/4HANA Smart Business Filter is too complex - step by step
  5. leetcode 1189 python
  6. 金税盘怎么安装在电脑上_金税盘怎么安装,电脑重装后怎样安装金税盘税控开票软件?...
  7. Storm目录树和任务提交过程
  8. js简单屏蔽鼠标右键实现方式
  9. xml建模包括以下_数据挖掘--建模与挖掘的结合
  10. PreferenceActivity之 Subclasses of PreferenceActivity must override isValidFragment(String)
  11. php 科学计数法 运算,php弱语言特性-计算科学计数法
  12. 翟东平微信公众号视频教程JAVA201810版2/3阶段-翟东平-专题视频课程
  13. 项目经历怎么写_简历里的项目经历怎么写才能打动招生官和面试官?
  14. MYSQL 时间格式化
  15. The application's PagerAdapter changed the adapter's contents without calling PagerAdapter
  16. 57q/5oCn5Luj5pWw5Y+K5YW25bqU55So56ysNeeJiOS4reaWh1BERui1hOa6kA==
  17. 2.3.2 HMC硬件管理终端
  18. 3、配置/管理Oracle数据库---监听程序配置
  19. dat文件用什么软件打开?
  20. 3t硬盘分区 Linux win,大师为你解说3t硬盘分区【搞定步骤】_

热门文章

  1. JavaScript调用ATL COM(二)
  2. mysqlreport查看mysql性能
  3. docker安装教程-centos
  4. zabbix使用脚本监控
  5. POJ 2250 (LCS,经典输出LCS序列 dfs)
  6. Linux中W与Who命令的使用
  7. C语言。自定义函数简单版
  8. MVC3"不允许启动新事务,因为有其他线程正在该会话中运行"错误解决方法
  9. 除了CRUD也要注意IO
  10. AS工程下gradle各文件(gradle.propertie等)与gradle配置(缓存等)讲述