tizeejit | 1 points | Apr 02 2022 13:46:32
护城河自动化指北个人目前使用,效果稳定。
见:https://www.reddit.com/r/CLTV/comments/tughne/%E6%8A%A4%E5%9F%8E%E6%B2%B3%E8%87%AA%E5%8A%A8%E5%8C%96%E5%87%86%E5%A4%87_rplace%E6%95%B0%E6%8D%AE%E7%9A%84%E8%AE%B0%E5%BD%95/
将想自动化维护的logo命名为image.png
,与脚本同目录。
What we need:
personal use script
with format pattern like sfad-GdgA7vOEdP51mdCT6w
)requirements.txt
使用python -m pip install -r requirements.txt
安装依赖。
certifi==2021.10.8
charset-normalizer==2.0.12
idna==3.3
python-dotenv==0.20.0
requests==2.27.1
urllib3==1.26.9
Pillow~=9.1.0
websocket-client~=1.3.2
脚本地址: https://pastebin.com/3ZdQdyH4
增加了代理的配置,方便国内浪人。
~~匿名化避免被王晶开盒~~
命名为main.py
或者你自定义的名字,python main.py
使用
Notice:第一次运行将在脚本所处目录下创建.env
文件,可填好配置信息。
txt
ENV_PLACE_USERNAME='["developer_username"]'
ENV_PLACE_PASSWORD='["developer_password"]'
ENV_PLACE_APP_CLIENT_ID='["app_client_id"]'
ENV_PLACE_SECRET_KEY='["app_secret_key"]'
ENV_HTTP_PROXY_HOST="http_proxy"
ENV_HTTP_PROXY_PORT="http_proxy_port"
ENV_DRAW_X_START="x_position_start_integer"
ENV_DRAW_Y_START="y_position_start_integer"
ENV_R_START='["0"]'
ENV_C_START='["0"]'
[-] Professional_Ice3229 | 1 points | Apr 02 2022 17:26:43
这么长 兄弟牛啊
[-] minuslouist | 1 points | Apr 02 2022 19:58:57
牛啊,
[-] ZhongXun_Xi | 1 points | Apr 03 2022 07:47:28
这具体怎么搞?不是整程序的看不懂,有没有手把手的教程
[-] tizeejit | 1 points | Apr 03 2022 08:13:36
根据你的操作系统,先安装python。这个可以看网络上的教程
[-] sonoichi | 1 points | Apr 03 2022 11:17:35
我填好了你的env了啊,
ENV_HTTP_PROXY_HOST="127.0.0.1"
ENV_HTTP_PROXY_PORT="8964"
他怎么还提醒我超时?我不会用python
[-] wang-hu-ning | 1 points | Apr 03 2022 12:22:15
本常委也在挠头
[-] FwjedsfE | 1 points | Apr 03 2022 13:27:55
&rt;ENV_PLACE_USERNAME='["developer_username"]'
ENV_PLACE_PASSWORD='["developer_password"]'
ENV_PLACE_APP_CLIENT_ID='["app_client_id"]'
ENV_PLACE_SECRET_KEY='["app_secret_key"]'
ENV_HTTP_PROXY_HOST="http_proxy"
ENV_HTTP_PROXY_PORT="http_proxy_port"
ENV_DRAW_X_START="x_position_start_integer"
ENV_DRAW_Y_START="y_position_start_integer"
ENV_R_START='["0"]'
ENV_C_START='["0"]'
这个地方是填本地的代理如果是clash啥的应该在7890,你本地真的有一个在8964的http代理么?
[-] sonoichi | 1 points | Apr 03 2022 13:29:57
是的,我回复你时用的就是这个。是一个http协议的8964
[-] FwjedsfE | 1 points | Apr 03 2022 13:58:44
那不应该啊?执行这个你会返回啥?是http 429么?
curl -I -X GET https://ssl.reddit.com/api/v1/access_token -x http://127.0.0.1:8964 -v
[-] sonoichi | 1 points | Apr 03 2022 14:01:36
C:\Users\sonoichi&rt;curl -I -X GET https://ssl.reddit.com/api/v1/access_token -x http://127.0.0.1:8964 -v* Trying 127.0.0.1:8964...* Connected to 127.0.0.1 (127.0.0.1) port 8964 (#0)* allocate connect buffer!* Establish HTTP proxy tunnel to ssl.reddit.com:443&rt; CONNECT ssl.reddit.com:443 HTTP/1.1&rt; Host: ssl.reddit.com:443&rt; User-Agent: curl/7.79.1&rt; Proxy-Connection: Keep-Alive&rt;< HTTP/1.1 200 OKHTTP/1.1 200 OK<* Proxy replied 200 to CONNECT request* CONNECT phase completed!* schannel: disabled automatic use of client certificate* schannel: ALPN, offering http/1.1* schannel: ALPN, server accepted to use http/1.1&rt; GET /api/v1/access_token HTTP/1.1&rt; Host: ssl.reddit.com&rt; User-Agent: curl/7.79.1&rt; Accept: */*&rt;* Mark bundle as not supporting multiuse< HTTP/1.1 429 Too Many RequestsHTTP/1.1 429 Too Many Requests< Connection: keep-aliveConnection: keep-alive< Content-Length: 46Content-Length: 46< Content-Type: application/json; charset=UTF-8Content-Type: application/json; charset=UTF-8< x-ua-compatible: IE=edgex-ua-compatible: IE=edge< x-frame-options: SAMEORIGINx-frame-options: SAMEORIGIN< x-content-type-options: nosniffx-content-type-options: nosniff< x-xss-protection: 1; mode=blockx-xss-protection: 1; mode=block< access-control-allow-origin: *access-control-allow-origin: *< access-control-expose-headers: X-Mooseaccess-control-expose-headers: X-Moose< cache-control: max-age=0, must-revalidatecache-control: max-age=0, must-revalidate< X-Moose: majesticX-Moose: majestic< Accept-Ranges: bytesAccept-Ranges: bytes< Date: Sun, 03 Apr 2022 13:59:35 GMTDate: Sun, 03 Apr 2022 13:59:35 GMT< Via: 1.1 varnishVia: 1.1 varnish< Set-Cookie: loid=0000000000lhlefngo.2.1648994375486.Z0FBQUFBQmlTYWhIMlM5d2wtX3hOM3pJZUt3WnpnbGhxUzVaZ0NyNGtSdm5LWWh5OUs1RjM4Slk0d1VXV1c5bVVyWEdGMS1Jb3UxOGpUb0hNblg0QkRHM1RNN1BrTE95M2JmT3c0LVZadGZyOFJuZENvRUpSQ3VhX0xXcU1fcHlFWDUtTkJVdlFhdTg; Domain=reddit.com; Max-Age=63071999; Path=/; expires=Tue, 02-Apr-2024 13:59:35 GMT; secure; SameSite=None; SecureSet-Cookie: loid=0000000000lhlefngo.2.1648994375486.Z0FBQUFBQmlTYWhIMlM5d2wtX3hOM3pJZUt3WnpnbGhxUzVaZ0NyNGtSdm5LWWh5OUs1RjM4Slk0d1VXV1c5bVVyWEdGMS1Jb3UxOGpUb0hNblg0QkRHM1RNN1BrTE95M2JmT3c0LVZadGZyOFJuZENvRUpSQ3VhX0xXcU1fcHlFWDUtTkJVdlFhdTg; Domain=reddit.com; Max-Age=63071999; Path=/; expires=Tue, 02-Apr-2024 13:59:35 GMT; secure; SameSite=None; Secure< Set-Cookie: session_tracker=s2arlODwPIEYYlxFSA.0.1648994375486.Z0FBQUFBQmlTYWhIOHJKS21Mak5YdXpZM3gycHFVUkdCME9CeVN3LTBkNnBqNmtnZU5MOS14TkhQZjhYcmJnRTRXZ0pJM01FcUtlTll5RmJmX2NUSXdjdGhhN3d5YVFTbDc5S2wydkFldmlHN1hsZS00YWZOSmF5Qkl1V2ZTZUZ5eGVkYzdXY3hfNS0; Domain=reddit.com; Max-Age=7199; Path=/; expires=Sun, 03-Apr-2022 15:59:35 GMT; secure; SameSite=None; SecureSet-Cookie: session_tracker=s2arlODwPIEYYlxFSA.0.1648994375486.Z0FBQUFBQmlTYWhIOHJKS21Mak5YdXpZM3gycHFVUkdCME9CeVN3LTBkNnBqNmtnZU5MOS14TkhQZjhYcmJnRTRXZ0pJM01FcUtlTll5RmJmX2NUSXdjdGhhN3d5YVFTbDc5S2wydkFldmlHN1hsZS00YWZOSmF5Qkl1V2ZTZUZ5eGVkYzdXY3hfNS0; Domain=reddit.com; Max-Age=7199; Path=/; expires=Sun, 03-Apr-2022 15:59:35 GMT; secure; SameSite=None; Secure< Set-Cookie: csv=2; Max-Age=63072000; Domain=.reddit.com; Path=/; Secure; SameSite=NoneSet-Cookie: csv=2; Max-Age=63072000; Domain=.reddit.com; Path=/; Secure; SameSite=None< Set-Cookie: edgebucket=05QPCjj7Nvpl3ntAi5; Domain=reddit.com; Max-Age=63071999; Path=/; secureSet-Cookie: edgebucket=05QPCjj7Nvpl3ntAi5; Domain=reddit.com; Max-Age=63071999; Path=/; secure< Strict-Transport-Security: max-age=15552000; includeSubDomains; preloadStrict-Transport-Security: max-age=15552000; includeSubDomains; preload< Server: snooservServer: snooserv<* Excess found: excess = 46 url = /api/v1/access_token (zero-length body)* Connection #0 to host 127.0.0.1 left intactC:\Users\sonoichi&rt;
[-] FwjedsfE | 1 points | Apr 03 2022 14:06:42
试试 https://gql-realtime-2.reddit.com/query
这个url呢?
[-] sonoichi | 1 points | Apr 03 2022 14:10:22
* Trying 127.0.0.1:8964...* Connected to 127.0.0.1 (127.0.0.1) port 8964 (#0)* allocate connect buffer!* Establish HTTP proxy tunnel to gql-realtime-2.reddit.com:443&rt; CONNECT gql-realtime-2.reddit.com:443 HTTP/1.1&rt; Host: gql-realtime-2.reddit.com:443&rt; User-Agent: curl/7.79.1&rt; Proxy-Connection: Keep-Alive&rt;< HTTP/1.1 200 OKHTTP/1.1 200 OK<* Proxy replied 200 to CONNECT request* CONNECT phase completed!* schannel: disabled automatic use of client certificate* schannel: ALPN, offering http/1.1* schannel: ALPN, server accepted to use http/1.1&rt; GET /query HTTP/1.1&rt; Host: gql-realtime-2.reddit.com&rt; User-Agent: curl/7.79.1&rt; Accept: */*&rt;* Mark bundle as not supporting multiuse< HTTP/1.1 401 UnauthorizedHTTP/1.1 401 Unauthorized< Date: Sun, 03 Apr 2022 14:08:18 GMTDate: Sun, 03 Apr 2022 14:08:18 GMT< Content-Type: application/json; charset=utf-8Content-Type: application/json; charset=utf-8< Content-Length: 159Content-Length: 159< Connection: keep-aliveConnection: keep-alive<* Excess found: excess = 159 url = /query (zero-length body)* Connection #0 to host 127.0.0.1 left intact
[-] FwjedsfE | 1 points | Apr 03 2022 14:15:30
感觉没问题,这个脚本总共就向这两个url发请求,你那都能访问都没问题
[-] sonoichi | 1 points | Apr 03 2022 14:15:42
=============&rt;env
ENV_PLACE_USERNAME='["sonoichi"]'ENV_PLACE_PASSWORD='["⬛⬛⬛⬛"]'ENV_PLACE_APP_CLIENT_ID='["sERSI7mb_bOWZtnp0iGttQ"]'ENV_PLACE_SECRET_KEY='["⬛⬛⬛⬛⬛⬛_⬛⬛⬛⬛"]'ENV_HTTP_PROXY_HOST="127.0.0.1"ENV_HTTP_PROXY_PORT="8964"ENV_DRAW_X_START="848"ENV_DRAW_Y_START="130"ENV_R_START='["0"]'ENV_C_START='["0"]'
=============&rt;where python
C:\Users\--------\AppData\Local\Programs\Python\Python310\python.exeC:\Users\--------\AppData\Local\Microsoft\WindowsApps\python.exeC:\msys64\mingw64\bin\python.exe
=============&rt; python main.py
image size: (25, 36)-------Thread #0-------Refreshing access token...Exception in thread Thread-1 (task):Traceback (most recent call last): File "C:\Users\--------\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connection.py", line 174, in _new_conn conn = connection.create_connection( File "C:\Users\--------\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\connection.py", line 95, in create_connection raise err File "C:\Users\--------\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\connection.py", line 85, in create_connection sock.connect(sa)TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respondDuring handling of the above exception, another exception occurred:Traceback (most recent call last): File "C:\Users\--------\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "C:\Users\--------\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request self._validate_conn(conn) File "C:\Users\--------\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 1040, in _validate_conn conn.connect() File "C:\Users\--------\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connection.py", line 358, in connect self.sock = conn = self._new_conn() File "C:\Users\--------\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connection.py", line 179, in _new_conn raise ConnectTimeoutError(urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x000002959F853070&rt;, 'Connection to ssl.reddit.com timed out. (connect timeout=None)')During handling of the above exception, another exception occurred:Traceback (most recent call last): File "C:\Users\--------\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\adapters.py", line 440, in send resp = conn.urlopen( File "C:\Users\--------\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 785, in urlopen retries = retries.increment( File "C:\Users\--------\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause))urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ssl.reddit.com', port=443): Max retries exceeded with url: /api/v1/access_token (Caused by Connect
[-] FwjedsfE | 1 points | Apr 03 2022 15:14:31
我知道什么原因了,不知道为什么这里的 websockets 没法被这个http代理,我找了个 VPS 能跑的
[-] FwjedsfE | 1 points | Apr 03 2022 13:59:34
对了op的号已经被封了,别用大号测试
[-] CesareBorgia- | 1 points | Apr 03 2022 13:08:57
我觉得先把支文去除了
[-] Professional-Bar3559 | 1 points | Apr 03 2022 13:14:45
我发现现在Reddit似乎会给识别为脚本的操作返回时间戳-300,这样CD就会变成600s,加了两行代码来识别和绕过这个行为。
[-] FwjedsfE | 1 points | Apr 03 2022 15:43:30
关于 .env
文件设置坐标:
小献忠左上角坐标为(848,130),那么如下变量就置为:
ENV_DRAW_X_START="848"
ENV_DRAW_Y_START="130"
其他图像以此类推~~
关于http代理,这里代理 websockets 有问题: 注释代码第190,191行(加#),建议脚本跑在 VPS 上,或者🦇人的机器帮忙跑吧
Dockerfile: ```
FROM python:3.9 AS builder COPY requirements.txt .
RUN pip install --user -r requirements.txt
FROM python:3.9-slim WORKDIR /app
COPY --from=builder /root/.local /root/.local COPY . .
ENV PATH=/root/.local:$PATH
CMD ["python", "-u", "main.py"] ```
[-] Next-Victory5382 | 1 points | Apr 03 2022 18:15:54
小号怎么搞?有卖号的吗?
[-] FwjedsfE | 1 points | Apr 03 2022 23:49:47
随便弄个邮箱,邮箱验证后冷却时间才会是5分钟
[-] Tall-Abbreviations16 | 1 points | Apr 04 2022 06:44:28
new error :
hon3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "main.py", line 469, in task
access_tokens[credentials_index] = response_data["access_token"]
KeyError: 'access_token'
[-] tizeejit | 1 points | Apr 02 2022 13:51:12
最佳实践
使用小号挂机。
大号在网页冲浪。