Created
October 4, 2024 16:31
-
-
Save yasircs4/0fb124141c02155f5758d71c08d4aafc to your computer and use it in GitHub Desktop.
get all links from username page in tiktok
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Function to download the content as a text file | |
function downloadTxtFile(content, fileName) { | |
const element = document.createElement('a'); | |
const file = new Blob([content], { type: 'text/plain' }); | |
element.href = URL.createObjectURL(file); | |
element.download = fileName; | |
document.body.appendChild(element); | |
element.click(); | |
document.body.removeChild(element); | |
} | |
// Extract video links | |
const videoLinks = Array.from(document.querySelectorAll('.css-1uqux2o-DivItemContainerV2')) | |
.map(item => item.querySelector('a.css-1g95xhm-AVideoContainer.e19c29qe13')?.href) | |
.filter(link => link !== undefined); | |
// Join the URLs into a single string, each URL on a new line | |
const urlsText = videoLinks.join('\n'); | |
// Call the download function with the URLs and the desired filename | |
downloadTxtFile(urlsText, 'video_urls.txt'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment