├── .github └── workflows │ └── python-app.yml ├── LICENSE ├── README.md ├── cookie.py ├── main.py └── requirements.txt /.github/workflows/python-app.yml: -------------------------------------------------------------------------------- 1 | name: Python application 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | pull_request: 7 | branches: [ "main" ] 8 | 9 | permissions: 10 | contents: read 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v3 19 | - name: Set up Python 3.10 20 | uses: actions/setup-python@v3 21 | with: 22 | python-version: "3.10" 23 | - name: Install system dependencies 24 | run: | 25 | sudo apt-get update 26 | sudo apt-get install -y libx11-xcb1 libxrandr2 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxi6 libgtk-3-0 libgdk-pixbuf2.0-0 libpangocairo-1.0-0 libpango-1.0-0 libatk1.0-0 libcairo-gobject2 libcairo2 libglib2.0-0 libasound2 libxrender1 27 | - name: Install dependencies 28 | run: | 29 | python -m pip install --upgrade pip 30 | if [ -f requirements.txt ]; then pip install -r requirements.txt; fi 31 | playwright install 32 | - name: Run main.py 33 | run: | 34 | python main.py 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 jess xie 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nodeseek自动签到 2 | nodeseek自动获取随机鸡腿 3 | 4 | ## 4月16日更新 5 | 现以可用 6 | 7 | ## 使用方法 8 | 将username和password改成自己的 9 | ``` 10 | git clone https://github.com/jessfin/nssign 11 | cd nssign 12 | ``` 13 | ``` 14 | pip install -r requirements.txt 15 | playwright install firefox 16 | ``` 17 | 如果安装firefox报错请执行`debian/ubuntu` 18 | ``` 19 | apt install libxcb-shm0 libx11-xcb1 libxrandr2 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxi6 libgtk-3-0 libgdk-pixbuf2.0-0 libpangocairo-1.0-0 libpango-1.0-0 libatk1.0-0 libcairo-gobject2 libcairo2 libglib2.0-0 libasound2 libxrender1 20 | ``` 21 | ###测试运行 22 | 23 | ``` 24 | python3 main.py 25 | ``` 26 | 27 | 自己设置定时任务 28 | -------------------------------------------------------------------------------- /cookie.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import json 3 | 4 | # Your cookies 5 | cookies = [ 6 | "session=a78d8cdbb42df588", 7 | # "session=84a78d8", 8 | # "session=2684a78d8", // 修改session后面的值,如果需要多用户请删除前面# 9 | ] 10 | 11 | # Now you can use requests library to send POST request 12 | url = "https://www.nodeseek.com/api/attendance?random=true" 13 | headers = { 14 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0", 15 | "Referer": "https://www.nodeseek.com/credit" 16 | } 17 | 18 | for cookie in cookies: 19 | headers["Cookie"] = cookie 20 | response = requests.post(url, headers=headers) 21 | 22 | data = json.loads(response.text) 23 | 24 | print(data["message"]) 25 | 26 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from playwright.sync_api import sync_playwright 2 | import requests 3 | import json 4 | import time 5 | import os 6 | 7 | accounts = [ 8 | {'username': 'username1', 'password': 'password1'}, 9 | {'username': 'username2', 'password': 'password2'}, 10 | {'username': 'username3', 'password': 'password3'} 11 | ] 12 | 13 | def save_cookie(username, cookie_str): 14 | with open('cookie.txt', 'a') as file: 15 | file.write(f"{username}: {cookie_str}\n") 16 | 17 | def load_cookies(): 18 | cookies = {} 19 | if os.path.exists('cookie.txt'): 20 | with open('cookie.txt', 'r') as file: 21 | lines = file.read().splitlines() 22 | for line in lines: 23 | parts = line.split(': ') 24 | if len(parts) == 2: 25 | username = parts[0] 26 | cookie_str = parts[1] 27 | cookies[username] = cookie_str 28 | return cookies 29 | 30 | def remove_cookie(username): 31 | cookies = load_cookies() 32 | if username in cookies: 33 | del cookies[username] 34 | with open('cookie.txt', 'w') as file: 35 | for username, cookie_str in cookies.items(): 36 | file.write(f"{username}: {cookie_str}\n") 37 | 38 | with sync_playwright() as p: 39 | for account in accounts: 40 | cookies = load_cookies() 41 | 42 | if account['username'] in cookies: 43 | cookie_str = cookies[account['username']] 44 | else: 45 | browser = p.firefox.launch() 46 | page = browser.new_page() 47 | page.goto('https://www.nodeseek.com/signIn.html', timeout=60000) 48 | page.fill('#stacked-email', account['username']) 49 | page.fill('#stacked-password', account['password']) 50 | page.click('//button[@type="submit"]') 51 | time.sleep(60) 52 | cookies = page.context.cookies() 53 | cookie_str = "; ".join([f"{cookie['name']}={cookie['value']}" for cookie in cookies]) 54 | save_cookie(account['username'], cookie_str) 55 | browser.close() 56 | 57 | url = "https://www.nodeseek.com/api/attendance?random=true" 58 | headers = { 59 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0", 60 | "Referer": "https://www.nodeseek.com/credit", 61 | "Cookie": cookie_str 62 | } 63 | response = requests.post(url, headers=headers) 64 | data = json.loads(response.text) 65 | print(f"用户名: {account['username']}") 66 | print(data["message"]) 67 | 68 | if data["message"] == "USER NOT FOUND": 69 | remove_cookie(account['username']) 70 | continue 71 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests~=2.31.0 2 | playwright~=1.42.0 3 | --------------------------------------------------------------------------------