{"id":19990165,"url":"https://github.com/princewck/weiboer","last_synced_at":"2025-05-04T09:34:37.009Z","repository":{"id":41933919,"uuid":"105514551","full_name":"princewck/weiboer","owner":"princewck","description":"基于nodejs 和puppeteer的微博自动发送工具","archived":false,"fork":false,"pushed_at":"2022-04-22T22:08:38.000Z","size":4083,"stargazers_count":27,"open_issues_count":4,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-13T04:52:13.832Z","etag":null,"topics":["nodejs-modules","wei-bo","weibo"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/princewck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-02T08:48:45.000Z","updated_at":"2024-07-15T05:57:29.000Z","dependencies_parsed_at":"2022-08-11T23:01:27.189Z","dependency_job_id":null,"html_url":"https://github.com/princewck/weiboer","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/princewck%2Fweiboer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/princewck%2Fweiboer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/princewck%2Fweiboer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/princewck%2Fweiboer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/princewck","download_url":"https://codeload.github.com/princewck/weiboer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252316784,"owners_count":21728521,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nodejs-modules","wei-bo","weibo"],"created_at":"2024-11-13T04:51:01.795Z","updated_at":"2025-05-04T09:34:35.983Z","avatar_url":"https://github.com/princewck.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"https://github.com/princewck/weiboer\n\n\n## Description\n一个用于自动发送微博的小插件\n\n\u003e headless: false时效果图：\n![](./demo.gif)\n\n## Install\n```sh\nnpm i weiboer --save\n```\n\n## Config\n\n```javascript\n// config.json 微博账号设置\n{\n  \"username\": \"185********\",\n  \"password\": \"your.password\",\n}\n```\n\n```javascript\n// .weiboer.js 全局puppeteer配置\nconst path = require('path');\nconst { PC_AGENTS } = require('./libs/userAgents');\n\nmodule.exports = {\n  // cookie缓存路径，默认会使用上次的cookie，如果有效则不使用账号密码登陆\n  'cookies_cache_path': path.resolve(__dirname, '.cookies'), \n  // 浏览器UA\n  'default_ua': PC_AGENTS.SAFRI_MAC,\n  // puppeteer 登陆选项\n  'launch_options': {\n    'headless': false,\n  },\n  'viewport_options': {\n    'width': 1366,\n    'height': 768,\n    'deviceScaleFactor': 1,\n  }\n}\n```\n\n- [launch_options](\u003chttps://zhaoqize.github.io/puppeteer-api-zh_CN/#?product=Puppeteer\u0026version=v1.11.0\u0026show=api-puppeteerlaunchoptions\u003e)\n- [viewport_options](\u003chttps://zhaoqize.github.io/puppeteer-api-zh_CN/#?product=Puppeteer\u0026version=v1.11.0\u0026show=api-pagesetviewportviewport\u003e)\n\n## Usage\n\n```javascript\nconst weiboer = require('weiboer');\nconst path = require('path');\nconst configFile = path.resolve(__dirname, './config.json'); // 微博账号配置,\n// configFile 可以缺省，但要至少确保环境变量中设置了username, password\nconst weiboHelper = weiboer.init(configFile);\nweiboHelper.publish('微博内容', ['./images/01.jps', './images/02.jps']);\n```\n\n## Methods\n### publish\n  Parameters\n  - text:string 微博内容\n  - images:Array\u003cstring\u003e 微博配图列表，本地图片路径\n\n\n\n## Results detecting\n\n1. \n```javascript\n  weiboHelper.publish('xx', ['./some_img.jpg'])\n    .then(() =\u003e {\n      // success\n    })\n    .catch(() =\u003e {\n      // error\n    });\n```\n\n2. \n```javascript\n  async function someFun() {\n    try {\n      await  weiboHelper.publish('xx', ['./some_img.jpg']);\n    } catch (e) {\n      // error handlers\n    }\n  }\n```\n\n\n\n## 注意⚠️\n\n请勿段时间频繁触发使用账号密码登陆流程，实测发现登陆一定次数后会出现输入账号正确仍然提示账号密码错误的情况。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprincewck%2Fweiboer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprincewck%2Fweiboer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprincewck%2Fweiboer/lists"}