PHPackages                             haianibrahim/tiktok-scraper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. haianibrahim/tiktok-scraper

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

haianibrahim/tiktok-scraper
===========================

Custom TikTok Video details scraper (PHP 8, PSR-4, Guzzle)

v2.0.1(9mo ago)018GPL-3.0PHPPHP ^8.1

Since Aug 12Pushed 9mo agoCompare

[ Source](https://github.com/haianibrahim/tiktok-scraper)[ Packagist](https://packagist.org/packages/haianibrahim/tiktok-scraper)[ RSS](/packages/haianibrahim-tiktok-scraper/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

TikTok Custom PHP Scraper
=========================

[](#tiktok-custom-php-scraper)

[![GitHub Repo](https://camo.githubusercontent.com/ef94a3c51e4058f046bc090589ccddb4da0815169891fac64f9ab696b1b932d3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769744875622d74696b746f6b2d2d736372617065722d626c61636b3f6c6f676f3d676974687562)](https://github.com/haianibrahim/tiktok-scraper)[![GitHub Stars](https://camo.githubusercontent.com/31eb923131253a803a6eeeecdab0fd4be3ba773df41a7d9b199f53401f5041b6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f686169616e6962726168696d2f74696b746f6b2d73637261706572)](https://github.com/haianibrahim/tiktok-scraper/stargazers)[![Packagist Version](https://camo.githubusercontent.com/a00a956e9d6c237c6f3b4d3297acdcbe2518259ca74c2bbe4451000e746bc663/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f686169616e6962726168696d2f74696b746f6b2d736372617065723f636f6c6f723d253233303038434646266c6f676f3d7061636b6167697374)](https://packagist.org/packages/haianibrahim/tiktok-scraper)[![PHP](https://camo.githubusercontent.com/df94ad74b504bf6f6a4d5ad17449f070d142c1e92428b567f7820e23348ff616/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e312d3737374242343f6c6f676f3d706870)](https://camo.githubusercontent.com/df94ad74b504bf6f6a4d5ad17449f070d142c1e92428b567f7820e23348ff616/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e312d3737374242343f6c6f676f3d706870)[![License](https://camo.githubusercontent.com/cf08f9d9c81e88957c30b8b0752a5e08ac3cc3c4b764aada8c341eee34a27238/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d47504c2d2d332e302d626c7565)](https://camo.githubusercontent.com/cf08f9d9c81e88957c30b8b0752a5e08ac3cc3c4b764aada8c341eee34a27238/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d47504c2d2d332e302d626c7565)[![Static Analysis](https://camo.githubusercontent.com/2b392591eb690c1ee8d511380acd01da480bee2b905808c7cfdd340f7f617d2d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5053522d31322d626c756576696f6c6574)](https://camo.githubusercontent.com/2b392591eb690c1ee8d511380acd01da480bee2b905808c7cfdd340f7f617d2d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5053522d31322d626c756576696f6c6574)

Scrape basic details from a public TikTok video URL in PHP. This is a cleaned-up, PSR‑4, PHP 8 rewrite using Guzzle and zero private APIs.

Features
--------

[](#features)

- Minimal public video details: canonical URL, IDs, username, nickname, description, thumbnail and counters
- PSR‑4 autoloaded library with typed DTO output
- Pluggable Guzzle client for testing and timeouts
- No headless browser, no TikTok private API usage

Installation
------------

[](#installation)

Install via Composer:

```
composer require haianibrahim/tiktok-scraper
```

Quick Start
-----------

[](#quick-start)

```
use GuzzleHttp\Client; // Or any ClientInterface
use Hki98\TikTok\TikTokScraper;

require __DIR__ . '/vendor/autoload.php';

$client = new Client();
$scraper = new TikTokScraper($client);

$details = $scraper->scrape('https://www.tiktok.com/@scout2015/video/6718335390845095173');

print_r($details->toArray());
```

Output shape:

- status: "ok"
- link
- user (nickname)
- username
- user\_id
- video\_id
- video\_desc
- thumbnail
- views, likes, comments, shares, favorites

API
---

[](#api)

- TikTokScraper::scrape(string $url): VideoDetails
- VideoDetails::toArray(): array

Exceptions

- Base: Hki98\\TikTok\\Exception\\TikTokScraperException (catch-all)
- Specific:
    - Hki98\\TikTok\\Exception\\InvalidUrlException
    - Hki98\\TikTok\\Exception\\HttpRequestException
    - Hki98\\TikTok\\Exception\\EmptyResponseException
    - Hki98\\TikTok\\Exception\\ParseException

Notes
-----

[](#notes)

- TikTok frequently changes HTML structure; this scraper parses the rehydration JSON in a script tag. If the key paths change, update the normalization method.
- Respect robots.txt and terms of service in your jurisdiction.

Development
-----------

[](#development)

- PHP 8.1+
- PSR‑12 coding style recommended
- Autoload: PSR‑4 under namespace `Hki98\\TikTok` (src/)

Run autoload dump after cloning:

```
composer dump-autoload
```

Credit
------

[](#credit)

- Original author: Haian K. Ibrahim ()
- HTML parsing here is regex-based for one script tag; the bundled `simple_html_dom.php` is kept for historical context but not used by the new class.

License
-------

[](#license)

GPL-3.0

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance58

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

273d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d8930ec06bf44bdb0a46c46b92dfcdb95e3c9aef77890729830b10f35775f2bc?d=identicon)[haianibrahim](/maintainers/haianibrahim)

---

Top Contributors

[![haianibrahim](https://avatars.githubusercontent.com/u/205984087?v=4)](https://github.com/haianibrahim "haianibrahim (4 commits)")

---

Tags

TikTok PHP scrapertiktok apitiktok-scrapertiktok php api

### Embed Badge

![Health badge](/badges/haianibrahim-tiktok-scraper/health.svg)

```
[![Health](https://phpackages.com/badges/haianibrahim-tiktok-scraper/health.svg)](https://phpackages.com/packages/haianibrahim-tiktok-scraper)
```

###  Alternatives

[ssovit/tiktok-api

Unofficial TikTok API for PHP

15035.9k](/packages/ssovit-tiktok-api)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
