Git Product home page Git Product logo

pchome-api's Issues

第三方支付的可能性

將使用者的信用卡資訊儲存起來似乎不太對
要在程式邏輯上替使用者完成"信用卡"付款的流程似乎也不符合安全考量
所以想詢問,這隻程式,是否有可能可以支援其他的第三方支付
例如LINE PAY 或街口支付等等...替使用者完成結帳前的所有流程,最後在跳出付款頁面讓使用者進行掃條碼結帳

如何解決 OrderSubmit 後得到 recaptcha 0003 or recaptcha 0005 的問題?

hi @ALiangLiang ,

不確定這個 repo 是否還在維護,最近發現這個 repo 並且試了一下,成功率大概30%,高機率被下單限制或是中 recaptcha。
下單限制可以靠 sleep 解決,想請問您是怎麼解決 recaptcha 的問題呢?
以下是中 reCaptcha 的 response

{
  "status": "ERR",
  "code": 329,
  "msg": "recaptcha 0003",
  "line": 97,
  "act": "L",
  "url": "https://ecssl.pchome.com.tw/sys/cflow/fsindex/errPage/329",
  "usePostMsg": "N"
}
{
  "status": "ERR",
  "code": 666,
  "msg": "recaptcha 0005",
  "line": 112,
  "act": "",
  "usePostMsg": "N"
}

送出訂單後的錯誤

沒動到api
只修改了config.json
成功加入購物車以後就跳出錯誤

C:\Users\MengYi\Desktop\test\pchome-api-master>node example.js
免運費
可貨到付款
TypeError: Cannot read property 'PK' of undefined
at API.order (C:\Users\MengYi\Desktop\test\pchome-api-master\api\order.js:14:34)
at async main (C:\Users\MengYi\Desktop\test\pchome-api-master\example.js:36:18)
TypeError: Cannot read property 'status' of undefined
at main (C:\Users\MengYi\Desktop\test\pchome-api-master\example.js:47:14)

order.js 中 'res.PK' 未定義問題

您好 :

剛才試著自己執行修改過後的example.js
結果出現以下的錯誤訊息:

TypeError: Cannot read property 'PK' of undefined
at API.order (...\api\order.js:14:34)
at async main (...\example.js:39:18)

在\api\order.js 中Line 8 的 res 沒有定義 'PK'
但是Line 14 要求存取 res.PK
請問這裡的'PK'值是作為什麼用途以及如何取得 ?

謝謝

關於 送出訂單 錯誤

最近在使用時 商品能夠正確加入購物車

但是在送出訂單都會出現錯誤代碼 以至於不會直接結帳完成(確定有貨到付款 免運費 等等的條件)

TypeError: Cannot read property 'PK' of undefined
at API.order (/mnt/d/user profile/Steins.Lin/Downloads/pchome-api-master/pchome-api-master/api/order.js:14:34)
at TypeError: Cannot read property 'status' of undefined
at main (/mnt/d/user profile/Steins.Lin/Downloads/pchome-api-master/pchome-api-master/example.js:33:14)
at

想請問 突然的變化是哪裡我設定錯誤了嗎

StatusCodeError: 400

我在信件中提出的問題有解決了 是我誤改了url
但是node example.js 後並沒有把測試商品加入購物車
目前我只修改了 ./config/config.json 裡面的ECC、ECWEBSESS、prodID
我不太清楚./api/add2Cart裡面的referer 有沒有需要特別修改

以下是log

