Python生成Pdf报告

生成报告这个功能应该也有很多办法。因为我不会前端相关的开发,所以只能尝试用python来生成pdf报告。在实际使用的过程中发现现有的操作pdf的库体验都不是很好。所以改变策略尝试两步来实现pdf生成:

1.通过jinja2库操作doc文档根据模板生成相关的word文档

2.通过openoffice或者其他的命令行工具生成pdf,这是常规做法。还有另外一个办法就是通过oss的pdf转换功能生成pdf,这么做的好处是生成完了直接可以顺便生成一个下载链接,可以直接使用。

Continue Reading

美女图片整理【异常图片】

由于爬虫比较多,有的爬虫在下载的时候没有处理网络问题或者图片本山链接错误导致的图片异常。有的是处理了的,不要问为什么没加异常检测,问就是懒。

下载的图片会出现下面的问题,其实预览的时候就会发下问题了,另外打开这个图片其实会显示404或者502之类的错误页面。所以写了一段处理代码,主要两个功能:

1.删除小文件,至于多小自己去调整代码
2.如果目录下所有的文件都有问题,删除文件后同时删除目录

Continue Reading

m3u8 downloader [23.03.04][Windows]

更新记录:
1.修复txt文件url列表格式下载导致的windows下的文件名命名错误
m3u8_downloader.exe
****************************************************************************************************
Verson: 23.03.04
m3u8_downloader -i <input m3u8 link> -o <output file> -p <out put path> -f <input file> -m <ffmpeg path>
Need Arguments:
         -i <input m3u8 link>
Option Arguments:
         -o <output file> -p <out put path> -f <input file>
         -m <ffmpeg path>
ffmpeg:F:\Pycharm_Projects\m3u8_downloader\dist\m3u8_downloader\bin/ffmpeg.exe
Blog: http://www.h4ck.org.cn
Source Code: http://h4ck.org.cn/2020/01/基于ffmpeg的m3u8下载/
****************************************************************************************************

Continue Reading

爱看美女网爬虫【Windows】【23.03.02】

C:\Users\obaby>F:\Pycharm_Projects\sexy_girl_spider\dist\ikmn\ikmn.exe
****************************************************************************************************
USAGE:
spider -h <help> -a <all> -q <search> -e <early stop>
Arguments:
         -a <download all site images>
         -q <query the image with keywords>
         -h <display help text, just this>
Option Arguments:
         -p <image download path>
         -r <random index category list>
         -c <single category url>
         -e <early stop, work in site crawl mode only>
         -s <site url eg: https://www.ikmn.vip (no last backslash "/")>
****************************************************************************************************

Continue Reading

ChatGPT客户端

网上关于chatgpt的客户端一大堆,基于浏览器的,基于客户端的。各种版本,因为chatgpt实在太火爆了,现在抖音上都是各种chatgpt的直播,终于又有了一个风口。同样为因为openai的火爆,现在网上也出现了各种卖客户端源码的,账号的各种生意,一篇欣欣向荣。这几天我也体验了一下各种客户端。

1.基于web的客户端,基本这种客户端现在搜一下还能找到不少,昨天在论坛看到一个 https://chat.xdo.cc/,今天体验的时候就废掉啦:

Continue Reading

Python3 常用日期计算方法

后台做数据分析汇总的时候需要处理各种时间段,每天的零点、每周的第一天最后一天、每月的第一天最后一天等,不知道有没有现成的可用库来处理。搜索的基本也是各种其他人写的方法,我这里汇总了一下(抄了一些代码)。

日期处理一般会用到下面几个库:time,datetime,calendar。一般通过这几个库来处理时间也够用了。

time 模块

该模块包括使用时间执行各种操作所需的所有与时间相关的功能,它还允许我们访问多种用途所需的时钟类型。

Continue Reading

Django Export XLS 【Windows安装】

今天在windows电脑上安装django-export-xls的时候报错了:

(venv) PS F:\Pycharm_Projects\Ruoyi-Energy> pip3 install django-export-xls                                                         
Collecting django-export-xls
  Using cached django-export-xls-0.1.1.tar.gz (3.2 kB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
obaby\AppData\Local\Temp\pip-pip-egg-info-u0lvqod1'
       cwd: C:\Users\obaby\AppData\Local\Temp\pip-install-xrhra6sx\django-export-xls_d72b66d322264c26b516fda785f307fd\
  Complete output (5 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\obaby\AppData\Local\Temp\pip-install-xrhra6sx\django-export-xls_d72b66d322264c26b516fda785f307fd\setup.py", line 4, in <module>
      README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
  UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 918: illegal multibyte sequence
  ----------------------------------------

Continue Reading