Open sideloading opened 4 years ago
This endpoint is related to the Mobile API!
This library supports only Web Api!
In order to use Mobile API you need valid device_id, iid values and valid signature in the header depending from the app version.
Currently i don't have plans to add mobile api support to this repo as it can be abused by spammers and bot lovers
@drawrowfly I see. I did some further investigating and found that this playlist.m3u8 is also located on a share page under the shared URL (via the app: sharing livestream->copy link)
URL https://m.tiktok.com/share/live/6848460154006932229/
-> viewing source:
<link data-react-helmet="true" rel="dns-prefetch" href="//s0.ipstatp.com"/><link data-react-helmet="true" rel="dns-prefetch" href="//s16.tiktokcdn.com"/><link data-react-helmet="true" rel="dns-prefetch" href="//v16.tiktokcdn.com"/><link data-react-helmet="true" rel="dns-prefetch" href="//p16-va.tiktokcdn.com"/><link data-react-helmet="true" rel="dns-prefetch" href="//www.google-analytics.com"/><link data-react-helmet="true" rel="dns-prefetch" href="//stats.g.doubleclick.net"/><link data-react-helmet="true" rel="shortcut icon" href="//s16.tiktokcdn.com/musical/resource/wap/static/image/logo_144c91a.png?v=2" type="image/x-icon"/><link rel="stylesheet" href="//s16.tiktokcdn.com/tiktok/falcon/static/css/43.bundle.44d316d5.css"/><script>window.__INIT_PROPS__ = {"/share/live/:id":{"$isMobile":true,"$isIOS":["(iPhone; CPU iPhone OS 13_3_1 like Mac OS X",null],"$isAndroid":false,"$origin":"https://m.tiktok.com","$pageUrl":"/share/live/6848460154006932229/","$region":"AU","$language":"en","$originalLanguage":"en","$os":"ios","$reflowType":"m","$appId":1233,"$botType":"others","$appType":"m","$downloadLink":{"amazon":{"visible":true,"normal":"https://www.amazon.com/dp/B0117U0G3M/"},"google":{"visible":true,"normal":"https://www.tiktok.com/download-link/af/com.zhiliaoapp.musically"},"apple":{"visible":true,"normal":"https://www.tiktok.com/download-link/af/id835599320"}},"$config":{"covidBanner":{"open":true,"url":"https://www.tiktok.com/safety/resources/covid-19","background":"rgba(125,136,227,1)"},"bytedanceLink":{"linkVisible":true,"overrideUrl":""}},"$baseURL":"m.tiktok.com","pageState":{"regionAppId":1233,"os":"ios","region":"AU","baseURL":"m.tiktok.com","appType":"m","fullUrl":"https://m.tiktok.com/share/live/6848460154006932229/"},"liveData":{"RoomId":"6848460154006932229","Status":"2","Title":"come talk w me real quick ((:","LiveUrl":"http://pull-hls-l1.tiktokcdn.com/stage/stream-2989310946276540431_or4/playlist.m3u8","OwnerInfo":{"Id":"9192363","ShortId":"21452519056","UniqueId":"tom.cruz","Nickname":"julia cruz","AvatarThumb":{"Uri":"100x100/musically-maliva-obj/10d730df23e9ba953b81946fddd402b3","UrlList":["https://p16-va-tiktok.ibyteimg.com/img/musically-maliva-obj/10d730df23e9ba953b81946fddd402b3~c5_100x100.jpeg"]},"AvatarMedium":{"Uri":"720x720/musically-maliva-obj/10d730df23e9ba953b81946fddd402b3","UrlList":["https://p16-va-tiktok.ibyteimg.com/img/musically-maliva-obj/10d730df23e9ba953b81946fddd402b3~c5_720x720.jpeg"]},"AvatarLarger":{"Uri":"1080x1080/musically-maliva-obj/10d730df23e9ba953b81946fddd402b3","UrlList":["https://p16-va-tiktok.ibyteimg.com/img/musically-maliva-obj/10d730df23e9ba953b81946fddd402b3~c5_1080x1080.jpeg"]},"Signature":"BLM\nvancouver-ish \n12.1k of u guys!!🥺🥺","CreateTime":"1441970524","Verified":false,"SecUid":"MS4wLjABAAAAaugAOm_l0o2BtiMeKrXFvfOlttZw1uu6k5okK6TtXZY","Secret":false,"Ftc":false,"Relation":0,"OpenFavorite":false,"BioLink":null,"CommerceUserInfo":null},"LiveRoomStats":{"UserCount":36,"EnterCount":902,"DiggCount":0},"coverUrl":{"Uri":"musically-maliva-obj/10d730df23e9ba953b81946fddd402b3","UrlList":["https://p16-va-default.akamaized.net/obj/musically-maliva-obj/10d730df23e9ba953b81946fddd402b3"]}},"shareUser":{"secUid":"","userId":"","uniqueId":"","nickName":"","signature":"","covers":[],"coversMedium":[],"coversLarger":[],"isSecret":false,"relation":-1},"shareMeta":{"title":"julia cruz Live on TikTok","desc":"@tom.cruz 12331 Followers, 294 Following, 268400 Likes - Live on TikTok"},"statusCode":0}}</script>
</head>
Is this something that's able to be checked through the Web API?
Alright i will take a look at it closer
Thanks, let me know if you find anything! I've found the easiest way to find a live account is by swiping through the 'For You' page in the app until you get someone who is live.
Here's a URL that's working right now: https://t.tiktok.com/share/live/6852379743099030277/
You could use a regex to match the stream_id
: 2989371956691992591
then you can output URLs for the stream in two formats:
HLS: http://{{HLS domain}}/stage/stream-{{stream_id}}/playlist.m3u8
{{HLS domain}} could be pull-hls-f5.tiktokcdn.com
, pull-hls-f1-ab.tiktokcdn.com
, or pull-hls-l1.tiktokcdn.com
. Only the one returned in source code will work for the particular stream.
FLV: http://pull-f5-ab.tiktokcdn.com/stage/stream-{{stream_id}}.flv
There is video in the FLV stream, I can't see it. Apparently tiktok uses some hacky codec: https://trac.ffmpeg.org/ticket/6389
Edit: ignore all of the above ramblings lol. Easiest method is to extract m3u8 URL from source code.
@llacb47 the HLS .m3u8 should be downloadable with youtube-dl/ffmpeg, and compiled into an mp4 when the live ends.
@drawrowfly Would you be able to re-open this issue seeing as it may be possible to implement?
I've done this https://github.com/UnCrevard/tiktok-live
Hope you'll like it.
@UnCrevard the best thing you can do here is to create pull request to already existing package with multiple features instead of advertising separate package with one purpose
@UnCrevard Is there any way to check if a user is livestreaming without relying on the livestream share-link?
Tiktok changed a lot https://www.tiktok.com/@USERNAME/live
opens the live stream page of a user.
But I can not find the live stream url on this page or its scripts :(
Are there any more updates on this?
I also noticed that tiktok saves lives to replay now, so I didn't know if that could somehow be scraped as well.
Is your feature request related to a problem? Please describe. No.
Describe the solution you'd like It would be great to have the ability to download ongoing live from TikTok. Adding a new parameter to check for ongoing live, then download the live.
Information When a user is live, there is a m3u8 link inside the JSON.
The following endpoints have the
room_data
key if a user is live:/aweme/v1/user/profile/other/?parameter=xyz&user_id=2467441
/aweme/v1/aweme/post/?parameter=xyz&user_id=2467441
Inside
"room_data":
there is a .m3u8 link (e.g.http://pull-hls-l1.tiktokcdn.com/stage/stream-2989306508973178895/playlist.m3u8
) which can then be processed with ffmpeg/youtube-dl for downloading.Example JSON response of a user that is currently live (truncated, via post endpoint):
Same response when user is not live (truncated, no
room_data
,room_id=0
):I also had a Python tool for downloading livestreams. but it's broken now so hopefully you can find some of the code useful.