Skip to content

Instantly share code, notes, and snippets.

View luzihang123's full-sized avatar
🎯
疯狂撸码

clark luzihang123

🎯
疯狂撸码
  • Shanghai
View GitHub Profile
import hashlib
import json
import re
import execjs
import requests
def get_hash256(data: str):
hash256 = hashlib.sha256(data.encode('utf-8'))
return hash256.hexdigest()
@luzihang123
luzihang123 / jiyan_po_test.py
Created January 20, 2021 11:55
Python调用Java示例,破解极验案例
# coding:UTF-8
import json
import re
import threading
import time
import jpype
import redis
import requests
from bs4 import BeautifulSoup
@luzihang123
luzihang123 / ffmpeg_shell.sh
Created January 17, 2021 11:47
使用ffmpeg压缩相机、iPhone拍摄的影片,用来上传YouTube
for i in *.MP4;
do name=`echo "$i" | cut -d'.' -f1`
echo "$name"
ffmpeg -i "$i" "./result/${name}.mp4"
done
@luzihang123
luzihang123 / selenium_gird_no_webdriver.py
Last active July 23, 2020 01:44
在selenium gird远端中去除webdriver特征
# https://blog.csdn.net/u014291399/article/details/106636619
from selenium.webdriver.chrome.remote_connection import ChromeRemoteConnection
from selenium import webdriver
import time
chromeOptions = webdriver.ChromeOptions()
# chromeOptions.add_argument('-headless') # 设为无头模式
# chromeOptions.add_argument('--user-agent=Mozilla/5.0 HAHA') # 配置对象添加替换User-Agent的命令
chromeOptions.add_argument('--disable-infobars') # 去掉提示:Chrome正收到自动测试软件的控制
chromeOptions.add_experimental_option('excludeSwitches', ['enable-automation'])
chromeOptions.add_experimental_option('useAutomationExtension', False)
@luzihang123
luzihang123 / gsxt_pyppeteer.py
Created June 3, 2020 11:09
pyppeteer访问国家企业信用,渲染页面
import asyncio
from pyppeteer import launch
import jsonpath
import random
from scrapy.selector import Selector
from pyquery import PyQuery as pq
merchant_list = {
"data":
[
{
@luzihang123
luzihang123 / selenium_ua.py
Created May 14, 2020 07:04
selenium 远端/本地 替换UA 测试代码
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import requests
import logging
def test_chrome_server(host):
"""
主动调用,等待docker容器内chrome浏览器server启动
:return:
'''
Created on Apr 7, 2020
@author: admin
PyAutoGUI是一个纯Python的GUI自动化工具,其目的是可以用程序自动控制鼠标和键盘操作,多平台支持(Windows,OS X,Linux)。可以用pip安装,Github上有源代码。
下面的代码让鼠标移到屏幕中央。
'''
import pyautogui, time, pyperclip
@luzihang123
luzihang123 / jd_union_api.py
Created February 23, 2020 03:32 — forked from socrateslee/jd_union_api.py
京东联盟开放平台API的一个通用的Client封装
'''
京东联盟开放平台API的一个通用的Client封装。
京东联盟开放平台的文档详见 https://union.jd.com/openplatform
Example:
client = JdApiClient("<YOUR_APP_KEY>", "<YOUR_SECRET_KEY>")
resp = client.call("jd.union.open.goods.promotiongoodsinfo.query",
{'skuIds':'12072066'})
print(resp.json())
'''
@luzihang123
luzihang123 / get_next_week.py
Last active October 25, 2019 08:40
计算临近(包含今天)的星期几的日期
import calendar
import datetime
choose_week = {'1': 'MONDAY',
'2': 'TUESDAY',
'3': 'WEDNESDAY',
'4': 'THURSDAY',
'5': 'FRIDAY',
'6': 'SATURDAY',
'7': 'SUNDAY', }
@luzihang123
luzihang123 / auto_extract.py
Created September 9, 2019 10:58
智能解析文章
import requests
import json
headers = {
'Accept': 'application/json',
'Referer': 'https://scrapinghub.com/autoextract',
'Origin': 'https://scrapinghub.com',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36',
'Sec-Fetch-Mode': 'cors',
'Content-Type': 'application/json',
}