Skip to main content

A Simple Python Package for Scarping and Downloading Tiktok Videos

Project description

MyTIkTok

A Simple Python Package for Scarping and Downloading Tiktok Videos

Installation

Linux/Unix

  • pip3 install mytiktok

Windows

  • pip install mytiktok

Visual Output

The package itself uses undetected-chromedriver for webautomation which controls whether the chrome instance to renders or not hence the headless option. Using headless mode increases the chances of a capthca being raised and scraping failed. So far in testing captcha is only noticed at Login() but once login successful cookies are created and you should be fine in successive usage of the package until the cookies expire.

So implementing Retries is important if your planning on using this package for a project.

[!NOTE] I recommend using headless = True after you've aleady passed Login and generated cookies, and after you can use headless = False but alternatively you can just always set headless = True

Example Usages

Search for tiktok videos

from mytiktok import Tiktok


email = 'your_tiktok_email@gmail.com'
password = 'your_tiktok_password'
search_term = '#JesusSaves #prayer'

#the package needs an account login details to create cookie sessions 
tiktok  = Tiktok(email=email, password=password)

#returns a videos object
videos  = tiktok.search(search_term=search_term, amnt=14)
print(videos.info_list)

Get Videos of an Accounts Video

from mytiktok import Tiktok


email = 'your_tiktok_email@gmail.com'
password = 'your_tiktok_password'

accounts  = [
'@calebbpartain',
'@dailychristmotives',
'@inspiringfaith1',
'@spreadthewordbro_',

]

#the package needs an account login details to create cookie sessions 
tiktok  = Tiktok(email=email, password=password)

#returns a videos object
videos  = tiktok.accounts(accounts=accounts, amnt=14)
print(videos.info_dict)

Downloading Videos

Downloads videos via Search or Accounts

videos.download(folder_name = 'Example_Folder') 

Download via Video

from mytiktok.video import Video

url = 'https://www.tiktok.com/@calebbpartain/video/7363384781024906538'

video  = Video(url = url)
video.download(file_name='video.mp4')

Download via Videos Class

from mytiktok.videos import Videos


urls  = [
'https://www.tiktok.com/@calebbpartain/video/72961sadsada4967404662062',
'https://www.tiktok.com/@calebbpartain/video/7314359034906234155',
'https://www.tiktok.com/@calebbpartain/video/7207942650564119854',
'https://www.tiktok.com/@calebbpartain/video/7363384781024906538',
]

videos  = Videos(urls = urls)
videos.download(folder_name='Test_videos')

Limitations

  • Uses Chrome Instances
  • Login attempts Frequently Fail
  • Download attempts can fail from time to time

Issues

If you are planning to download in bulk ensure to save URLs and use the Videos class instead

[!NOTE] If using this package headlessly, is important to your needs try running your script in a Docker

[!IMPORTANT] Proxing has not been implemented so there is a possibility of snaptik.app blocking you and or slowing down your connection but just don't download excessively, keep the rates low and you should be fine

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mytiktok-0.0.5.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mytiktok-0.0.5-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file mytiktok-0.0.5.tar.gz.

File metadata

  • Download URL: mytiktok-0.0.5.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for mytiktok-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ffa02bc84848c841f083deca69a5c8a8bfe481bf82ffb23c924dd75d972d28f7
MD5 79f4b7e694b27f2c844377502f3d736a
BLAKE2b-256 978487324e960290843bbbf9b3d40dd4fb5f58a46108400f2cd82803f1f70020

See more details on using hashes here.

File details

Details for the file mytiktok-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: mytiktok-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for mytiktok-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 54daa93dda0234349b5bef149a43863d0fb8b93d37d8e5fb735d47f3fa014d7e
MD5 faa9c402fae0d6be0d8cbeab69dccd92
BLAKE2b-256 485cfd915df949608244a42a56c49dd44216327f8a0c89ef38f12a1bd1ea4470

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page