使用 Playwright 来登录 Pixiv ,从而获取 token
- 下载本脚本
pixiv_auth.py - 安装
playwright和pyotp(两步验证):
pip install playwright
pip install pyotp使用 Playwright 来登录 Pixiv ,从而获取 token
pixiv_auth.pyplaywright 和 pyotp(两步验证):pip install playwright
pip install pyotp| 1 |
| import 'dart:math'; | |
| void testMaskEmail() { | |
| final emails = [ | |
| 'a@example.com', | |
| // output: a****a@example.com | |
| 'ab@example.com', | |
| // output: a****b@example.com | |
| 'abc@example.com', | |
| // output: a****c@example.com |
| - (NSData *)generateWavHeader:(NSUInteger)waveLength { | |
| // 定义 WAV 文件的参数 | |
| NSUInteger sampleRate = 16000; // 采样率 | |
| NSUInteger bitsPerSample = 16; // 采样位数 | |
| NSUInteger numChannels = 1; // 声道数(单声道) | |
| // 计算数据长度(不包括 WAV 文件头) | |
| NSUInteger dataLength = waveLength; // 数据长度(根据实际情况赋值) | |
| // 计算文件总长度(包括 WAV 文件头) |
| // 假设有一个名为 "floatArray" 的 float 数组和 "arrayLength" 表示数组长度 | |
| NSString *filePath = @"/path/to/file.wav"; // 指定保存 WAV 文件的路径 | |
| // 打开文件用于写入 | |
| NSOutputStream *outputStream = [NSOutputStream outputStreamToFileAtPath:filePath append:NO]; | |
| [outputStream open]; | |
| // 构建 WAV 文件头信息 | |
| // WAV 文件头的具体格式请根据需要进行调整,以下示例仅提供基本结构 |
| extension Sequence where Element: Hashable { | |
| func uniqued() -> [Element] { | |
| var set = Set<Element>() | |
| return filter { set.insert($0).inserted } | |
| } | |
| } |
| class MyViewController: UIViewController { | |
| // This constraint ties an element at zero points from the bottom layout guide | |
| @IBOutlet var keyboardHeightLayoutConstraint: NSLayoutConstraint? | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| NotificationCenter.default.addObserver(self, | |
| selector: #selector(self.keyboardNotification(notification:)), | |
| name: UIResponder.keyboardWillChangeFrameNotification, |