Python3 requests 下载进度条

 

代码:

def proxy_get_content_stream(url):
    if is_use_proxy:
        socks.set_default_proxy(socks.SOCKS5, PROXY_HOST, PROXY_PORT)
        socket.socket = socks.socksocket
    return requests.get(url, headers=HEADERS, stream=True, timeout=300)
def save_image_from_url_with_progress(url, cnt):
    with closing(proxy_get_content_stream(url)) as response:
        chunk_size = 1024  # 单次请求最大值
        content_size = int(response.headers['content-length'])  # 内容体总大小
        data_count = 0
        with open(cnt, "wb") as file:
            for data in response.iter_content(chunk_size=chunk_size):
                file.write(data)
                data_count = data_count + len(data)
                now_position = (data_count / content_size) * 100
                print("\r[D] 下载进度: %s %d%%(%d/%d)" % (int(now_position) * '▊' + (100 - int(now_position)) * ' ',
                                                      now_position,
                                                      data_count,
                                                      content_size,), end=" ")
        print('')
Continue Reading

美图录 爬虫

****************************************************************************************************
       _           _             ____                           
  ___ | |__   __ _| |__  _   _  / __ \ _ __ ___   __ _ _ __ ___ 
 / _ \| '_ \ / _` | '_ \| | | |/ / _` | '_ ` _ \ / _` | '__/ __|
| (_) | |_) | (_| | |_) | |_| | | (_| | | | | | | (_| | |  \__ \
 \___/|_.__/ \__,_|_.__/ \__, |\ \__,_|_| |_| |_|\__,_|_|  |___/
                         |___/  \____/                          

美图录爬虫
Verson: 21.6.15
Blog: http://www.h4ck.org.cn
****************************************************************************************************
****************************************************************************************************
[*] 2021-06-16 21:00:11 CAT: 开始分析分类信息......
[*] 2021-06-16 21:00:11 泳装: http://www.meitulu.cn/t/yongzhuang/
[*] 2021-06-16 21:00:11 可爱: http://www.meitulu.cn/t/keai/
[*] 2021-06-16 21:00:11 日本美女: http://www.meitulu.cn/t/ribenmeinv/
Continue Reading

BeautifulSoup4 中文乱码

BeautifulSoup4解析页面的时候发现有一部分内容是乱码,刚开始还以为是pycharm的问题,后来发现可能问题不是出在pycharm上,因为普通的print打印的中文是没有问题的。测试代码如下:

def proxy_get(url):
    if is_use_proxy:
        socks.set_default_proxy(socks.SOCKS5, PROXY_HOST, PROXY_PORT)
        socket.socket = socks.socksocket
    req = requests.get(url, headers=HEADERS)
    return req.text


def get_sub_pages_test(url):
    '''
    http://www.meitulu.cn/t/shishen/
    :param url:
    :return:
    '''
    bs = BeautifulSoup(proxy_get(url), "html.parser")
    boxes = bs.find('div', class_='boxs')
    lis = boxes.find_all('li')
    log_text('PAGE', '开始分析页面链接', is_begin=True)
    for l in lis:
        p = l.find('p', class_='p_title')
        print( p.text)
Continue Reading

MyLanViewer V4.25.0 Patch

MyLanViewer Network/IP Scanner is a powerful IP address scanner for local area network (LAN), whois and traceroute tool, remote shutdown and Wake On LAN (WOL) manager, wireless network scanner and monitor. This application will help you find all IP addresses, MAC addresses and shared folders of computers on your wired or wireless (Wi-Fi) network. The program scans network and displays your network computers in an easy to read, buddy-list style window that provides the computer name, IP address, MAC address, NIC vendor, OS version, logged users, shared folders and other technical details for each computer. MyLanViewer Network/IP Scanner supports remote shutdown, wake-on-lan, lock workstation, log off, sleep, hibernate, reboot and power off. It is able to monitor IP address and show notifications when the states of some computers change. MyLanViewer Network/IP Scanner can also view and access shared folders, terminate user sessions, disable shared folders, show netstat information and detect rogue DHCP servers. The software can monitor all devices (even hidden) on your subnet, and show notifications when the new devices will be found (for example, to know who is connected to your WiFi router or wireless network). The program easy to install and use, and has a user-friendly and beautiful interface.

Continue Reading

【迅雷】应版权方要求 无法下载

迅雷下载的时候这错误(应版权方要求,无法下载)经常遇到,尝试过几种不同的工具,效果都一般。例如下载下面的这个东西,测试连接:

magnet:?xt=urn:btih:7ec36aaab68162228eab67016ae7328aa4574d43&dn=%5B%E7%94%B5%E5%BD%B1%E5%A4%A9%E5%A0%82www.dytt89.com%5D%E9%AC%BC%E5%90%B9%E7%81%AF%E4%B9%8B%E9%BB%84%E7%9A%AE%E5%AD%90%E5%9D%9F-2021_HD%E5%9B%BD%E8%AF%AD%E4%B8%AD%E5%AD%97.mp4
Continue Reading

Mac m1 安装Wine/WineHQ

Wine (“Wine Is Not an Emulator” 的首字母缩写)是一个能够在多种 POSIX-compliant 操作系统(诸如 Linux,macOS 及 BSD 等)上运行 Windows 应用的兼容层。Wine 不是像虚拟机或者模拟器一样模仿内部的 Windows 逻辑,而是將 Windows API 调用翻译成为动态的 POSIX 调用,免除了性能和其他一些行为的内存占用,让你能够干净地集合 Windows 应用到你的桌面。

Continue Reading

算法助手!基于Xposed的通用Hook工具[ZZ]

前言

大家好,我是Junge,以前接单的时候,经常需要分析各种加密算法,还有数据的sign算法,由于静态分析效率太低,就随便写了这个Hook工具。

起初使用的是logcat打印日志,将密文,密钥,明文,md5前的信息,MD5后的信息等信息打印出来,但是很快发现了一个问题,在数据量大的时候,密文很多,密钥也很多,打印信息太乱,经常会出现密文不知道对应哪个密钥,而且如果是动态秘钥,单纯的打印秘钥就显得没有意义了。

于是改过以后,才有了这软件的初版,能够将秘钥,密文,明文,联系起来,并打印出调用堆栈。
后来我的一个朋友也开发,并发布了该软件https://bbs.pediy.com/thread-262476.htm

但是后来由于各种原因,他没能继续维护软件,所以我将我写的放出来,给各位使用,并且只要有时间会持续维护的。

Continue Reading