コード例 #1
0
def test_get_video_by_url():
    api = TikTokapi("browsermob-proxy/bin/browsermob-proxy", headless=False)
    bytesV = api.get_Video_By_Url(
        "https://www.tiktok.com/@bts_official_bighit/video/6741282343362759938?langCountry=en",
        return_bytes=1)
    assert type(bytesV) == type(bytes())
    api.quit_browser()
コード例 #2
0
def test_hashtag():
    api = TikTokapi("browsermob-proxy/bin/browsermob-proxy", headless=False)

    res = api.search_by_hashtag("funny")
    api.quit_browser()
    assert len(res) == 10
    assert checkDupes(res) == 0
コード例 #3
0
ファイル: test_user.py プロジェクト: headware/TikTok-Api-1
def getUser(results):
    api = TikTokapi("browsermob-proxy/bin/browsermob-proxy", headless=True)
    result = api.userPosts(
        "5058536",
        "MS4wLjABAAAAoRsCq3Yj6BtSKBCQ4rf3WQYxIaxe5VetwJfYzW_U5K8",
        count=results)
    api.quit_browser()

    return len(result)
コード例 #4
0
ファイル: test_hashtag.py プロジェクト: lazidoca/TikTok-Api
def test_hashtag():
    api = TikTokapi("browsermob-proxy/bin/browsermob-proxy", headless=True)

    res = api.search_by_hashtag("funny", count=10)
    assert len(res) == 10
    assert checkDupes(res) == 0

    res = api.search_by_hashtag("funny", count=50)
    assert len(res) == 50
    assert checkDupes(res) == 0
コード例 #5
0
ファイル: test_sounds.py プロジェクト: wufaliang/TikTok-Api-1
def test_sound():
    api = TikTokapi("browsermob-proxy/bin/browsermob-proxy", headless=True)
    assert len(api.search_by_sound("https://www.tiktok.com/music/original-sound-6742171751955843846", count=5)) == 5
    assert len(api.search_by_sound("https://www.tiktok.com/music/original-sound-6742171751955843846", count=10)) == 10
    assert len(api.search_by_sound("https://www.tiktok.com/music/original-sound-6742171751955843846", count=30)) == 30

    api.quit_browser()
コード例 #6
0
def test_user():
    api = TikTokapi("browsermob-proxy/bin/browsermob-proxy", headless=True)

    assert len(
        api.userPosts(
            id="5058536",
            secUid="MS4wLjABAAAAoRsCq3Yj6BtSKBCQ4rf3WQYxIaxe5VetwJfYzW_U5K8",
            count=5)) == 5
    assert len(
        api.userPosts(
            id="5058536",
            secUid="MS4wLjABAAAAoRsCq3Yj6BtSKBCQ4rf3WQYxIaxe5VetwJfYzW_U5K8",
            count=10)) == 10
    assert len(
        api.userPosts(
            id="5058536",
            secUid="MS4wLjABAAAAoRsCq3Yj6BtSKBCQ4rf3WQYxIaxe5VetwJfYzW_U5K8",
            count=30)) == 30

    api.quit_browser()
コード例 #7
0
def getTrending(results):
    api = TikTokapi("browsermob-proxy/bin/browsermob-proxy", headless=True)
    trending = api.trending(results)

    return len(trending)
コード例 #8
0
ファイル: test_user.py プロジェクト: liyingkun1237/TikTok-Api
def getUser(results):
    api = TikTokapi("browsermob-proxy/bin/browsermob-proxy", headless=False)
    result = api.userPosts("jadenthekingsley", count=results)
    api.quit_browser()

    return len(result)
コード例 #9
0
import os
import mimetypes
from TikTokApi import TikTokapi


def clearTMP(delpath):
    r = glob.glob(delpath)
    for i in r:
        os.remove(i)


clearTMP('output/output.mp4')

# Vars
count = 30
api = TikTokapi("browsermob-proxy/bin/browsermob-proxy")

