TikTok open API video.list Fields request
Can retrieve videos without any problems but trying to request the 'fields' in endpoint always calls a 404 error. I try to follow the documentation https://developers.tiktok.com/doc/login-kit-video-list but maybe i'm attatching '&fields' or 'like_count' incorrectly to the url. Not sure how to structure the request.. any help? Thanks error received
$tik_token = $tik_tok_access;
$tik_open_tk = $tik_open;
$url = 'https://open-api.tiktok.com/video/list/?open_id='.$tik_open_tk.'&access_token='.$tik_token.'&cursor=0&max_count=1&fields=like_count';
$json = file_get_contents($url);
$jo = json_decode($json, true);
var_dump($jo);
1 answer
-
answered 2022-05-04 13:08
Will Levy
Get method to POST. Called Curl instead.
<?php $url = 'https://open-api.tiktok.com/video/list/'; $data = '{ "access_token": "'.$tik_token.'", "open_id": "'.$tik_open_tk.'", "cursor": 0, "max_count": 1, "fields": ["embed_html", "embed_link", "share_count"] }'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //curl_setopt($ch, CURLOPT_HTTPHEADER, $additional_headers); $server_output = curl_exec ($ch); echo $server_output;
do you know?
how many words do you know
See also questions close to this topic
-
How to upload a video using ACF in WordPress?
I am still at learning phase in WordPress. I cannot figure out in ACF which field type should I choose to upload a video file and which code should I write to show it at the front-end. Please look into the below code. I am using the_field('') but it isn't working. Can anyone help
<video width="954" height="535" controls class="tm-mb-40"> <source src="video/wheat-field.mp4" type="video/mp4"> Your browser does not support the video tag. </video>
-
delete a table form a database using laravel command
i need to delete a database table using laravel artisan command . not like this command php artisan migrate:rollback --step=5
i need to create like this route or controller code .
Route::get('/clear/database', function () {
Artisan::call('cache:clear'); return redirect('/');
});
. i also try public function dd()
{ Schema::drop('table_name'); }
but it not working . gives me error like this SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (SQL: drop table
table_name
)no foreign key for the table . what should i do ?
thanks in advance!
-
Creating Sticky Navbar with Drop Down Menu HTML
I am creating a HTML web page which contains a sticky navbar with drop down menu. However, when I created one, the dropdown menu does not works in the sticky navbar and so goes vise versa. below is the screenshot of both the result of the two codes.
*image with dropdown menu but without sticky navbar
*image with sticky navbar but without dropdown menu
below is the code for "image with dropdown menu but without sticky navbar"
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font- awesome/4.7.0/css/font-awesome.min.css"> <style> body {margin:0;font-family:Arial} .topnav { overflow: hidden; background-color: #333; } .topnav a { list-style-type: none; float: left; display: block; color: #f2f2f2; text-align: center; padding: 14px 16px; text-decoration: none; font-size: 17px; position: sticky; } .active { background-color: #04AA6D; color: white; } .topnav .icon { display: none; } .dropdown { float: left; overflow: hidden; } .dropdown .dropbtn { font-size: 17px; border: none; outline: none; color: white; padding: 14px 16px; background-color: inherit; font-family: inherit; margin: 0; } .dropdown-content { display: none; position: absolute; background-color: #f9f9f9; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; } .dropdown-content a { float: none; color: black; padding: 12px 16px; text-decoration: none; display: block; text-align: left; } .topnav a:hover, .dropdown:hover .dropbtn { background-color: #555; color: white; } .dropdown-content a:hover { background-color: #ddd; color: black; } .dropdown:hover .dropdown-content { display: block; } @media screen and (max-width: 600px) { .topnav a:not(:first-child), .dropdown .dropbtn { display: none; } .topnav a.icon { float: right; display: block; } } @media screen and (max-width: 600px) { .topnav.responsive {position: relative;} .topnav.responsive .icon { position: absolute; right: 0; top: 0; } .topnav.responsive a { float: none; display: block; text-align: left; } .topnav.responsive .dropdown {float: none;} .topnav.responsive .dropdown-content {position: relative;} .topnav.responsive .dropdown .dropbtn { display: block; width: 100%; text-align: left; } } </style> </head> <body> <div class="header"> <h2>Scroll Down</h2> <p>Scroll down to see the sticky effect.</p> </div> <div class="topnav" id="myTopnav"> <a href="#home" class="active">Home</a> <a href="#news">News</a> <a href="#contact">Contact</a> <div class="dropdown"> <button class="dropbtn">Dropdown <i class="fa fa-caret-down"></i> </button> <div class="dropdown-content"> <a href="#">Link 1</a> <a href="#">Link 2</a> <a href="#">Link 3</a> </div> </div> <a href="#about">About</a> <a href="javascript:void(0);" style="font-size:15px;" class="icon" onclick="myFunction()">☰</a> </div> <div style="padding-left:16px"> <h2>Responsive Topnav with Dropdown</h2> <p>Resize the browser window to see how it works.</p> <p>Hover over the dropdown button to open the dropdown menu.</p> </div> <h3>Sticky Navigation Bar Example</h3> <p>The navbar will <strong>stick</strong> to the top when you reach its scroll position.</p> <p><strong>Note:</strong> Internet Explorer do not support sticky positioning and Safari requires a -webkit- prefix.</p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <script> function myFunction() { var x = document.getElementById("myTopnav"); if (x.className === "topnav") { x.className += " responsive"; } else { x.className = "topnav"; } } </script> </body> </html>
below is the code for "image with sticky navbar but without dropdown menu"
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font- awesome/4.7.0/css/font-awesome.min.css"> <style> body { font-size: 20px; } body {margin:0;} ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #333; position: -webkit-sticky; /* Safari */ position: sticky; top: 0; } li { float: left; } li a { display: block; color: white; text-align: center; padding: 16px 20px; text-decoration: none; } li a:hover { background-color: #111; } /*======================================================================*/ body { background-color:white; } ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #38444d; } li { float: left; } li a, .dropbtn { display: inline-block; color: white; text-align: center; padding: 14px 16px; text-decoration: none; } li a:hover, .dropdown:hover .dropbtn { background-color: red; } li.dropdown { display: inline-block; } .dropdown-content { display: none; position: absolute; background-color: #f9f9f9; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; } .dropdown-content a { color: black; padding: 12px 16px; text-decoration: none; display: block; text-align: left; } .dropdown-content a:hover {background-color: #f1f1f1;} .dropdown:hover .dropdown-content { display: block; } footer { text-align: center; padding: 3px; background-color: DarkSalmon; color: white; } </style> </head> <body> <div class="header"> <h2>Scroll Down</h2> <p>Scroll down to see the sticky effect.</p> </div> <ul> <li><a href="#home">Home</a></li> <li><a href="#news">News</a></li> <li class="dropdown"> <a href="javascript:void(1)" class="dropbtn">Dropdown</a> <div class="dropdown-content"> <a href="#">Link 1</a> <a href="#">Link 2</a> <a href="#">Link 3</a> </div> </li> </ul> <h3>Sticky Navigation Bar Example</h3> <p>The navbar will <strong>stick</strong> to the top when you reach its scroll position.</p> <p><strong>Note:</strong> Internet Explorer do not support sticky positioning and Safari requires a -webkit- prefix.</p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <footer> <p>Author: Hege Refsnes<br> <a href="mailto:hege@example.com">hege@example.com</a></p> </footer> </body> </html>
Please i need some help with this as i am new to html and css.
-
Images with Firebase and Python Flask API
I am currently developing an API using Firebase from google and Python's Flask libraries. It is a proyect where I am in need of saving images to the DB and then adress them in the API. I would also like to know how to relate the image to an item in the database, say posting an image of Juan, and that is linked with ALL the information from Juan inside the DB. Thanks!
-
Need help finding an api or real world data related to read time of people
I need to create a project for which I require real world data of reading time per page or article. Can anyone help me find data or api in which I can get this data I tried to search for some api but they had information related to books instead of their reading time of a person.
-
Using Websocket Channel in React
I am working on a project where I have to make an api call to a websocket, and display certain information based on that call. As you can see I have used the subscribe portion of the channel in my call. Now I'm not sure what to do if anything with the 2nd two set of bracket. Do I need to include them my call as well, or do they come along with the subscription? And from which of them would I be using the information I need to display? In other words which one is the information I am recieving?
'''
const ws = new WebSocket("wss://ws-feed.exchange.coinbase.com"); const apiCall = { type: "subscribe", product_ids: [ "ETH-USD", "BTC-USD" ], channels: ["level2"] }; ws.onopen = (event) => { ws.send(JSON.stringify(apiCall)); }; ws.onmessage = function (event) { const json = JSON.parse(event.data); console.log(`[message] Data received from server: ${json}`); };
'''
-
How to get login cookie on tiktok
I want to scrape tiktok comments on apify, but the settings tells me that i need to provide cookies to log in as a normal TikTok user (you can copy with a Chrome plugin like 'EditThisCookie'). Click here to see Scraping Comments description
I have downloaded and installed EditThisCookie Extension, but i can't find any cookies that represents login cookie :
Does any one know to get the login cookies value ?
-
Getting Error with UI for TikTok algorithm
So I basically made a algorithm which takes the users input and decided on a rank from 1-100 and puts it on a UI.
import tkinter, os, webbrowser, random #algorithm def tiktok_algorithm(share_count, like_count, comment_count, posts): if (share_count >= 10000 and like_count >= 5000 and posts >20 and comment_count.find("amazing")!= -1): rank = 1 elif (share_count >= 7000 and like_count >= 2000 and posts >25 and comment_count.find("amazing")!= -1): rank = random.randint(2,10) elif (share_count >= 6000 and like_count >= 1500 and posts >25 and comment_count.find("amazing")!= -1): rank = random.randint(11,20) elif (share_count >= 5000 and like_count >= 1300 and posts >20 and comment_count.find("amazing")!= -1): rank = random.randint(21,40) elif (share_count >= 4000 and like_count >= 1000 and posts >15 and comment_count.find("nice")!= -1): rank = random.randint(41,55) elif (share_count >= 3000 and like_count >= 500 and posts >11 and comment_count.find("cool")!= -1): rank = random.randint(56,70) elif (share_count >= 2000 and like_count >= 300 and posts >11 and comment_count.find("ok")!= -1): rank = random.randint(71,80) elif (share_count >= 1000 and like_count >= 150 and posts >11 and comment_count.find("ok")!= -1): rank = random.randint(81,90) elif (share_count >= 400 and like_count >= 100 and posts >11 and comment_count.find("ok")!= -1): rank = random.randint(91,97) else: rank = random.randint(98,100) return(rank) def calculate_ranking(): # read in the entry values like_count = int(likes_entry.get()) comment_count = comment_entry.get() posts = int(posts_entry.get()) shares = int(share_entry.get()) rank = tiktok_algorithm(like_count, comment_count, shares, posts) # "print" result to result label result_label.config(text="Your tiktok ranking is: " + str(rank)) root = tkinter.Tk() root.title("Magic Tiktok Algorithm") root.geometry("400x600") # likes likes_label = tkinter.Label(root, text="Number of Likes:") likes_label.pack() likes_entry = tkinter.Entry(root) likes_entry.pack() # comment comment_label = tkinter.Label(root, text="Comment:") comment_label.pack() comment_entry = tkinter.Entry(root) comment_entry.pack() #shares share_label = tkinter.Label(root, text="number of shares:") share_label.pack() share_entry = tkinter.Entry(root) share_entry.pack() #posts posts_label = tkinter.Label(root, text="Posts") posts_label.pack() posts_entry = tkinter.Entry(root) posts_entry.pack() #image img_path = os.path.dirname(__file__) + "\\tiktok-tricks-09.PNG" tiktok_image = tkinter.PhotoImage(file=img_path) resized_tiktok_img = tiktok_image.subsample(4,4) image_label = tkinter.Label(root, image=resized_tiktok_img) image_label.pack() # rank button rank_button = tkinter.Button(root, text="Get Ranking", command=calculate_ranking) rank_button.pack() # result result_label = tkinter.Label(root, text = "Your tiktok ranking is:") result_label.pack() # keep the UI running root.mainloop()
I keep getting this error, I have tried casting it to an integer, but it still doesn't work can anyone help: Do I need to change the top to str(tiktok_algorithm)
typeError: '>=' not supported between instances of 'str' and 'int'