Coder Social home page Coder Social logo

wx_taobao_fanli's Introduction

wx_taobao_fanli

微信 淘宝 返利


20190321 更新

修复了因为淘宝改版带来的修改。 先在电脑登录阿里旺旺,再运行脚本。脚本会调用ie插件来快捷登录淘宝联盟,并自动保存cookie到cookies_taobao.txt文件中。



20180630 更新

因为淘宝改版,扫码登录这块暂时不能用了,现在的做法是在网页上登录淘宝联盟,然后把cookie放在cookies_taobao.txt文件中。淘宝联盟地址:https://pub.alimama.com/。cookie如下图所示:



20171030 更新

兼容python3


这个一个微信淘宝返利"机器人",登录以后,匹配到淘宝口令会自动生成可以返利的淘宝口令。

功能上主要有两部分:

微信

网上有现成的,非常感谢 ItChat

淘宝

在网上没搜到,自己抓包实现了。大概的过程是:

1、登录阿里妈妈
2、根据url搜索相关的商品
3、生成返利的商品口令

依赖

requests
itchat

使用

#####docker运行 项目根目录下执行

# 编译镜像
docker build -t xsren/wx_tb_fanli .
# 运行容器
docker run -ti xsren/wx_tb_fanli

也可以直接拉取我的镜像

 docker pull xsren/wx_tb_fanli

#####命令行运行

python main.py

第一次运行会扫两次码,第一个码是淘宝的码,用于登录淘宝,第二个是微信的码,用于登录微信。 需要注意的是淘宝账号必须认证才能使用淘宝联盟。

效果图

TODO:

  • [] GUI
  • [] 更好的错误反馈
  • [] 可配置

欢迎大家提issue

wx_taobao_fanli's People

Contributors

imyip avatar xsren avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wx_taobao_fanli's Issues

get_real_url出现404

单独用requests.get()分享中的链接时能正常返回res.url和res.text
但是设置好cookie并运行程序时,在get_real_url后,返回的是404页面?
Uploading Snip20181122_3.png…

订单跟踪需求

对于这个需求有什么思路吗?就是知道是哪个微信用户买了哪件商品。

偶尔出现死循环

【美珍香旗舰店】,复制这条信息¥PEEq0UBjo3q¥后打开👉手机淘宝👈
wechatimg143

您好,登陆一直失败,是为什么呢?

您好,登陆一直失败,是为什么呢?感觉是返回的token有问题。
{'data': None, 'info': {'message': 'nologin', 'ok': False}, 'ok': False, 'invalidKey': None}
2018-04-05 09:28:00,192 find_order_for_user[line:246] [DEBUG]: 'NoneType' object is not subscriptable
2018-04-05 09:29:00,193 get_order_list[line:325] [DEBUG]: http://pub.alimama.com/report/getTbkPaymentDetails.json?startTime=2018-03-21&endTime=2018-04-05&payStatus=&queryType=1&toPage=1&perPageSize=9999&total=&t=1515416127365&pvid=&_tb_token_=None&_input_charset=utf-8

回复淘宝联盟生成的淘口令

没有优惠券的情况下淘宝联盟也会给一个淘口令,可以赚取推广费,这种情况下能不能回复淘宝联盟生成的淘口令

特定商品出现的可复现error

在进行测试的时候,出现一例可复现 error,对其他功能没有影响,但是会阻塞后续消息的处理。

出现 error 的淘口令为:

【森马风衣男士简约风景印花休闲中长款外套学生韩版潮】http://v.wzd0.com/h.DRVIuL 点击链接,再选择浏览器打开;或复制这条信息¥YrFL07W19G6¥后打开👉手淘👈

在查询这个淘口令对应的联盟信息时,terminal 被以下错误警报,错误信息为

2017-11-21 10:49:10,972 get_real_url[line:411] [DEBUG]: https://err.taobao.com/error1.html?c=404&u=https://www.taobao.com/error1.html&r=,502,[]

上述错误信息大概20ms 提示一次,阻塞了终端。
不知道是不是转链过程中出现的 bug?

由于能力有限,只能提供这些信息,暂时不能提供 bug 原因。repo 主有兴趣的话可以使用上方淘口令复现一下看看。

是否支持了鹊桥

如题, 自己做的时候鹊桥是个问题。 不知道你这里是否有处理?

docker运行 项目根目录下执行