:~/Desktop/pchome-api-master$ node example.js
StatusCodeError: 400 - ""
at new StatusCodeError (/home/john/Desktop/pchome-api-master/node_modules/request-promise-core/lib/errors.js:32:15)
at Request.plumbing.callback (/home/john/Desktop/pchome-api-master/node_modules/request-promise-core/lib/plumbing.js:104:33)
at Request.RP$callback [as _callback] (/home/john/Desktop/pchome-api-master/node_modules/request-promise-core/lib/plumbing.js:46:31)
at Request.self.callback (/home/john/Desktop/pchome-api-master/node_modules/request/request.js:185:22)
at Request.emit (events.js:315:20)
at Request. (/home/john/Desktop/pchome-api-master/node_modules/request/request.js:1154:10)
at Request.emit (events.js:315:20)
at IncomingMessage. (/home/john/Desktop/pchome-api-master/node_modules/request/request.js:1076:12)
at Object.onceWrapper (events.js:421:28)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1221:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
statusCode: 400,
error: '',
options: {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'
},
jar: RequestJar { _jar: [CookieJar] },
url: 'https://24h.pchome.com.tw/prod/cart/v1/prod/DEAMD4-A900AO141/snapup?_callback=jsonp_cartsnapup&_=1591242410265',
method: 'GET',
callback: [Function: RP$callback],
transform: undefined,
simple: true,
resolveWithFullResponse: false,
transform2xxOnly: false
},
response: IncomingMessage {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
emitClose: true,
autoDestroy: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: true,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
readable: false,
_events: [Object: null prototype] {
end: [Array],
close: [Array],
data: [Function],
error: [Function]
},
_eventsCount: 4,
_maxListeners: undefined,
socket: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: true,
_SNICallback: null,
servername: '24h.pchome.com.tw',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 10,
connecting: false,
_hadError: false,
_parent: null,
_host: '24h.pchome.com.tw',
_readableState: [ReadableState],
readable: false,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [ClientRequest],
write: [Function: writeAfterFIN],
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(asyncId)]: 6,
[Symbol(kHandle)]: null,
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 166,
[Symbol(kBytesWritten)]: 482,
[Symbol(connect-options)]: [Object]
},
connection: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: true,
_SNICallback: null,
servername: '24h.pchome.com.tw',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 10,
connecting: false,
_hadError: false,
_parent: null,
_host: '24h.pchome.com.tw',
_readableState: [ReadableState],
readable: false,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [ClientRequest],
write: [Function: writeAfterFIN],
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(asyncId)]: 6,
[Symbol(kHandle)]: null,
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 166,
[Symbol(kBytesWritten)]: 482,
[Symbol(connect-options)]: [Object]
},
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers: {
server: 'nginx',
date: 'Thu, 04 Jun 2020 03:46:49 GMT',
'content-type': 'text/html',
'content-length': '0',
connection: 'close',
vary: 'Accept-Encoding'
},
rawHeaders: [
'Server',
'nginx',
'Date',
'Thu, 04 Jun 2020 03:46:49 GMT',
'Content-Type',
'text/html',
'Content-Length',
'0',
'Connection',
'close',
'Vary',
'Accept-Encoding'
],
trailers: {},
rawTrailers: [],
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 400,
statusMessage: 'Bad Request',
client: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: true,
_SNICallback: null,
servername: '24h.pchome.com.tw',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 10,
connecting: false,
_hadError: false,
_parent: null,
_host: '24h.pchome.com.tw',
_readableState: [ReadableState],
readable: false,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [ClientRequest],
write: [Function: writeAfterFIN],
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(asyncId)]: 6,
[Symbol(kHandle)]: null,
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 166,
[Symbol(kBytesWritten)]: 482,
[Symbol(connect-options)]: [Object]
},
_consuming: false,
_dumped: false,
req: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [TLSSocket],
connection: [TLSSocket],
_header: 'GET /prod/cart/v1/prod/DEAMD4-A900AO141/snapup?callback=jsonp_cartsnapup&=1591242410265 HTTP/1.1\r\n' +
'Content-Type: application/x-www-form-urlencoded\r\n' +
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36\r\n' +
'host: 24h.pchome.com.tw\r\n' +
'cookie: ECC=a6bcc61e51991fb86b94b440aa9ff16e1d7c077e.1591162227; ECWEBSESS=dd3b91afd2.dd429e69919a504db09bd23fd7b2a75d034604ba.1591162228\r\n' +
'content-length: 0\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'GET',
insecureHTTPParser: undefined,
path: '/prod/cart/v1/prod/DEAMD4-A900AO141/snapup?callback=jsonp_cartsnapup&=1591242410265',
_ended: true,
res: [Circular],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
request: Request {
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
headers: [Object],
method: 'get',
readable: true,
writable: true,
explicitMethod: true,
_qs: [Querystring],
_auth: [Auth],
_oauth: [OAuth],
_multipart: [Multipart],
_redirect: [Redirect],
_tunnel: [Tunnel],
_rp_resolve: [Function],
_rp_reject: [Function],
_rp_promise: [Promise],
_rp_callbackOrig: undefined,
callback: [Function],
_rp_options: [Object],
setHeader: [Function],
hasHeader: [Function],
getHeader: [Function],
removeHeader: [Function],
localAddress: undefined,
pool: {},
dests: [],
__isRequestRequest: true,
_callback: [Function: RP$callback],
uri: [Url],
proxy: null,
tunnel: true,
setHost: true,
originalCookieHeader: undefined,
_jar: [RequestJar],
port: 443,
host: '24h.pchome.com.tw',
path: '/prod/cart/v1/prod/DEAMD4-A900AO141/snapup?callback=jsonp_cartsnapup&=1591242410265',
httpModule: [Object],
agentClass: [Function: Agent],
agent: [Agent],
_started: true,
href: 'https://24h.pchome.com.tw/prod/cart/v1/prod/DEAMD4-A900AO141/snapup?_callback=jsonp_cartsnapup&_=1591242410265',
req: [ClientRequest],
ntick: true,
response: [Circular],
originalHost: '24h.pchome.com.tw',
originalHostHeaderName: 'host',
responseContent: [Circular],
_ended: true,
_callbackCalled: true,
[Symbol(kCapture)]: false
},
toJSON: [Function: responseToJSON],
caseless: Caseless { dict: [Object] },
body: '',
[Symbol(kCapture)]: false
}
}

不好意思麻煩了

About api

請問目前這隻API還可以使用嗎?
因為感覺PCHOME API好像有些不能在使用了?
目前在剛研究Node js剛好需要用到PCHOME結帳
因此想順便問可以簡單說明一下使用方式嗎
剩下我在自己摸索看看
謝謝

下單遇到recaptcha問題

您好,目前嘗試送出order訂單時會遇到recaptcha 0000回應失敗,
有嘗試搭配其他recaptcha token生成器使用key跟domain去生成,
先送到https://ecssl.pchome.com.tw/sys/cflow/fsapi/getPK,
並加入到表單內frmData.recaptchaTK再去加密,
但並未順利送出訂單,變成遇到recaptcha 0003回應失敗,
不知道是否有哪個地方遺漏造成問題,謝謝。

error code 325

測試了幾張單之後,現在送單會出現error
{"status":"ERR","code":325,"msg":"下單限制","act":"L","url":"https:\/\/ecssl.pchome.com.tw\/sys\/cflow\/fsindex\/errPage\/325","usePostMsg":"N"}'

作者大大有遇到這個問題嗎?是否是今日送單量已經過多?或者該檢查什麼參數?

此API的python版本

版大您好,感謝您的程式碼,不知是否方便提供您所提到的Python 版本的API,我正在嘗試用python做pchome的auto buy bot,但碰到一些瓶頸,希望可以參考您的python程式碼做學習,謝謝!

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.