results = api.trending(count=count)
prevloops = 0
for res in results:
    r = requests.get(res["itemInfos"]["video"]["urls"][0],
                     allow_redirects=False)
    content_type = r.headers['content-type']
    extension = mimetypes.guess_extension(content_type)
    open('downloaded/' + str(prevloops) + extension, "wb").write(r.content)
    open("downloaded/concat.txt",
         'a').write("file " + str(prevloops) + ".mkv" + "\n")
    os.system("ffmpeg -loglevel panic -i downloaded/" + str(prevloops) +
              extension + " -c copy -map 0 downloaded/" + str(prevloops) +
              ".mkv")
    prevloops += 1
コード例 #10
0
def test_extended_trending():
    api = TikTokapi("browsermob-proxy/bin/browsermob-proxy", headless=True)
    assert len(api.trending(50)) == 50
    assert len(api.trending(100)) == 100
    api.quit_browser()
コード例 #11
0
ファイル: getTrending.py プロジェクト: Vadimak170/TikTok-Api
# NOTE: This python file cannot be run from the examples folder.
# It MUST BE in the same directory as tiktok.py is located!
# Yeah sorry, it's kind of annoying, but it's more organized this way.
from TikTokApi import TikTokapi

# Starts T
api = TikTokapi("path/to/browsermob-proxy")

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

for tiktok in trending:
    # Prints the text of the tiktok
    print(tiktok['itemInfos']['text'])

print(len(trending))
コード例 #12
0
def getUser(results):
    api = TikTokapi("browsermob-proxy/bin/browsermob-proxy", headless=True)
    result = api.userPosts("6718751032510759942", count=results)

    return len(result)
コード例 #13
0
ファイル: test_hashtag.py プロジェクト: lazidoca/TikTok-Api
def test_get_trending_hashtag():
    api = TikTokapi("browsermob-proxy/bin/browsermob-proxy", headless=True)

    assert len(api.get_trending_hashtags()) == 4
    
コード例 #14
0
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("funny")

for tiktok in result:
    # Prints the text of the tiktok
    print(tiktok['itemInfos']['text'])

print(len(result))
api.quit_browser()
コード例 #15
0
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

# The TikTok user's ID, can be found in the JSON from trending
id = "7119601"

trending = api.userPosts(id, count=results)

for tiktok in trending:
    # Prints the text of the tiktok
    print(tiktok['itemInfos']['text'])

print(len(trending))
コード例 #16
0
ファイル: getSound.py プロジェクト: wufaliang/TikTok-Api-1
from TikTokApi import TikTokapi

# Starts T
api = TikTokapi("path/to/browsermob-proxy")

# The Number of TikToks you want to be displayed
results = 10
soundTikToks = api.search_by_sound(
    "https://www.tiktok.com/music/original-sound-6742171751955843846")

for tiktok in soundTikToks:
    # Prints the text of the tiktok
    print(tiktok['itemInfos']['text'])

print(len(soundTikToks))
api.quit_browser()
コード例 #17
0
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

userPosts = api.userPosts("khaleelabdullah_")

for tiktok in userPosts:
    print(tiktok)

print(len(trending))

api.quit_browser()
コード例 #18
0
def test_trending():
    api = TikTokapi("browsermob-proxy/bin/browsermob-proxy", headless=False)
    assert len(api.trending(5)) == 5
    assert len(api.trending(10)) == 10
    api.quit_browser()
コード例 #19
0
ファイル: getHashtag.py プロジェクト: lazidoca/TikTok-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

# 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))
コード例 #20
0
ファイル: test_trending.py プロジェクト: lazidoca/TikTok-Api
def test_trending():
    api = TikTokapi("browsermob-proxy/bin/browsermob-proxy", headless=True)
    assert len(api.trending(5)) == 5
    assert len(api.trending(10)) == 10
    assert len(api.trending(20)) == 20