可扩展的Cookies池,用无头浏览器登录并生成cookie供给爬虫使用
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import requests
|
|
|
|
|
|
|
|
from cookiespool.db import RedisClient
|
|
|
|
|
|
|
|
conn = RedisClient('accounts', 'weibo')
|
|
|
|
|
|
|
|
def set(account, sep='----'):
|
|
|
|
username, password = account.split(' ')
|
|
|
|
result = conn.set(username, password)
|
|
|
|
print('账号', username, '密码', password)
|
|
|
|
print('录入成功' if result else '录入失败')
|
|
|
|
|
|
|
|
|
|
|
|
def scan():
|
|
|
|
print('请输入账号密码组, 输入exit退出读入')
|
|
|
|
while True:
|
|
|
|
account = input()
|
|
|
|
if account == 'exit':
|
|
|
|
break
|
|
|
|
set(account)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
scan()
|