davidteather / TikTok-Api

The Unofficial TikTok API Wrapper In Python
https://davidteather.github.io/TikTok-Api
MIT License
4.69k stars 952 forks source link

AttributeError: 'browser' object has no attribute... #216

Closed Bro3x closed 4 years ago

Bro3x commented 4 years ago

Can not run the application:

File "/usr/local/lib/python3.8/dist-packages/TikTokApi/tiktok.py", line 24, in init self.timezone_name = self.format_new_params(b.timezone_name)

AttributeError: 'browser' object has no attribute 'timezone_name' nor the following attributes.

Ubuntu 20 TikTokApi-3.4.0 Python 3.8.2

Requirement already satisfied: pyppeteer in /usr/local/lib/python3.8/dist-packages (from TikTokApi) (0.2.2) Requirement already satisfied: selenium in /usr/local/lib/python3.8/dist-packages (from TikTokApi) (3.141.0) Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from TikTokApi) (2.22.0) Requirement already satisfied: urllib3<2.0.0,>=1.25.8 in /usr/lib/python3/dist-packages (from pyppeteer->TikTokApi) (1.25.8) Requirement already satisfied: appdirs<2.0.0,>=1.4.3 in /usr/local/lib/python3.8/dist-packages (from pyppeteer->TikTokApi) (1.4.4) Requirement already satisfied: pyee<8.0.0,>=7.0.1 in /usr/local/lib/python3.8/dist-packages (from pyppeteer->TikTokApi) (7.0.2) Requirement already satisfied: tqdm<5.0.0,>=4.42.1 in /usr/local/lib/python3.8/dist-packages (from pyppeteer->TikTokApi) (4.48.2) Requirement already satisfied: websockets<9.0,>=8.1 in /usr/local/lib/python3.8/dist-packages (from pyppeteer->TikTokApi) (8.1)

issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.80. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

AlexVerrico commented 4 years ago

Hi @Bro3x I had the same problem, a temporary fix is to roll back to version 3.3.9 by running pip3 uninstall tiktokapi then pip3 install TikTokApi==3.3.9 Cheers, Alex.

davidteather commented 4 years ago

hopefully should be fixed by this release

Bro3x commented 4 years ago

