Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wx.qq.com detect phantomjs and disabled it #21

Closed
huan opened this issue Aug 18, 2016 · 13 comments
Closed

wx.qq.com detect phantomjs and disabled it #21

huan opened this issue Aug 18, 2016 · 13 comments
Labels

Comments

@huan
Copy link
Member

huan commented Aug 18, 2016

Update 2016-9-1

Phantomjs work well now, without any modification at wechaty side.

It seems like js code in wx upgraded again, and the accident that disable phantomjs is not the purpose (more like a compatible bug of checksum code run in phantomjs).


before fix, you can switch to chrome instead of phantomjs to use wechaty as usual.

$ WECHATY_HEAD=chrome node example/ding-dong-bot.js

detail:

https://res.wx.qq.com/zh_CN/htmledition/v2/js/webwxApp2fd632.js

    try {
        var p = angular.bootstrap.toString().replace(/\n"use strict";\n/, "")
          , h = m(p);
        "54c6b762ad3618c9ebfd4b439c8d4bda" !== h && ($.getScript("https://tajs.qq.com/stats?sId=54802481"),
        location.href = "https://wx.qq.com/?t=v2/fake")
    } catch (M) {}
    angular.bootstrap(document, ["webwxApp"])

https://wx.qq.com/?t=v2/fake

See Also

@huan huan added the bug label Aug 18, 2016
@JasLin
Copy link
Contributor

JasLin commented Aug 21, 2016

run with chrome may require a GUI environment, can i just change useragent of phantomjs to workaround this issue?

@huan
Copy link
Member Author

huan commented Aug 21, 2016

it seems u use node version under v6.

what node version do u have? if under v6 pls upgrade to v6 and have another
try.

and yes, use chrome as head need xvfb under linux. pls see
bin/install-chrome-linux.sh to know how to use it.

please feel free to let me know if u need more help.

Zhuohuan LI - 發自我的小霸王學習機

On Aug 21, 2016 18:23, "Jas" [email protected] wrote:

errors with:

/home/xxx/projects/learning/wechat/wechaty2/example/ding-dong-bot.js:35
.on('scan', ({url, code}) => {
^

SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:387:25)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:141:18)
at node.js:933:3


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#21 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABTH4xQOsZpzbOc_xWzSL4WIDF3hq6R7ks5qiCcZgaJpZM4JnzSg
.

@JasLin
Copy link
Contributor

JasLin commented Aug 21, 2016

yes, i forgot to change node version back to v6.

@huan
Copy link
Member Author

huan commented Aug 21, 2016

change user agent maybe help, but i did not try yet.

if u can make it work, pull request is welcome. :)

@JasLin
Copy link
Contributor

JasLin commented Aug 22, 2016

trying to change useragent of phantomjs , it dose't work

const customPhantom = WebDriver.Capabilities.phantomjs()
    .setAlertBehavior('ignore')
    .set('phantomjs.binary.path', phantomjsExe)
    .set('phantomjs.cli.args', phantomjsArgs)
    .set('phantomjs.page.settings.userAgent', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/51.0.2704.79 Chrome/51.0.2704.79 Safari/537.36')

@JasLin
Copy link
Contributor

JasLin commented Aug 22, 2016

it' seems bin/install-chrome-linux.sh is not work to docker environment.

info Wechaty v0.3.9 initializing...
ERR! PuppetWebBrowser open() exception: Server terminated early with status 127
WARN PuppetWebBrowser dead() because Server terminated early with status 127
ERR! PuppetWeb initBrowser() exception: Server terminated early with status 127
ERR! PuppetWeb init exception: Server terminated early with status 127
ERR! Wechaty init() exception: Server terminated early with status 127
ERR! Bot Error: Server terminated early with status 127
ERR! Bot     at Error (native)
ERR! Bot     at /node_modules/.npminstall/selenium-webdriver/3.0.0-beta-2/selenium-webdriver/remote/index.js:243:22
ERR! Bot     at process._tickCallback (internal/process/next_tick.js:103:7)
ERR! Bot From: Task: WebDriver.createSession()
...

@huan
Copy link
Member Author

huan commented Aug 22, 2016

yes, docker has issue after switched to chrome. Will fix it later.

@huan
Copy link
Member Author

huan commented Sep 1, 2016

@JasLin docker worked. it based on xvfb & chromium solution.

see details here: https://github.com/wechaty/wechaty/blob/d2bf393d1b2018fceab00664f7b6b220ecbfe79e/bin/xvfb-chromium

@huan
Copy link
Member Author

huan commented Sep 1, 2016

back to phantomjs

@huan
Copy link
Member Author

huan commented Sep 2, 2016

back to chrome because #28

@huan huan closed this as completed Sep 2, 2016
@JasLin
Copy link
Contributor

JasLin commented Sep 9, 2016

chrome is more stable:)

@huan
Copy link
Member Author

huan commented Sep 9, 2016

maybe is just another bug in inject code.

phantomjs is better when you run wechaty on your desktop, like electron...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants