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

fix: can't get the CSRF token #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zephyrxvxx7
Copy link

@zephyrxvxx7 zephyrxvxx7 commented Feb 20, 2022

Root cause:
Use the search API can't get CSRF.
It will raise the below error:

yarn run v1.22.10
$ node app.js
/Users/zephyr/Documents/Coding/dummy/rentHouse/lib/getToken.js:9
  const csrfToken = regExp.exec(response.body)[1];
                                              ^

TypeError: Cannot read properties of null (reading '1')
    at module.exports (/Users/zephyr/Documents/Coding/dummy/rentHouse/lib/getToken.js:9:47)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async module.exports (/Users/zephyr/Documents/Coding/dummy/rentHouse/lib/getFirstPostId.js:6:22)
    at async /Users/zephyr/Documents/Coding/dummy/rentHouse/app.js:11:22

Node.js v17.5.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Solution: change the fetching site to the 591 index URL.

Root cause:
Use the research API can't get CSRF.
It will raise the below error:
```
yarn run v1.22.10
$ node app.js
/Users/zephyr/Documents/Coding/dummy/rentHouse/lib/getToken.js:9
  const csrfToken = regExp.exec(response.body)[1];
                                              ^

TypeError: Cannot read properties of null (reading '1')
    at module.exports (/Users/zephyr/Documents/Coding/dummy/rentHouse/lib/getToken.js:9:47)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async module.exports (/Users/zephyr/Documents/Coding/dummy/rentHouse/lib/getFirstPostId.js:6:22)
    at async /Users/zephyr/Documents/Coding/dummy/rentHouse/app.js:11:22

Node.js v17.5.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```

Solution: change the fetching site to the 591 index URL.
@allenzhang3305
Copy link

allenzhang3305 commented Feb 27, 2023

@aiyu666 您好~大師🤣
想請問,我照步驟操作,出現以下訊息。

Z:\rentHouse-master>node app.js
Z:\rentHouse-master\lib\getFirstPostId.js:22
  console.log(resp.body.data.data[0].post_id);
                                     ^

TypeError: Cannot read properties of undefined (reading 'post_id')
    at module.exports (Z:\rentHouse-master\lib\getFirstPostId.js:22:38)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Z:\rentHouse-master\app.js:11:22

Node.js v18.14.2

請問我這是什麼問題呢? 謝謝🙏🏻

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

Successfully merging this pull request may close these issues.

None yet

2 participants