pytik package

Submodules

pytik.extract module

pytik.extract.description(json)

Extract the description from a TikTok url.

Parameters

json (json) – Parsed JSON of the TikTok video’s HTML page.

Return type

str

Returns

TikTok description.

pytik.extract.get_json(html)

Use regex to parse a TikTok page’s HTML code to get ‘props’ JSON data

Parameters

html (str) – Full HTML code of a TikTok page

Return type

json

Returns

JSON object of ‘props’

pytik.extract.nickname(json)

Extract the nickname of the user from a TikTok url.

Parameters

json (json) – Parsed JSON of the TikTok video’s HTML page.

Return type

str

Returns

TikTok user’s nickname.

pytik.extract.song(json)

Extract the song from a TikTok url.

Parameters

json (json) – Parsed JSON of the TikTok video’s HTML page.

Return type

str

Returns

TikTok song.

pytik.extract.song_author(json)

Extract the song’s author from a TikTok url.

Parameters

json (json) – Parsed JSON of the TikTok video’s HTML page.

Return type

str

Returns

TikTok song author.

pytik.extract.user(json)

Extract the user from a TikTok url.

Parameters

json (json) – Parsed JSON of the TikTok video’s HTML page.

Return type

str

Returns

TikTok user.

pytik.extract.video_id(url)

Extract the video_id from a TikTok url. This function supports the following patterns: - https://www.tiktok.com/@user/video/video_id

Parameters

url (str) – A TikTok url containing a video id.

Return type

str

Returns

TikTok video id.

pytik.request module

pytik.request.get(url)

Send an http GET request.

Parameters

url (str) – The URL to perform the GET request for.

Return type

str

Returns

UTF-8 encoded string of response

pytik.tiktok module

class pytik.tiktok.TikTok(url)

Bases: object

The core developer interface for pytik. pytik offloads the heavy lifting to smaller peripheral modules and functions.

Parameters

url (str) – The url of the TikTok video to gather data from

description() → str

Returns the video’s description

Return type

String

nickname() → str

Returns the video creator’s nickname

Return type

String

prefetch() → None

Eagerly download all necessary data.

Eagerly executes all necessary network requests so all other operations don’t does need to make calls outside of the interpreter which blocks for long periods of time.

Return type

None

song() → str

Returns the video’s song

Return type

String

song_author() → str

Returns the video’s song author

Return type

String

user() → str

Returns the video’s user

Return type

String

Module contents