更换博客图片为本地
没注意Imgur被墙了,把博客上的图下载回来重传到GitHub上
因为之前用的PicGo这款软件,所以直接用Sublime Text 3写个正则(https://.*)(\.png|jpg)从C:\Users\Administrator\AppData\Roaming\PicGo\data.json里提取下图片链接
提取后写个小脚本,直接保存到博客目录的/source/images/下
代码如下
'''@Description: @Author: [email protected]: https://github.com/[email protected]: [email protected]: 2019-04-12 09:56:[email protected]: 2019-04-12 11:12:20'''import requestsfrom random import choice'''USER_AGENTS 随机头信息'''USER_AGENTS = [ " ...
批量去除后缀脚本
批量去除一个文件夹目录下的文件后缀的脚本
'''@Description: @Author: [email protected]: https://github.com/[email protected]: [email protected]: 2019-03-23 23:37:[email protected]: 2019-03-23 23:58:22'''import osdef getFileExt(path): ''' 获取指定目录下的所有指定后缀的文件名 ''' f_list = os.listdir(path) for file in f_list: fileName=file #print(fileName) file_ext=os.path.splitext(file)[-1] #print(file_ext) #print(os.path.splitext(file)[0]) ...
Wallhaven.cc 小爬虫
一个月前无意中发现个壁纸站wallhaven.cc,写了个小爬虫挂服务器上了。
直接上代码吧
'''@Description: wallhaven.cc [email protected]: [email protected]: https://github.com/[email protected]: 2019-02-12 20:20:[email protected]: [email protected]: 2019-02-12 20:40:41'''import osimport timefrom random import choiceimport requests'''USER_AGENTS 随机头信息'''USER_AGENTS = [ "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; AcooBrowser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)", ...