Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ie/tiktok] Add device_id extractor-arg #9951

Merged
merged 6 commits into from
May 20, 2024

Conversation

bashonly
Copy link
Member

Per #9506 (comment), some success can be had with mobile API extraction if the user passes a genuine device_id instead of relying on the semi-random value the extractor uses. An iid may not even be necessary if the device ID is trusted; so this patch also enables API extraction when only a device_id is passed (and it then omits iid from the API call's query params).

The actual device_id can be found in the mobile app's settings screen, making this a much more user-friendly alternative to the iid.

Credit to @renandecarlo for discovering this.

Partially addresses #9506

Template

Before submitting a pull request make sure you have:

In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check all of the following options that apply:

  • I am the original author of this code and I am willing to release it under Unlicense

What is the purpose of your pull request?

  • Fix or improvement to an extractor (Make sure to add/update tests)

@bashonly bashonly added the site-bug Issue with a specific website label May 18, 2024
Authored by: bashonly
Authored by: bashonly
Authored by: bashonly
Copy link

@yeeterlol yeeterlol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need an IID,
yt-dlp.cmd --extractor-args "tiktok:device_id=716xxxxxxxxxx939" https://www.tiktok.com/@prodvmaia8765/video/7274415859341511982
[TikTok] Extracting URL: https://www.tiktok.com/@prodvmaia8765/video/7274415859341511982
[TikTok] 7274415859341511982: Downloading video feed
WARNING: [TikTok] 7274415859341511982: Failed to parse JSON (caused by JSONDecodeError("Expecting value in '': line 1 column 1 (char 0)")); trying with webpage
[TikTok] 7274415859341511982: Downloading webpage
[info] 7274415859341511982: Downloading 1 format(s): download

tested in your branch too btw

@qinjing100
Copy link

The actual device_id can be found in the mobile app's settings screen, making this a much more user-friendly alternative to the iid.

I want to know how get the device_id from the settings screen ?
Could you show detail steps , thx.

@renandecarlo
Copy link

renandecarlo commented May 18, 2024

The actual device_id can be found in the mobile app's settings screen, making this a much more user-friendly alternative to the iid.

I want to know how get the device_id from the settings screen ? Could you show detail steps , thx.

Go to tiktok app settings, go to the bottom, tap 5x on the version number

@qinjing100
Copy link

The actual device_id can be found in the mobile app's settings screen, making this a much more user-friendly alternative to the iid.
I want to know how get the device_id from the settings screen ? Could you show detail steps , thx.

Go to tiktok app settings, go to the bottom, tap 5x on the version number

@renandecarlo thx so much, I got the device_id info by your instructions.
btw, how to get install unique id (iid) ? Could you give me some help ?

@renandecarlo
Copy link

The actual device_id can be found in the mobile app's settings screen, making this a much more user-friendly alternative to the iid.
I want to know how get the device_id from the settings screen ? Could you show detail steps , thx.

Go to tiktok app settings, go to the bottom, tap 5x on the version number

@renandecarlo thx so much, I got the device_id info by your instructions. btw, how to get install unique id (iid) ? Could you give me some help ?

The iid you get only get through mitm, but you can try without it, just using the device_id.

Here's a few hosts for you to try also:
api22-normal-v4.tiktokv.com
api16-normal-v4.tiktokv.com
api16-normal-useast1a.tiktokv.com
api16-normal-useast2a.tiktokv.com
api31-normal-useast1a.tiktokv.com
api31-normal-useast2a.tiktokv.com
api22-normal-c-useast1a.tiktokv.com
api22-normal-c-useast2a.tiktokv.com
api22-normal-c.tiktokv.com
api16-normal-c.tiktokv.com

yt_dlp/extractor/tiktok.py Outdated Show resolved Hide resolved
@bashonly bashonly merged commit 3584b83 into yt-dlp:master May 20, 2024
6 checks passed
@bashonly bashonly deleted the fix/tiktok-device-id branch May 22, 2024 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site-bug Issue with a specific website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants