tiktok-scraper

tiktok dl links scraper

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         tiktok-scraper
// @namespace    https://greasyfork.org/en/users/14470-sewil
// @version      1.0.0
// @description  tiktok dl links scraper
// @author       Sewil
// @match        https://www.tiktok.com/@*
// @require      https://code.jquery.com/jquery-3.6.0.min.js
// @require      https://cdnjs.cloudflare.com/ajax/libs/arrive/2.4.1/arrive.min.js
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tiktok.com
// @grant        none
// @license      MIT
// ==/UserScript==

console.log('tiktok-scraper');
var links = {};

var navSelector = "a[data-e2e='tiktok-logo']";
var parentSelector =
    '#app > div.tiktok-ywuvyb-DivBodyContainer.e1irlpdw0 > div.tiktok-w4ewjk-DivShareLayoutV2.enm41490 > div > div.tiktok-xuns3v-DivShareLayoutMain.ee7zj8d4 > div.tiktok-1qb12g8-DivThreeColumnContainer.eegew6e2 > div';
var selector =
    parentSelector +
    '> div > div.tiktok-x6f6za-DivContainer-StyledDivContainerV2.eq741c50 > div > div > a';
$(document).ready(function () {
    $(navSelector).after(
        $(
            '<input id="tiktok-scraper_button" type="button" value="DL Links (0)" style="margin-left: 10px;"/>'
        )
    );
    $('#tiktok-scraper_button').on('click', function () {
        var json = [Object.keys(links).join('\n')];
        var blob = new Blob(json, { type: 'text/plain;charset=utf-8' });
        var url = window.URL || window.webkitURL;
        var link = url.createObjectURL(blob);
        var a = $('<a />');
        a.attr('download', 'links.txt');
        a.attr('href', link);
        $('body').append(a);
        a[0].click();
        $('body').remove(a);
    });
    console.log('tiktok-scraper ready');
    $(selector).each(handleLink);
    $(document).arrive(selector, function () {
        $(selector).each(handleLink);
    });
    function handleLink() {
        var link = $(this).attr('href');
        console.log(link);
        links[link] = '';
        $('#tiktok-scraper_button').val(
            'DL Links (' + Object.keys(links).length + ')'
        );
    }
});