麻烦问一下 这个编译镜像和运行容器 不能在win下弄么?
我是win下 python3
淘宝联盟可以登陆上
微信也可以扫码登录上了
但是好像没有连上 往微信发淘宝链接没有任何反应
小白求教 谢谢

微信不能登录成功。。

2018-12-07 09:10:09,084 check_login[line:112] [DEBUG]: checking login status.....
2018-12-07 09:10:09,295 login[line:249] [DEBUG]: 淘宝已经登录 不需要再次登录
Getting uuid of QR code.
Downloading QR code.
Traceback (most recent call last):
File "main.py", line 23, in
run()
File "main.py", line 19, in run
wb.run()
File "/app/libs/wx_bot.py", line 155, in run
itchat.auto_login(hotReload=True)
File "/usr/local/lib/python2.7/dist-packages/itchat/components/register.py", line 32, in auto_login
loginCallback=loginCallback, exitCallback=exitCallback)
File "/usr/local/lib/python2.7/dist-packages/itchat/components/login.py", line 49, in login
picDir=picDir, qrCallback=qrCallback)
File "/usr/local/lib/python2.7/dist-packages/itchat/components/login.py", line 123, in get_QR
utils.print_qr(picDir)
File "/usr/local/lib/python2.7/dist-packages/itchat/utils.py", line 83, in print_qr
subprocess.call(['xdg-open', fileDir])
File "/usr/lib/python2.7/subprocess.py", line 523, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 711, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

不知能否根据账号密码来登陆?

把这个程序放在个人服务器上跑,因为服务器属于异地登陆,所以被检测账号异常,扫码总是无法登录,就连浏览器扫码登陆也不行,只能通过账号密码登陆 = =

搜索连接加密

搜索连接加密了,最近想研究一下,有一起的伙伴吗?

登好之后发消息没反应

按您的说明来操作 扫了两个码且登陆成功之后 发送淘口令没反应
Login successfully as 0
Start auto replying.
No uins in 51 message

Tvraceback (most recent call last):
isit_main_url......
File "C:\Users\C\Desktop\1\libs\wx_bot.py", line 32, in check_if_is_tb_link

