code for a go tiktok bot scrapper
- User
code for a go tiktok bot scrapper
Assistant
Here is a basic Go code to scrape TikTok:
package main import ( "fmt" "net/http" "io/ioutil" "regexp" ) func main() { // TikTok URL pattern re := regexp.MustCompile(`https://www.tiktok.com/@[A-Za-z0-9_.-]+/video/[0-9A-Za-z-_]+`) // Make a GET request to the TikTok URL res, err := http.Get("https://www.tiktok.com/@someusername/video/1231231231231") if err != nil { fmt.Println(err) } defer res.Body.Close() // Read the response body body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) } // Find all video URLs in the HTML urls := re.FindAllString(string(body), -1) // Print the URLs for _, url := range urls { fmt.Println(url) } }This program:
- Defines a regex to match TikTok video URLs
- Makes a GET request to a TikTok profile page
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.