论坛帖子推送到微信

搬瓦工机场JMS

一直用的帖子推送到Tg,主要是tg api接口开放,操作简单粗暴,好用,就是需要上网代理,今天有空稍微修改了一下,让其推送到微信,30秒推送一次
操作步骤:
第一步:关注server酱,然后按照提示点击登录,然后绑定,获得key的类似于这样的格式:https://sc.ftqq.com/SCU63887T9e4*********************e50af2.send
第二步:替换一下代码中第34行链接,ojbk,再也不用担心有福利活动喝不到汤了,(我觉得维信推送垃圾的一比,推送信息可用资源太少,还有广告,看着就烦)
我建议关注tg机器人吧,毕竟发送内容是一样的,只需要请求一次,如果大家都去跑脚本,论坛表示压力很大
效果图如下:

附上python代码(python3,安装requests和lxml库):

  1. # -*- encoding: utf-8 -*-
  2. import requests
  3. from requests.adapters import HTTPAdapter
  4. import js2py
  5. import re
  6. from lxml import etree
  7. import time
  8. def getcookies():
  9.     url = ‘/forum.php?mod=forumdisplay&fid=45&filter=author&orderby=dateline’
  10.     js = js2py.EvalJs()
  11.     headers = {‘user-agent’: ‘Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Mobile Safari/537.36’}
  12.     try:
  13.         aesjs = requests.get("/aes.min.js", headers=headers, timeout=5).text
  14.     except Exception:
  15.         return ‘ReturnNothing’
  16.     js.execute(aesjs)
  17.     getcookie = requests.get(url).text
  18.     getcookie_script = re.findall("<script>(.*?)</script>",getcookie)
  19.     js.execute(getcookie_script[0].split("document")[0])
  20.     data = js.toHex(js.slowAES.decrypt(js.c, 2, js.a, js.b))
  21.     cookie = "L7DFW=" + data
  22.     print(cookie)
  23.     return cookie
  24. hostloc_list = {"hello"}
  25. cookiestr = getcookies()
  26. try:
  27.     while True:
  28.         post_url = ‘https://sc.ftqq.com/SCU63887T9e4e136f886e82***********************2.send?&#8217;
  29.         url = ‘/forum.php?mod=forumdisplay&fid=45&filter=author&orderby=dateline’
  30.         headers = {
  31.             ‘user-agent’: ‘Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Mobile Safari/537.36’}
  32.         requests.adapters.DEFAULT_RETRIES = 5
  33.         s = requests.session()
  34.         s.keep_alive = False
  35.         result = ‘L7DFW’ in cookiestr
  36.         if result:
  37.             headers = {‘Cookie’: cookiestr, ‘user-agent’: ‘Mozilla/5.0 (Linux; Android 6.0; ‘
  38.                                                           ‘Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome’
  39.                                                           ‘/46.0.2490.76 Mobile Safari/537.36’}
  40.             r = s.get(url, headers=headers)
  41.         else:
  42.             r = s.get(url, headers=headers)
  43.         xmlContent = etree.HTML(r.content)
  44.         hrefList = xmlContent.xpath("//div[@class=’threadlist’]/ul/li/a/text()")
  45.         author = xmlContent.xpath("//span[@class=’by’]/text()")
  46.         number = xmlContent.xpath("//span[@class=’num’]/text()")
  47.         href = xmlContent.xpath("//div[@class=’threadlist’]/ul/li/a/@href")
  48.         for i in range(len(number)):
  49.             if number[i] == ‘0’:
  50.                 if str(hrefList[i * 2].replace("\r\n", "")) not in hostloc_list:
  51.                     hostloc_list.add(str(hrefList[i * 2].replace("\r\n", "")))
  52.                     text = hrefList[i * 2].replace("\r\n", "")
  53.                     pid = re.findall(r’\d{6}’, href[i])
  54.                     url = "/thread-{}-1-1.html".format(int(pid[0]))
  55.                     text_url = post_url + "text=" + text + " by " + author[i] + ‘&desp=[点击打开链接](‘ + url + ")"
  56.                     requests.get(text_url)
  57.                 else:
  58.                     pass
  59.             else:
  60.                 pass
  61.         time.sleep(30)
  62. except Exception:
  63.     pass

复制代码

安徽网友:很需要,感谢!
新疆网友:好东西,试试看
浙江网友:30秒太频繁了

我的都设置五分钟 足够了
天津网友:先马克一下

已经用mjj 15秒扫一次的tg了 暂时够用
香港网友:战略马克一下,一直用的TG
吉林网友:好东西哦
吉林网友:实际发现30s确实太频繁了,没那么多新帖子,我设置的两分钟
浙江网友:大佬我没懂,得到key之后

替换一下代码中第34行链接,然后怎么ojbk?
这段代码怎么用啊?
挂到甲骨文Linux 小鸡里运行这个代码吗?
澳门网友:/forum.php?mod=rss&auth=0
黑龙江网友:/forum.php?mod=rss&auth=0
广东网友:
我一般也不用 rss 了,只是偶尔用下命令看看:
curl  -s ‘/forum.php?mod=rss&auth=0’ | awk ‘/<link>/{gsub("[ ]*</?link>[ ]*","");a=$0};/<title>/{gsub("[ ]*</?title>[ ]*","");b=$0};/<\/item>/{print a"\t"b;a=b=""}’ IGNORECASE=1 a=b=""

所以我不清楚 RSS 阅读器的情况

未经允许不得转载:美国VPS_搬瓦工CN2 GIA VPS » 论坛帖子推送到微信

赞 (0) 打赏

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