Code Monkey home page Code Monkey logo

Comments (11)

davidteather avatar davidteather commented on May 19, 2024 1

You're trying to download an array of urls try

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

hashtag = ("meme")


result = api.search_by_hashtag(hashtag, results)

prevloops = 0

for tiktok in result :
    # Prints the text of the tiktok
    videoURL = tiktok["itemInfos"]["video"]["urls"][0]
    videoname = "video" + str(prevloops) + ".mp4"
    urllib.request.urlretrieve(videoURL, videoname)
    prevloops += 1

from tiktok-api.

issue-label-bot avatar issue-label-bot commented on May 19, 2024

Issue-Label Bot is automatically applying the label question to this issue, with a confidence of 0.92. Please mark this comment with 👍 or 👎 to give our bot feedback!

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

from tiktok-api.

davidteather avatar davidteather commented on May 19, 2024

Are you talking about [itemInfos][id]?

Currently there’s no ability to get that json by a url. I’ll implement that feature either today or over the weekend.

from tiktok-api.

DevMensIT avatar DevMensIT commented on May 19, 2024

can you please explain to me that how i get "video_id"(v12345679978912zxasd) ?
what should i have to call to get this file "ExTikTokResonse.json" response in php ?

from tiktok-api.

davidteather avatar davidteather commented on May 19, 2024

Since this is a python package you would have to create a python script that you could use the php exec command to execute the code and fetch the output of that program.

Here is example code of how to specify a search by hashtag and result number. Ex calling command

python TikTok-Api-CLI.py funny 10

Here is a link to the php exec command.

Another option is to use this python API to find the signature you need to make requests to their database, however that would still require integration to a python script.

A third option is that the python script finds the ExTikTokResponse.json and saves it to a file, then you load that file in php.

from tiktok-api.

davidteather avatar davidteather commented on May 19, 2024

If you want to download the video in python here's example code

from TikTokApi import TikTokapi
import urllib.request
# Starts T
api = TikTokapi("path/to/browsermob-proxy")

# The Number of trending TikToks you want to be displayed
results = 1
trending = api.trending(results)

for tiktok in trending:
    # Prints the text of the tiktok
    videoURL = tiktok["itemInfos"]["video"]["urls"][2]
    urllib.request.urlretrieve(videoURL, 'video_name.mp4') 

from tiktok-api.

DevMensIT avatar DevMensIT commented on May 19, 2024

sorry but i'm getting error of browsermob-proxy... i don't understand how to set that path. i already downloaded that.

from tiktok-api.

davidteather avatar davidteather commented on May 19, 2024

Download browsermob proxy and place it as such and change “path/to/browsermob-proxy” to be “browsermob-proxy”

If that doesn’t work try “browsermob-proxy/bin”

ProjectFolder
  - main.py
   - browsermob-proxy
       - bin

Google adding to path on whatever your operating system is.

Then add ProjectFolder/browsermob-proxy/bin to the path.

from tiktok-api.

DevMensIT avatar DevMensIT commented on May 19, 2024

okay i will check it. thanks again.

from tiktok-api.

davidteather avatar davidteather commented on May 19, 2024

Updated main branch adding new release and pypi release in a few minutes.

from tiktok-api.

Lem0nTree avatar Lem0nTree commented on May 19, 2024

Trying to download hashtag videos with the api,


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

hashtag = ("meme")


result = api.search_by_hashtag(hashtag, results)

prevloops = 0

for tiktok in trending:
    # Prints the text of the tiktok
    videoURL = tiktok["itemInfos"]["video"]["urls"]
    videoname = "video" + str(prevloops) + ".mp4"
    urllib.request.urlretrieve(videoURL, videoname)
    prevloops += 1

but unfortunately get this error
File ".\testest.py", line 20, in <module> urllib.request.urlretrieve(videoURL, 'videoname.mp4') File "C:\Users\loren\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 245, in urlretrieve url_type, path = splittype(url) File "C:\Users\loren\AppData\Local\Programs\Python\Python37\lib\urllib\parse.py", line 940, in splittype match = _typeprog.match(url) TypeError: expected string or bytes-like object

Any advice on how to download videos based on hashtag?
Thank you very much ! @davidteather

from tiktok-api.

Related Issues (20)

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.