Error handler and allow video IDs from app share

This commit is contained in:
Pablo Ferreiro 2022-01-11 19:25:30 +01:00
parent f18dd802d5
commit 93de0c2d23
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24
9 changed files with 107 additions and 20 deletions

View file

@ -1,7 +1,7 @@
From 7c52f9291fbd15d912fa78d0301939e3aa9deec4 Mon Sep 17 00:00:00 2001
From: attend-dunce <96889312+attend-dunce@users.noreply.github.com>
Date: Thu, 30 Dec 2021 21:35:14 +0100
Subject: [PATCH 1/3] Fixed `getUser`
Subject: [PATCH 1/4] Fixed `getUser`
---
lib/TikTok/Api.php | 16 +++++++---------

View file

@ -1,7 +1,7 @@
From c948bda5d6f30929b448fe78a0920739d5792d4b Mon Sep 17 00:00:00 2001
From: attend-dunce <96889312+attend-dunce@users.noreply.github.com>
Date: Fri, 31 Dec 2021 00:55:23 +0100
Subject: [PATCH 2/3] Added support for username as well as user id
Subject: [PATCH 2/4] Added support for username as well as user id
---
lib/TikTok/Api.php | 3 ++-

View file

@ -1,14 +1,14 @@
From c23e8dbf0bd722799cf19182142d4b177f8fd933 Mon Sep 17 00:00:00 2001
From 816ebe168d12923944b81b3f10bb22baf58efd66 Mon Sep 17 00:00:00 2001
From: Pablo Ferreiro <pferreiromero@gmail.com>
Date: Sat, 8 Jan 2022 15:47:21 +0100
Subject: [PATCH 3/3] Fixed getVideoByUrl
Date: Tue, 11 Jan 2022 19:09:08 +0100
Subject: [PATCH 3/4] Fixed getVideoByUrl
---
lib/TikTok/Api.php | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
lib/TikTok/Api.php | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/lib/TikTok/Api.php b/lib/TikTok/Api.php
index 8fd42ae..f800555 100644
index 8fd42ae..21ebff1 100644
--- a/lib/TikTok/Api.php
+++ b/lib/TikTok/Api.php
@@ -483,20 +483,27 @@ if (!\class_exists('\Sovit\TikTok\Api')) {
@ -45,6 +45,11 @@ index 8fd42ae..f800555 100644
];
if ($this->cacheEnabled) {
$this->cacheEngine->set($cacheKey, $result, $this->_config['cache-timeout']);
@@ -590,3 +597,4 @@ if (!\class_exists('\Sovit\TikTok\Api')) {
}
}
}
+
--
2.34.1

View file

@ -0,0 +1,33 @@
From e8dcb7cf3824803d8b431dc923c479cd10102cbc Mon Sep 17 00:00:00 2001
From: Pablo Ferreiro <pferreiromero@gmail.com>
Date: Tue, 11 Jan 2022 19:18:16 +0100
Subject: [PATCH 4/4] Allow IDs from Android/iOS share
---
lib/TikTok/Api.php | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/TikTok/Api.php b/lib/TikTok/Api.php
index 21ebff1..f83f5bd 100644
--- a/lib/TikTok/Api.php
+++ b/lib/TikTok/Api.php
@@ -462,7 +462,15 @@ if (!\class_exists('\Sovit\TikTok\Api')) {
if (empty($video_id)) {
throw new \Exception("Invalid VIDEO ID");
}
- return $this->getVideoByUrl('https://m.tiktok.com/v/' . $video_id . '.html');
+
+ $url = '';
+ if (is_numeric($video_id)) {
+ $url = 'https://m.tiktok.com/v/' . $video_id . '.html';
+ } else {
+ $url = 'https://vm.tiktok.com/' . $video_id;
+ }
+
+ return $this->getVideoByUrl($url);
}
/**
* Get Video By URL
--
2.34.1