mirror of
https://github.com/imputnet/cobalt.git
synced 2024-12-26 17:46:06 +00:00
api/tiktok: catch unavailable post error
Some checks are pending
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
Run service tests / test service functionality (push) Waiting to run
Run service tests / test service: ${{ matrix.service }} (push) Blocked by required conditions
Run tests / check lockfile correctness (push) Waiting to run
Run tests / web sanity check (push) Waiting to run
Run tests / api sanity check (push) Waiting to run
Some checks are pending
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
Run service tests / test service functionality (push) Waiting to run
Run service tests / test service: ${{ matrix.service }} (push) Blocked by required conditions
Run tests / check lockfile correctness (push) Waiting to run
Run tests / web sanity check (push) Waiting to run
Run tests / api sanity check (push) Waiting to run
This commit is contained in:
parent
569c232b47
commit
6ca377ded6
|
@ -44,9 +44,19 @@ export default async function(obj) {
|
|||
try {
|
||||
const json = html
|
||||
.split('<script id="__UNIVERSAL_DATA_FOR_REHYDRATION__" type="application/json">')[1]
|
||||
.split('</script>')[0]
|
||||
const data = JSON.parse(json)
|
||||
detail = data["__DEFAULT_SCOPE__"]["webapp.video-detail"]["itemInfo"]["itemStruct"]
|
||||
.split('</script>')[0];
|
||||
|
||||
const data = JSON.parse(json);
|
||||
const videoDetail = data["__DEFAULT_SCOPE__"]["webapp.video-detail"];
|
||||
|
||||
if (!videoDetail) throw "no video detail found";
|
||||
|
||||
// status_deleted or etc
|
||||
if (videoDetail.statusMsg) {
|
||||
return { error: "content.post.unavailable"};
|
||||
}
|
||||
|
||||
detail = videoDetail?.itemInfo?.itemStruct;
|
||||
} catch {
|
||||
return { error: "fetch.fail" };
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue