Giter Club home page Giter Club logo

crawler_shopee's Introduction

Shopee coin getter

CI status

Shopee coin getter is a script to collect daily shopee coins.

alt text

dependencies

python==3.6
selenium==3.8.0

Installation

Docker

Getting Started

git clone https://github.com/charlie0227/crawler_shopee.git
cd crawler_shopee
cp env.py.sample env.py 

Filled in your username and password in env.py

text_username = "<your shopee username>" 
text_password = "<your shopee password>"
cookie_name = "cookie.pkl"

Usage

Simply run command

docker run -it --rm -v <your-path>/crawler_shopee:/code charlie27/python36-selenium-chromedriver sh -c "python main.py"

Or build by yourself

docker build -t shopee:latest .
docker run -it --rm -v <your-path>/crawler_shopee:/code shopee sh -c "python main.py"

You'll need to enter SMS authenticate first time if used password to login

alt text

Please Enter SMS code in 60 seconds: 

crontab

0 0 * * * /usr/bin/docker run --rm -v <your-path>/crawler_shopee:/code shopee sh -c "python main.py" >/dev/null

Running the tests

Explain how to run the unit test

docker run -it --rm -v .:/code charlie27/python36-selenium-chromedriver sh -c "python unit_test.py"

Method

checkPopModal()

Auto close the advertisement modal shopee show first time

checkLogin()

check is login or not

loginByCookie()

First, check your cookie is able to login, if success goto clickCoin

loginByPass()

Second, use your account and password to login

checkSMS()

Third, if you login by password first time, you'll need to pass SMS authenticate.

clickCoin()

Last, goto https://shopee.tw/shopee-coins-internal/?scenario=1 to own your shopee daily coin after login.

License

MIT

crawler_shopee's People

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

Watchers

 avatar  avatar  avatar  avatar

crawler_shopee's Issues

Login Failed

Init driver done.
[INFO] pop modal not found
[INFO] cookie.pkl not found
[INFO] Login Failed
[ERROR] Login Modal not showingWebDriverException('unknown error: Element

  • ...
  • is not clickable at point (1182, 17). Other element would receive the click:
    \n (Session info: headless chrome=71.0.3578.98)\n (Driver info: chromedriver=2.45.615279 (12b89733300bd268cff3b78fc76cb8f3a7cc44e5),platform=Linux 4.9.184-linuxkit x86_64)', None, None)
    Traceback (most recent call last):
    File "main.py", line 85, in loginByPass
    login_button = self.driver.find_elements_by_css_selector(".navbar__link--account")[1].click()
    File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webelement.py", line 80, in click
    self._execute(Command.CLICK_ELEMENT)
    File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webelement.py", line 501, in _execute
    return self._parent.execute(command, params)
    File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 311, in execute
    self.error_handler.check_response(response)
    File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 237, in check_response
    raise exception_class(message, screen, stacktrace)
    selenium.common.exceptions.WebDriverException: Message: unknown error: Element
  • ...
  • is not clickable at point (1182, 17). Other element would receive the click:

    (Session info: headless chrome=71.0.3578.98)
    (Driver info: chromedriver=2.45.615279 (12b89733300bd268cff3b78fc76cb8f3a7cc44e5),platform=Linux 4.9.184-linuxkit x86_64)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "main.py", line 165, in
    a.loginByPass()
    File "main.py", line 89, in loginByPass
    self.exit()
    AttributeError: 'Crawler' object has no attribute 'exit'

    Will this works on shopee.com.my ?

    I tried changing the url to shopee.com.my and this is the error:

    [main.py:138 -        checkPopModal() ] 2020-09-14 10:12:55,390 root         INFO     pop modal not found
    [main.py:153 -        loginByCookie() ] 2020-09-14 10:12:57,155 root         INFO     Use cookie.pkl to login
    [main.py:146 -           checkLogin() ] 2020-09-14 10:13:02,575 root         INFO     Login Failed
    [main.py:164 -          loginByPass() ] 2020-09-14 10:13:03,648 root         ERROR    Login Modal not showingElementClickInterceptedException('element click intercepted: Element <a class="navbar__link navbar__link--account navbar__link--tappable navbar__link--hoverable navbar__link-text navbar__link-text--medium" href="/buyer/login?next=https%253A%252F%252Fshopee.com.my%252F">...</a> is not clickable at point (1174, 17). Other element would receive the click: <div class="shopee-popup__overlay"></div>\n  (Session info: headless chrome=85.0.4183.102)', None, None)
    [main.py:256 -                close() ] 2020-09-14 10:13:03,763 root         INFO     Program exit
    

    My suspect is that when you open https://shopee.com.my for the first time, it prompts a new modal that asks users to choose a language and the modal is blocking it from clicking the login button.

    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.