This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
@author: cxyfreedom | |
@desc: 使用 zset 来实现延迟队列 | |
""" | |
import redis | |
import time | |
import threading |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import random | |
Back_URL = 'https://api.bilibili.com/x/web-interface/archive/stat?aid=' | |
headers = { | |
'Cookie': "Replace Me With REAL COOKIE" , | |
'Pragma': 'no-cache', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
@author: cxyfreedom | |
@desc: 基于 snowflake 生成分布式ID | |
""" | |
import time | |
# 每一部分占用的位数 | |
TIMESTAMP_BIT = 41 # 时间戳占用位数 | |
MACHINE_BIT = 5 # 机器标识占用的位数 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import asyncio | |
from urllib.parse import urlparse | |
async def get(url): | |
url = urlparse(url) | |
host = url.netloc | |
path = url.path or "/" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: UTF-8 -*- | |
import hashlib | |
import hmac | |
import string | |
import datetime | |
import time | |
import uuid | |
import json | |
import requests |