分类目录归档:Reptile

[ ip代理池 ]


python的免费ip代理池

GIT-HUB地址

1. 拉取代码

2. 修改docker-compose.yml文件内容为(指定自己的redis)

version: "3"
services:
  proxypool:
    image: "germey/proxypool:master"
    container_name: proxypool
    ports:
      - "5555:5555"
    restart: always
    environment:
      PROXYPOOL_REDIS_HOS

< Read more >

[ ffmpeg[基本参数使用] ]


官方文档

一、主要参数

◼ -i 设定输入流 ◼ -f 设定输出格式(format) ◼ -ss 开始时间 ◼ -t 时间长度

二、音频参数:

◼ -aframes 设置要输出的音频帧数 ◼ -b:a 音频码率 ◼ -ar 设定采样率 ◼ -ac 设定声音的Channel数 ◼ -acodec 设定声音编解码器,如果用copy表示原始编解码数据必须被拷贝。 ◼ -an 不处理音频 ◼ -af 音频过滤器

三、视频参数:

◼ -vframes 设置要输出的视频帧数 ◼ -b 设定视频码率 ◼ -b:v 视频码率 ◼ -r 设定帧速率 ◼ -s 设定画面的宽与高 ◼ -vn 不处理视频 ◼ -as

< Read more >

[ mp4生成m3u8文件以及切片[ffmpeg] ]


生成m3u8文件&切片

ffmpeg -i out.mp4 -vbsf h264_mp4toannexb -vcodec copy -acodec aac -strict 2 -g 150 -hls_time 20 -hls_list_size 0 -start_number 0 -f hls -y out.m3u8

新版本

ffmpeg -i out.mp4 -bsf:v h264_mp4toannexb -vcodec copy -acodec aac -strict 2 -g 150 -hls_time 20 -hls_list_size 0 -start_number 0 

< Read more >

[ 视频爬虫[python] ]


简单版本

1.案例网站

https://www.ikanbot.com/play/810009

爬取思路 - 查看网络请求情况 2 - 找到M3u8文件 3 - 获取m3u8文件请求地址 4 - 获取文件里面ts视频的请求地址 5

2.python爬虫 同步版本

import requests
import re
import os
header = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/1

< Read more >

[ selenium防检测 ]


selenium防检测

配合unittest使用实例

from django.test import TestCase
from selenium import webdriver
import time


class UserAuthTestCase(TestCase):
    @classmethod
    def setUpClass(cls):
        print("开始")

    @classmethod
    def tearDownClass(cls):
        print("结束")

    def setU

< Read more >

[ gerapy-scrapy可视化 ]


gerapy可视化爬虫

  1. 前提条件

    • 写好的scrapy爬虫项目
    • 安装, 并运行scrapyd提供项目对接端口6800
  2. 安装

pip install gerapy
  1. 初始化
    • 自动会创建可视化项目
gerapy init
  1. 生成数据库迁移
gerapy migrate
  1. 运行
gerapy runserver
  1. 主机管理
端口号写6800
  1. 项目管理
    1. 点击部署进入
    2. 打包项目把写好的scrapy导入, 打包成压缩包,或者直接复制项目到gerapy里的project文件夹里面
    3. 点击部署
  1. 执行
    1.

< Read more >

[ scrapy分布式爬虫基础 ]


scrapy基本使用

  1. 安装
pip install scrapy
  1. 创建项目
scrapy startporject 项目名
  1. 创建爬虫文件
cd 项目名 # 进入项目文件夹
scrapy genspider chf www.xxxx.com # chf是爬虫文件名, www.xxx.com是要爬的网站域名
  1. 运行
    • 保存为jsn文件
    • 保存为csv文件
scrapy crawl 爬虫文件名 -o wangzhan.json
或
scrapy crawl 爬虫文件名 -o wangzhan.csv

< Read more >

[ 图片验证码识别 ]


git转换为图片(其实是由4张图片组成)

fron PIL inport Image
import numpy as np
import cv2

path = r'xxx.gif'
image = Image.open(path)

shapes = []
for i in range(0, 4):
    image.seek(i)
    image.save(r'./{}.png'.format(i))
    shapes.append(np.array(image))

cv2.imwrite(r'reult.png', '&

< Read more >