0xSeanll / LatiaoAid

Collect 辣条 on live.bilibili.com using selenium.
Apache License 2.0
3 stars 2 forks source link

Unable to load the tab #1

Closed loopyme closed 4 years ago

loopyme commented 4 years ago

Good work!

However, I encountered an error when I test it on my pc, not sure if it's due to the wrong way of using it.

Traceback

It seems that some thing obscures the clear screen button. Retry in 10 seconds.
It seems that some thing obscures the clear screen button. Retry in 10 seconds.
It seems that some thing obscures the clear screen button. Retry in 10 seconds.
Traceback (most recent call last):
  File "LatiaoAid.py", line 131, in <module>
    LatiaoAid().main()
  File "LatiaoAid.py", line 101, in main
    while element.text != '点击领奖':
  File "/home/x/Documents/py-env/misc/lib/python3.6/site-packages/selenium/webdriver/remote/webelement.py", line 76, in text
    return self._execute(Command.GET_ELEMENT_TEXT)['value']
  File "/home/x/Documents/py-env/misc/lib/python3.6/site-packages/selenium/webdriver/remote/webelement.py", line 633, in _execute
    return self._parent.execute(command, params)
  File "/home/x/Documents/py-env/misc/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/x/Documents/py-env/misc/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchWindowException: Message: Browsing context has been discarded

The is no live video in firefox window. (I open the same room for comparison with chrome after the problem occurred)

Screenshot-20200427165420-1439x899

I use selenium==3.141.0, geckodriver == 0.26.0.

I will be much appreciate if someone can help me with this issue.

0xSeanll commented 4 years ago

Hi @loopyme .

The output said, "It seems that some thing obscures the clear screen button. Retry in 10 seconds". This means selenium webdriver is unable to click clear screen button (清除弹幕) because other components are on the top of it. The only solution is to manually clear those obstacle by now.

About the exception, it will be thrown when driver is on a tab that does not exist. Probably because you close the tab manually and driver cannot find it.

The 403 error is purely a network problem. Refreshing the page should fix it.

Also, the new version is out. Feel free to try it out and issues are welcomed.

loopyme commented 4 years ago

Thanks @0xSeanll

However, the script still doesn't work. With the new version, there is no command line output but still unable to get the live video(code:403 I double check the network status and it doesn't seem like a network problem).

Besides, The script does not collect LaTiao when it's actually ready. I tried to collect the LaTiao manually but Billlbill ask me to fill in a verification code first.

I worried it's Billlbill's anti-robot system that cause this issue.

0xSeanll commented 4 years ago

Hi, @loopyme .

Just tried on my Windows machine, and everything works just fine.

The 403 status code means that the server refuses the requests from the client, so it should not be the problem of the script itself or geckodriver. You will see command line output when you succeeded in collecting 辣条.

The verification code never showed up with my account. This may relate to the client policy of bilibili.com and so do the 403 error.