2017-10-29 11:41:27
print msg.text
UnicodeEncodeError: 'gbk' codec can't encode character u'\ud83d' in position 130
: illegal multibyte sequence
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\itchat\components\register.py", line 60, i
n configured_reply
r = replyFn(msg)
File "C:\Users\C\Desktop\1\libs\wx_bot.py", line 119, in text_reply
check_if_is_tb_link(msg)
File "C:\Users\C\Desktop\1\libs\wx_bot.py", line 111, in check_if_is_tb_lin
k
''' % q
UnboundLocalError: local variable 'q' referenced before assignment

不管什么商品,都回复没有。

--- Logging error ---
Traceback (most recent call last):
  File "C:\Users\54370\Desktop\wx_taobao_fanli-master\libs\wx_bot.py", line 50, in check_if_is_tb_link
    url = re.search(r'http://.* \)', msg.text).group().replace(u' )', '')
AttributeError: 'NoneType' object has no attribute 'group'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\54370\Desktop\wx_taobao_fanli-master\libs\wx_bot.py", line 53, in check_if_is_tb_link
    taokouling = re.search(r'€.*?€', msg.text).group()
AttributeError: 'NoneType' object has no attribute 'group'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\54370\AppData\Local\Programs\Python\Python37\lib\logging\__init__.py", line 1037, in emit
    stream.write(msg + self.terminator)
UnicodeEncodeError: 'gbk' codec can't encode character '\u20ac' in position 644: illegal multibyte sequence
Call stack:
  File "C:\Users\54370\Desktop\wx_taobao_fanli-master\main.py", line 23, in <module>
    run()
  File "C:\Users\54370\Desktop\wx_taobao_fanli-master\main.py", line 19, in run
    wb.run()
  File "C:\Users\54370\Desktop\wx_taobao_fanli-master\libs\wx_bot.py", line 158, in run
    itchat.run(True)
  File "C:\Users\54370\AppData\Local\Programs\Python\Python37\lib\site-packages\itchat\components\register.py", line 99, in run
    reply_fn()
  File "C:\Users\54370\AppData\Local\Programs\Python\Python37\lib\site-packages\itchat\components\register.py", line 91, in reply_fn
    self.configured_reply()
  File "C:\Users\54370\AppData\Local\Programs\Python\Python37\lib\site-packages\itchat\components\register.py", line 60, in configured_reply
    r = replyFn(msg)
  File "C:\Users\54370\Desktop\wx_taobao_fanli-master\libs\wx_bot.py", line 141, in text_reply
    check_if_is_tb_link(msg)
  File "C:\Users\54370\Desktop\wx_taobao_fanli-master\libs\wx_bot.py", line 129, in check_if_is_tb_link
    logger.warning("error:{},trace:{}".format(str(e), trace))
Message: 'error:\'NoneType\' object has no attribute \'group\',trace:Traceback (most recent call last):\n  File "C:\\Users\\54370\\Desktop\\wx_taobao_fanli-master\\libs\\wx_bot.py", line 50, in check_if_is_tb_link\n    url = re.search(r\'http://.* \\)\', msg.text).group().replace(u\' )\', \'\')\nAttributeError: \'NoneType\' object has no attribute \'group\'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File "C:\\Users\\54370\\Desktop\\wx_taobao_fanli-master\\libs\\wx_bot.py", line 53, in check_if_is_tb_link\n    taokouling = re.search(r\'€.*?€\', msg.text).group()\nAttributeError: \'NoneType\' object has no attribute \'group\'\n'
Arguments: ()
�[0;33m2019-01-16 21:44:09,872 check_if_is_tb_link[line:129] [WARNING]: error:'NoneType' object has no attribute 'group',trace:Traceback (most recent call last):
  File "C:\Users\54370\Desktop\wx_taobao_fanli-master\libs\wx_bot.py", line 50, in check_if_is_tb_link
    url = re.search(r'http://.* \)', msg.text).group().replace(u' )', '')
AttributeError: 'NoneType' object has no attribute 'group'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\54370\Desktop\wx_taobao_fanli-master\libs\wx_bot.py", line 53, in check_if_is_tb_link
    taokouling = re.search(r'€.*?€', msg.text).group()
AttributeError: 'NoneType' object has no attribute 'group'
�[0m
Request to send a text message to @96db318c18503aa35b046ebbcbb4027bccfe03ee85a0d1becf2f7816aeaaeffe: 荷叶茶冬瓜荷叶茶叶 纯干玫瑰花茶袋泡花草茶包组合天然决明正品子
-----------------
该宝贝暂时没有找到内部返利通道!亲您可以换个宝贝试试,也可以联系我们群内管理员帮着寻找有返现的类似商品

就是这样,我该怎么办

cookies问题,登录问题

一开始提示"请更新最新的cookie到cookies_taobao.txt文件中!!!"后来发现alimama.py文件获取cookies的文件名不是cookies_taobao,txt,而是cookies.txt.修改后执行python main.py命令后提示如下:
error cookie
Traceback (most recent call last):
File "main.py", line 14, in
from libs.wx_bot import WxBot
File "C:\Users\Yang\Desktop\wx_taobao_fanli-master\libs\wx_bot.py", line 29, in
al = Alimama(logger)
File "C:\Users\Yang\Desktop\wx_taobao_fanli-master\libs\alimama.py", line 45, in init
self.load_cookies()
File "C:\Users\Yang\Desktop\wx_taobao_fanli-master\libs\alimama.py", line 99, in load_cookies
self.set_cookies(c_str)
File "C:\Users\Yang\Desktop\wx_taobao_fanli-master\libs\alimama.py", line 106, in set_cookies
for k,v in cookies.items():
UnboundLocalError: local variable 'cookies' referenced before assignment

无法生成淘口令

__get_tk_link_s1[line:322] [DEBUG]: {"data":{"appList":[],"otherList":[],"otherAdzones":null,"webAdzones":null,"webList":[],"appAdzones":null,"softAdzones":null,"softList":[]},"info":{"message":null,"ok":true},"ok":true,"invalidKey":null}
2018-01-23 16:40:29,202 get_tk_link[line:306] [WARNING]: error:list index out of range,trace:Traceback (most recent call last):

二维码加载出现错误

直接使用你提交的最新docker镜像, docker.io/xsren/wx_tb_fanli, 启动容器后微信二维码无法加载, 出现
'ascii' codec can't encode characters in position 0-10: ordinal not in range(128)
报错

In alimama.py cookies can not get

在 tb_token = self.se.cookies.get('tb_token', domain="pub.alimama.com"),获取不到domain=pub.alimama.com的cookie,在多个windows环境下,无法获取

死循环

当用户的套口令为店铺时,会触发死循环。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.