davidteather / tiktok-api Goto Github PK
View Code? Open in Web Editor NEWThe Unofficial TikTok API Wrapper In Python
Home Page: https://davidteather.github.io/TikTok-Api
License: MIT License
The Unofficial TikTok API Wrapper In Python
Home Page: https://davidteather.github.io/TikTok-Api
License: MIT License
Get this error on console-
New class reference, finding valid signature. This might take a minute.
Traceback (most recent call last):
File "getTrending.py", line 11, in
trending = api.trending(results)
File "C:\Users\Sagar\Downloads\TikTok-Api-master\tiktok.py", line 49, in trend
ing
self.signature
AttributeError: 'TikTokapi' object has no attribute 'signature'
Describe the bug
Traceback (most recent call last):
File ".\getHashtag.py", line 10, in <module>
result = api.search_by_hashtag("xmas")
File "C:\Users\loren\AppData\Local\Programs\Python\Python37\lib\site-packages\TikTokApi\tiktok.py", line 124, in search_by_hashtag
raise Exception("Could not locate hashtag ID: Tried " + str(tries) + " times")
Exception: Could not locate hashtag ID: Tried 10 times
The buggy code
from TikTokApi import TikTokapi
# Starts The Api Class
api = TikTokapi("browsermob-proxy/bin/browsermob-proxy")
# The Number of trending TikToks you want to be displayed
results = 10
# Searches for the top trending hashtag of TikTok
result = api.search_by_hashtag("xmas")
for tiktok in result:
# Prints the text of the tiktok
print(tiktok['itemInfos']['text'])
print(len(result))
api.quit_browser()
Hi @davidteather, I'm a newbie on coding, spending pretty much time a day on learning python. Currently, I have a task to set up an application on my website that would be able to interact with the TikTok users' content. Like a user of my website would enter his/her username and the application displays his/her TikTok posts, then the user, let's say, chooses some of his/her posts and I get links to the posts that the user would have chosen.
So the question is can your TikTok-API help somehow on the task I currently have. And yes, I know this is pretty dummy and is just a pain in the ass but every single help or hint is highly appreciated. Thanks in advance.
Hello,
Just ask can I use this API to follow and to like their 3 last post?
thanks
Describe the bug
I'm getting a certificate error when trying to run the Quickstart.
The buggy code
Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from TikTokApi import TikTokApi
>>> results=10
>>> api=TikTokApi()
>>> trending=api.trending(results)
[W:pyppeteer.chromium_downloader] start chromium download.
Download may take a few minutes.
Traceback (most recent call last):
File "D:\anaconda\lib\site-packages\urllib3\contrib\pyopenssl.py", line 485, in wrap_socket
cnx.do_handshake()
File "D:\anaconda\lib\site-packages\OpenSSL\SSL.py", line 1934, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "D:\anaconda\lib\site-packages\OpenSSL\SSL.py", line 1671, in _raise_ssl_error
_raise_current_error()
File "D:\anaconda\lib\site-packages\OpenSSL\_util.py", line 54, in exception_from_error_queue
raise exception_type(errors)
OpenSSL.SSL.Error: [('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 672, in urlopen
chunked=chunked,
File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 376, in _make_request
self._validate_conn(conn)
File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 994, in _validate_conn
conn.connect()
File "D:\anaconda\lib\site-packages\urllib3\connection.py", line 360, in connect
ssl_context=context,
File "D:\anaconda\lib\site-packages\urllib3\util\ssl_.py", line 370, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "D:\anaconda\lib\site-packages\urllib3\contrib\pyopenssl.py", line 491, in wrap_socket
raise ssl.SSLError("bad handshake: %r" % e)
ssl.SSLError: ("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])",)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\anaconda\lib\site-packages\TikTokApi\tiktok.py", line 62, in trending
b = browser(api_url)
File "D:\anaconda\lib\site-packages\TikTokApi\browser.py", line 27, in __init__
asyncio.get_event_loop().run_until_complete(self.start())
File "D:\anaconda\lib\asyncio\base_events.py", line 583, in run_until_complete
return future.result()
File "D:\anaconda\lib\site-packages\TikTokApi\browser.py", line 30, in start
self.browser = await pyppeteer.launch(self.options)
File "D:\anaconda\lib\site-packages\pyppeteer\launcher.py", line 305, in launch
return await Launcher(options, **kwargs).launch()
File "D:\anaconda\lib\site-packages\pyppeteer\launcher.py", line 119, in __init__
download_chromium()
File "D:\anaconda\lib\site-packages\pyppeteer\chromium_downloader.py", line 146, in download_chromium
extract_zip(download_zip(get_url()), DOWNLOADS_FOLDER / REVISION)
File "D:\anaconda\lib\site-packages\pyppeteer\chromium_downloader.py", line 85, in download_zip
data = http.request('GET', url, preload_content=False)
File "D:\anaconda\lib\site-packages\urllib3\request.py", line 76, in request
method, url, fields=fields, headers=headers, **urlopen_kw
File "D:\anaconda\lib\site-packages\urllib3\request.py", line 97, in request_encode_url
return self.urlopen(method, url, **extra_kw)
File "D:\anaconda\lib\site-packages\urllib3\poolmanager.py", line 330, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 760, in urlopen
**response_kw
File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 760, in urlopen
**response_kw
File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 760, in urlopen
**response_kw
File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "D:\anaconda\lib\site-packages\urllib3\util\retry.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='storage.googleapis.com', port=443): Max retries exceeded with url: /chromium-browser-snapshots/Win_x64/588429/chrome-win32.zip (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])")))
Desktop (please complete the following information):
Trying the following code from the example.
from TikTokApi import TikTokapi
api = TikTokapi("C:\Tfs\Projects\TimeBucksCode\tiktok\browsermob-proxy-2.1.4-bin\browsermob-proxy-2.1.4\bin\browsermob-proxy.bat")
results = 10
userPosts = api.userPosts("khaleelabdullah_")
for tiktok in userPosts:
print(tiktok)
#print(len(trending))
api.quit_browser()
User posts are not loading, probably they have changed something
Currently when I run the trending function, it never returns a status 0. I believe that the signature found via selenium is not a totally valid one, and if you go to the tiktok trending website with a headed browser you can see the videos never really load
I think the issue is still present because when I invoke trending(100) let's say, the len() function of the data it returns never exceeds more than 65-68 videos. Also in line 32, in the if statement the two urls are the same, but one has a space so the signature was never returned. I got it working by setting one of the two links to m.tiktok.com/.... .
Maybe I didn't use the function properly or something?
Hello,
What webdriver you actually used on your api?
if gecko / firefox why I got message when I run : example/getTrending.py,
C:\xampp\htdocs\tiktokpy\examples>python getTrending.py
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specifiedDuring handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "getTrending.py", line 4, in
api = TikTokapi("C:/xampp/htdocs/tiktokpy/browsermob/bin/browsermob-proxy.bat", headless=False)
File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\TikTokApi\tiktok.py", line 53, in init
self.driver = webdriver.Chrome(chrome_options=chromeProfile)
File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in init
self.service.start()
File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
how to resolve this error?
Describe the bug
I installed lib using the command below. but its not getting imported. I am using python3.6 and installed the lib in a virtual env on ubuntu.
pip install TikTokApi
The buggy code
from tiktok import TikTokapi
Expected behavior
ModuleNotFoundError: No module named 'tiktok'
Describe the bug
Followed all your instruction but still getting the following an error
The buggy code
`from TikTokApi import TikTokapi
api = TikTokapi("/Applications/Anaconda/anaconda3/lib/python3.7/site-packages/browsermob-proxy/bin/browsermob-proxy")
results = 10
trending = api.trending(results)
for tiktok in trending:
# Prints the text of the tiktok
print(tiktok['itemInfos']['text'])
print(len(trending))
api.quit_browser()`
Error
`---------------------------------------------------------------------------
ProxyServerError Traceback (most recent call last)
in
2
3 # Starts T
----> 4 api = TikTokapi("/Applications/Anaconda/anaconda3/lib/python3.7/site-packages/browsermob-proxy/bin/browsermob-proxy")
5
6 # The Number of trending TikToks you want to be displayed
/Applications/Anaconda/anaconda3/lib/python3.7/site-packages/TikTokApi/tiktok.py in init(self, browsermobDirectory, headless, manualSignature)
25 path=browsermobDirectory, options=dictf)
26 # "browsermob-proxy/bin/browsermob-proxy"
---> 27 self.server.start()
28 time.sleep(1)
29 self.proxy = self.server.create_proxy()
/Applications/Anaconda/anaconda3/lib/python3.7/site-packages/browsermobproxy/server.py in start(self, options)
125 if count == retry_count:
126 self.stop()
--> 127 raise ProxyServerError("Can't connect to Browsermob-Proxy")
128
129 def stop(self):
ProxyServerError: Can't connect to Browsermob-Proxy`
Desktop (please complete the following information):
Additional context
Downloaded all the files that you recommend including browsermob (and created the right folder) and also geckodriver
Spent hours and still cant get it to work.
Thanks.
I am getting this error when running the API on CentOS 7.
[root@backups tiktok]# python3.6 test.py
New class reference, finding valid signature. This might take a minute.
Traceback (most recent call last):
File "test.py", line 5, in
api = TikTokapi("/root/tiktok/browsermob-proxy-2.1.4/bin/browsermob-proxy")
File "/usr/local/lib/python3.6/site-packages/TikTokApi/tiktok.py", line 26, in init
self.server.start()
File "/usr/local/lib/python3.6/site-packages/browsermobproxy/server.py", line 127, in start
raise ProxyServerError("Can't connect to Browsermob-Proxy")
browsermobproxy.exceptions.ProxyServerError: Can't connect to Browsermob-Proxy
Hey! how to login in tiktok website and get cookies of user
Hi,
How do i use this to find most popular videos for a given hashtag?
Can anyone help me ith a quick script and usage syntax?
thanks so much
I want to write a program that involves getting a tik tok's user's favorite sounds. I was wondering if you could add this feature?
Requesting user's posts do not seem to respond when requesting using api.userPosts(username="username")
buggy code
import requests
import random
import string
import urllib.request
import glob
import os
import mimetypes
from TikTokApi import TikTokapi
api = TikTokapi("browsermob-proxy-2.1.4/bin/browsermob-proxy")
print(api.userPosts(username="levelsofpiano"))
Expected behavior
I would assume a JSON response describing the posts made by the user "levelsofpiano".
Actual behavior
Browser loads user's page, but does not load the user's posts.
Screenshots
Desktop (please complete the following information):
Additional context
No errors are produced on the console. I left it running for a good 20 minutes and got no response, so it's safe to say that the program hangs on this command.
The webdriver gets stuck on any hashtags I search apart from funny. No errors are produced during the process.
Hello,
Would it be possible to implement an API request in order to grab the trending sounds with data associated with that sound? I know the method you have now does not grab the sound due to an incorrect signature. I'm not familiar with the signatures but if there is a new endpoint to get it I can try implementing it into the project.
Can you add Follow/Unfollow functions? Thank you...
Unfortunately on headless Ubuntu 18.04 with Chromium installed only get_song and get_Video_By_Url methods work in headless mode. I am not that fluent with Selenium so I have troubles debugging whats going on. Could you please advise @davidteather?
Thanks!
I've just started using that api, using the function
result = api.search_by_hashtag('simpaticissimi', count=10)
the browser gives me the results about "simpaticissimi" tag, but the code crashed give me into the console that error:
New class reference, finding valid signature. This might take a minute. Found signature, continuing. Traceback (most recent call last): File "botticelliAPI.py", line 7, in <module> result = api.search_by_hashtag('simpaticissimi', count=10) File "/usr/lib/python3.7/site-packages/TikTokApi/tiktok.py", line 193, in search_by_hashtag raise Exception('Unable to locate the hashtag ID') Exception: Unable to locate the hashtag ID
What that meaning?
How to fix it to run the code under the api call?
Hi David,
Thanks for making this! I am however having some issues with importing, I am consistently getting this issue "ImportError: cannot import name 'TikTokApi' from 'TikTokApi' (/usr/local/lib/python3.7/site-packages/TikTokApi/init.py)"
Any idea why?
Thanks for your effort!
For the userpost function, what does "diggcount" refer to? does this mean the number of likes or the number of views on the video?
Describe the bug
Even with the variable results setted, the code can't show more than 10 results
The buggy code
from TikTokApi import TikTokapi
# Starts The Api Class
api = TikTokapi("browsermob-proxy/bin/browsermob-proxy")
# The Number of trending TikToks you want to be displayed
results = 20
# Searches for the top trending hashtag of TikTok
result = api.search_by_hashtag("meme")
for tiktok in result:
# Prints the text of the tiktok
print(tiktok['itemInfos']['text'])
print(len(result))
api.quit_browser()
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
Describe the bug
The request to "https://m.tiktok.com/share/item/list?secUid=&id=&type=5&count=30&minCursor=0&maxCursor=0&shareUid=&_signature=" + self.signature
always results in a 200 code
The buggy code
The trending video call
trending = api.trending(count=30)
url = "https://m.tiktok.com/share/item/list?secUid=&id=&type=5&count=30&minCursor=0&maxCursor=0&shareUid=&_signature=" + self.signature
r = requests.get(url, headers={"method": "GET",
"accept-encoding": "gzip, deflate, br",
"Referer": self.referer,
"user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1"}
)
data = r.json()
response = []
if data["statusCode"] == 0:
# run code
elif data['statusCode'] == 200:
print('error')
Expected behavior
Earlier today, it was working earlier but it suddenly stopped working. Possibly they are rate limiting me based on IP, but I was not sure.
Desktop (please complete the following information):
Describe the bug
Using the simple code example given on your github I tried to run the script, everything works but after opening the link, it does not load the page content. It is stuck on the loading screen
The buggy code
from tiktok import TikTokapi
api = TikTokapi("mypath")
api.trending(10)
Expected behavior
it should load the trending videos but it is stuck on loading screen
Desktop (please complete the following information):
Please let me know if we can somehow make it load the page, I have tried many methods to somehow make it work but still no luck. I hope you can suggest something or update your code here to make it work.
Hello! I was able to get everything working up to this point. When I run gettrending.py the browser window opens and begins to load the page, then I get this error message.
Traceback (most recent call last):
File "gettrending.py", line 11, in
trending = api.trending(results)
File "C:\Users\steee\Anaconda3\envs\tiktok\lib\site-packages\TikTokApi\tiktok.py", line 229, in trending
if count > len(response) and str(data['body']['hasMore']) == "True":
KeyError: 'body'
too heavy.
and no login,like,follow etc.
Does the tiktok-api project get tiktok video link without watermark?
thanks.
Hi. Are you planning on adding API support for sending and receiving messages? Would this even be possible? Thanks for your response.
While making my own version of this I ran into this problem, did you manage to find a solution to this?
Hi David,
Thank you for your fantastic work and could you please give an explanation about how to know if browsermob-proxy, geckodriver and Firefox run together successfully?
any configuration or startup order requirements on them.
C:\Users\Owner.virtualenvs\TikTok-GPkkHXDp\Scripts\python.exe C:/Users/Owner/PycharmProjects/TikTok/examples/getTrending.py
New class reference, finding valid signature. This might take a minute.
Traceback (most recent call last):
File "C:/Users/Owner/PycharmProjects/TikTok/examples/getTrending.py", line 8, in
trending = api.trending(results)
File "C:\Users\Owner.virtualenvs\TikTok-GPkkHXDp\lib\site-packages\TikTokApi\tiktok.py", line 246, in trending
self.signature
AttributeError: 'TikTokapi' object has no attribute 'signature'
Running BrowserMob Proxy using LittleProxy implementation. To revert to the legacy implementation, run the proxy with the command-line option '--use-littleproxy false'.
[INFO 2019-11-04T22:56:28,200 net.lightbody.bmp.proxy.Main] (main) Starting BrowserMob Proxy version 2.1.4
[INFO 2019-11-04T22:56:28,283 org.eclipse.jetty.util.log] (main) jetty-7.x.y-SNAPSHOT
[INFO 2019-11-04T22:56:29,098 org.eclipse.jetty.util.log] (main) started o.e.j.s.ServletContextHandler{/,null}
[INFO 2019-11-04T22:56:29,495 org.eclipse.jetty.util.log] (main) Started [email protected]:8090
[INFO 2019-11-04T22:56:33,616 org.littleshoot.proxy.impl.DefaultHttpProxyServer] (qtp1503660218-21) Starting proxy at address: 0.0.0.0/0.0.0.0:8091
[INFO 2019-11-04T22:56:33,688 org.littleshoot.proxy.impl.DefaultHttpProxyServer] (qtp1503660218-21) Proxy listening with TCP transport
[INFO 2019-11-04T22:56:34,787 org.littleshoot.proxy.impl.DefaultHttpProxyServer] (qtp1503660218-21) Proxy started at address: /0:0:0:0:0:0:0:0:8091
[INFO 2019-11-04T22:56:53,795 org.littleshoot.proxy.impl.ClientToProxyConnection] (LittleProxy-0-ClientToProxyWorker-7) (AWAITING_INITIAL) [id: 0x0d4e71a9, L:/0:0:0:0:0:0:0:1:8091 - R:/0:0:0:0:0:0:0:1:57744]: An IOException occurred on ClientToProxyConnection: An established connection was aborted by the software in your host machine
[INFO 2019-11-04T22:56:55,311 org.littleshoot.proxy.impl.ClientToProxyConnection] (LittleProxy-0-ClientToProxyWorker-0) (NEGOTIATING_CONNECT) [id: 0xcffd8c37, L:/0:0:0:0:0:0:0:1:8091 - R:/0:0:0:0:0:0:0:1:57746]: An IOException occurred on ClientToProxyConnection: An established connection was aborted by the software in your host machine
[INFO 2019-11-04T22:56:55,323 org.littleshoot.proxy.impl.ProxyToServerConnection] (LittleProxy-0-ProxyToServerWorker-0) (DISCONNECTED) [id: 0x9418bdfc, L:0.0.0.0/0.0.0.0:57748]: Connection to upstream server failed java.nio.channels.ClosedChannelException: null
at io.netty.handler.ssl.SslHandler.channelInactive(...)(Unknown Source) ~[browsermob-dist-2.1.4.jar:?]
1572879398947 mozrunner::runner INFO Running command: "C:\Program Files\Mozilla Firefox\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\Users\Owner\AppData\Local\Temp\rust_mozprofilewtK5Yc"
1572879402275 [email protected] WARN Loading extension '[email protected]': Reading manifest: Invalid extension permission: mozillaAddons
1572879402276 [email protected] WARN Loading extension '[email protected]': Reading manifest: Invalid extension permission: telemetry
1572879402276 [email protected] WARN Loading extension '[email protected]': Reading manifest: Invalid extension permission: resource://pdf.js/
1572879402277 [email protected] WARN Loading extension '[email protected]': Reading manifest: Invalid extension permission: about:reader*
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
1572879408577 Marionette INFO Listening on port 57711
1572879408762 Marionette WARN TLS certificate errors will be ignored for this session
1572879413597 Marionette INFO Stopped listening on port 57711
[Child 10436, Chrome_ChildThread] WARNING: pipe error: 109: file z:/task_1572401533/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341
[Child 10436, Chrome_ChildThread] [Child 8216, Chrome_ChildThread] WARNING: pipe error: 109: file z:/task_1572401533/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341
console.error: (new Error("Transaction canceled due to a closed connection.", "resource://gre/modules/Sqlite.jsm", 613))
[GPU 10888, Chrome_ChildThread] WARNING: pipe error: 109: file z:/task_1572401533/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, li
###!!! [Child][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost
ne 341
###!!! [Child][MessageChannel::SendAndWait] Error: Channel error: cannot send/recv
Do you know how can I get video views count? I only see on the api likes count, shares count and comment count.
The trending function doesn't appear to be working correctly.
When called, the browser hangs at this screen https://puu.sh/EYb34/7122b7c6f6.png and no errors are produced during the process.
Everything is working fine.
But the trending tiktoks being received are ones you would see if you weren't logged into the website.
If I log into the tiktok website, the trending content complete changes.
So is there a way to log into an account throught the API?
Is it possible to change the account username via an API call?
Describe the bug
In the previous version of this API i use the following code to create an array with all the urls
The buggy code
for tiktok in trending:
videoURL = tiktok["itemInfos"]["video"]["urls"]
videoname = "downloaded/" + str(prevloops) + ".mp4"
wget.download(videoURL[0], videoname)
open("downloaded/concat.txt", 'a').write("file " + str(prevloops) + ".mkv" + "\n")
clip = VideoFileClip(videoname)
d = ( clip.duration )
open("downloaded/durata.txt", 'a').write(str(d) + "\n")
os.system("ffmpeg -loglevel panic -i downloaded/" + str(prevloops) + ".mp4" + " -c copy -map 0 downloaded/" + str(prevloops) + ".mkv")
prevloops += 1
Expected behavior
Download the videos from a target hashtag
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
Here the error in the console
Traceback (most recent call last):
File "downloader.py", line 40, in <module>
videoURL = tiktok["itemInfos"]["video"]["urls"]
KeyError: 'itemInfos'
I think this error is due to the different json structure, I tried to use the new one but didn't succeed
Hey all,
I am getting the below error when trying to run the quick start code in pycharm. Can anyone help please?
C:\USERS\USER1\PycharmProjects\untitled\venv\Scripts\python.exe C:/Users/USER1/PycharmProjects/untitled/testtiktok.py
2020-04-19 18:04:41.351 | INFO | tiktok_bot.api.api:list_for_you_feed:76 - Getting 25 posts from your feed
List for you feed: 0%| | 0/25 [00:00<?, ?it/s]
Traceback (most recent call last):
File "C:/Users/USER1/PycharmProjects/untitled/testtiktok.py", line 6, in
my_feed = bot.list_for_you_feed(count=25)
File "C:\Users\USER1\PycharmProjects\untitled\venv\lib\site-packages\tiktok_bot\bot\bot.py", line 60, in list_for_you_feed
feed = self.api.list_for_you_feed(count=count)
File "C:\Users\USER1\PycharmProjects\untitled\venv\lib\site-packages\tiktok_bot\api\api.py", line 87, in list_for_you_feed
response = self._list_for_you_feed(list_feed_request=request)
File "C:\Users\USER1\PycharmProjects\untitled\venv\lib\site-packages\tiktok_bot\api\api.py", line 68, in list_for_you_feed
feed = ListForYouFeedResponse(**response.json())
File "C:\Users\USER1\PycharmProjects\untitled\venv\lib\site-packages\httpx\models.py", line 930, in json
return jsonlib.loads(self.text, **kwargs)
File "C:\Users\USER1\AppData\Local\Programs\Python\Python38-32\lib\json_init.py", line 357, in loads
return _default_decoder.decode(s)
File "C:\Users\USER1\AppData\Local\Programs\Python\Python38-32\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\USER1\AppData\Local\Programs\Python\Python38-32\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Process finished with exit code 1
Hi, I've installed browsermob proxy, java and everything else. Where do I save the actual TikTok-Api-master folder!? Thanks for the help! @davidteather
Assuming we have the id of a post we want to check, is there a way anyone knows that we can use to get more information about an individual post directly rather than querying the user and trawling through their posts to match the id. This would save on potentially a lot of additional requests.
Thanks!
http://vm.tiktok.com/jN55fJ/ i need no water video ,how to do?
hello there ,
i'm unaware of python but i'm looking for this.
how can i video download with URL and how can i get "video_id" using URL?
hope i will get some help from you.
Describe the bug
DevTools listening on ws://127.0.0.1:55641/devtools/browser/414bc91b-8f0a-4365-98a8-0ffb1521f769
Traceback (most recent call last):
File ".\test.py", line 13, in <module>
result = api.search_by_hashtag(trending_tags[0])
IndexError: list index out of range
The buggy code
from TikTokApi import TikTokapi
# Starts The Api Class
api = TikTokapi("browsermob-proxy/bin/browsermob-proxy")
# The Number of trending TikToks you want to be displayed
results = 10
# Gets trending hashtags
trending_tags = api.get_trending_hashtags()
# Searches for the top trending hashtag of TikTok
result = api.search_by_hashtag(trending_tags[0])
for tiktok in result:
# Prints the text of the tiktok
print(tiktok['itemInfos']['text'])
print(len(result))
Expected behavior
Updated to the latest version of TikTokApi, used an example to test them, but seems to be stuck on loading tiktok feed inside chrome browser
Screenshots
https://snipboard.io/GtqST7.jpg
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
Hi @davidteather. First of all my congratulation. Your work is great. Just one question:
As I try to run my first code:
==========
from TikTokApi import TikTokapi
api = TikTokapi('/Users/mariadaniello/Desktop/browsermob-proxy-2.1.4/bin/browsermob-proxy')
The IDLE returns me the following error:
Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
My chromedriver, as a norml MacOs user, is in /usr/local/bin/. Could you please tell me how to solve this iussue? Thank you.
Hi, thank you for your time and effort in this.
I tried to run the various examples scripts you provided, only getTrending.py works. The other raises the exception in the title ("Exception: Could not locate user/hashtag ID: Tried 10 times"), as if the id was None.
The same with scripts written by me, only trending works fine.
Using:
Describe the bug
A clear and concise description of what the bug is.
The buggy code
Please insert the code that is throwing errors or is giving you weird unexpected results.
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
Hi,
is it possible or will it be possible in the near future the get the list of the user's followers? @davidteather
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.