Sorry, but the error is still there in 3.4.1 I tried 3.3.9 but got the "Browser closed unexpectedly" error. (all fixes from #95 applied)

rainsummer613 commented 4 years ago

I have the same problem in 3.4.1: 'browser' object has no attribute 'timezone_name'

AlexVerrico commented 4 years ago

Not sure if this affects it, but I also installed chromium-driver: https://github.com/davidteather/TikTok-Api/issues/95#issuecomment-673789306 And now it's running fine

Bro3x commented 4 years ago

@AlexVerrico No effect here:

apt install chromium-driver
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'chromium-chromedriver' instead of 'chromium-driver'
chromium-chromedriver is already the newest version (83.0.4103.97-0ubuntu0.20.04.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
AlexVerrico commented 4 years ago

@Bro3x Not sure if it makes a difference, but I'm running python 3.7 not 3.8

Bro3x commented 4 years ago

@AlexVerrico Tried 3.7.0 and 3.7.3 with no effect:

File "/root/.pyenv/versions/3.7.0/lib/python3.7/site-packages/TikTokApi/tiktok.py", line 24, in __init__                  self.timezone_name = self.__format_new_params__(b.timezone_name)
AttributeError: 'browser' object has no attribute 'timezone_name'
Incher25 commented 4 years ago

I have the same problem sometimes (using python 3.6)

dnzg commented 4 years ago

Update didn't help :(

davidteather commented 4 years ago

I just made some changes to the nightly branch can you download the code and run setup.py and tell me if that fixes your issue?

dnzg commented 4 years ago

I just made some changes to the nightly branch can you download the code and run setup.py and tell me if that fixes your issue?

This is what I get

Снимок экрана 2020-08-19 в 22 55 00
hoylemd commented 4 years ago

Also happening on python 3.8.3 (which probably surprises noone). On mac, haven't installed chromium or anything separately.

Will also try the nightly branch.

update: nightly branch works for me! Can do

>>> from TikTokApi import TikTokApi
>>> api = TikTokApi()
[W:pyppeteer.chromium_downloader] start chromium download.
Download may take a few minutes.

But when I try to actually do soemthing:

>>> results = 10
>>>
>>> trending = api.trending(count=results)
[W:pyppeteer.chromium_downloader] start chromium download.
Download may take a few minutes.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/michaelhoyle/miniconda3/envs/pixacollect2/lib/python3.8/site-packages/TikTokApi/tiktok.py", line 114, in trending
    res = self.getData(api_url, b, proxy=proxy)
  File "/Users/michaelhoyle/miniconda3/envs/pixacollect2/lib/python3.8/site-packages/TikTokApi/tiktok.py", line 55, in getData
    "&verifyFp=" + b.verifyFp + \
AttributeError: 'browser' object has no attribute 'verifyFp'

So that's another missing attribute? Control is returned to the python shell pretty much immediately after it prints the 'downloading chromium' message, so maybe it's not acquiring the browser properly?

vitsh1974 commented 4 years ago

also have bug


Python 3.8.2 (default, Jul 16 2020, 14:00:26) ubuntu 20 x 64


[W:pyppeteer.chromium_downloader] chromium download done. Traceback (most recent call last): File "tt.py", line 6, in trending = api.trending(count=results) File "/home/bdmin/.local/lib/python3.8/site-packages/TikTokApi/tiktok.py", line 114, in trending res = self.getData(api_url, b, proxy=proxy) File "/home/bdmin/.local/lib/python3.8/site-packages/TikTokApi/tiktok.py", line 55, in getData "&verifyFp=" + b.verifyFp + \ AttributeError: 'browser' object has no attribute 'verifyFp'

hoylemd commented 4 years ago

@vitsh1974 Try doing this

I had similar problems and it solved them for me.

Incher25 commented 4 years ago

Still have an error in v3.4.3 (Ubuntu 18.04 (Vagrant), python3.6):

Traceback (most recent call last): File "../python/scripts/TikTok/get_tiktok_by_id.py", line 5, in api = TikTokApi() File "/home/vagrant/python_virt_env/lib/python3.6/site-packages/TikTokApi/tiktok.py", line 24, in init self.timezone_name = self.format_new_params(b.timezone_name) AttributeError: 'browser' object has no attribute 'timezone_name' Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/home/vagrant/python_virt_env/lib/python3.6/site-packages/pyppeteer/launcher.py", line 151, in _close_process self._loop.run_until_complete(self.killChrome()) File "/usr/lib/python3.6/asyncio/base_events.py", line 460, in run_until_complete self._check_closed() File "/usr/lib/python3.6/asyncio/base_events.py", line 377, in _check_closed raise RuntimeError('Event loop is closed') RuntimeError: Event loop is closed sys:1: RuntimeWarning: coroutine 'Launcher.killChrome' was never awaited

vitsh1974 commented 4 years ago

i'm run ++++++++++++++++++++++ from pyppeteer.launcher import Launcher print(' '.join(Launcher().cmd)) # prints the command used to launch pyppeteer ++++++++++++++++++++++ bdmin@ubuntu:~/Desktop/tt$ python3 tt.py [W:pyppeteer.chromium_downloader] start chromium download. Download may take a few minutes. 100%|█████████████████████████████████████████████████████████████████████████████████████████| 193/193 [00:00<00:00, 607277.32it/s] [W:pyppeteer.chromium_downloader] chromium download done. Traceback (most recent call last): File "tt.py", line 2, in print(' '.join(Launcher().cmd)) # prints the command used to launch pyppeteer File "/home/bdmin/.local/lib/python3.8/site-packages/pyppeteer/launcher.py", line 119, in init download_chromium() File "/home/bdmin/.local/lib/python3.8/site-packages/pyppeteer/chromium_downloader.py", line 146, in download_chromium extract_zip(download_zip(get_url()), DOWNLOADS_FOLDER / REVISION) File "/home/bdmin/.local/lib/python3.8/site-packages/pyppeteer/chromium_downloader.py", line 134, in extract_zip with ZipFile(data) as zf: File "/usr/lib/python3.8/zipfile.py", line 1269, in init self._RealGetContents() File "/usr/lib/python3.8/zipfile.py", line 1336, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file bdmin@ubuntu:~/Desktop/tt$


dmin@ubuntu:~/Desktop/tt$ chromedriver -v ChromeDriver 84.0.4147.105 (a6b12dfad6663f13a7e16e9a42a6a4975374096b-refs/branch-heads/4147@{#943}) bdmin@ubuntu:~/Desktop/tt$