GET STARTED
Home Blog

How to Scrape TikTok Indonesia Food Recipe Data for Using Data Extraction, Exploration and Data Visualization?

how-to-scrape-tiktok

How to Scrape TikTok Indonesia Food Recipe Data for Using Data Extraction, Exploration and Data Visualization?

During the Covid-19 pandemic, we have seen changes in people’s story updates and Instagram posts. From posts like hangouts, parties, and travel, it’s shifting to the home activities about gardening, cooking, and Netflix binge-watching!

During-the-Covid-19

We have seen similar dishes which people try and post on social media. It began with dalgona coffee in March-April 2020 with Korean garlic cheese bun. We have seen people sharing different recipes on TikTok, having demo recipe videos.

If you want to explore TikTok posts using some hashtags, which people use for exploring recipes at home. Our objective is very simple :

Extract a few top TikTok posts using the hashtags

Scrape captions, views, and likes to check for all interesting trends —playing with the data.

Collecting TikTok Data

Here, we have used an API from Food Data Scrape. The complete code of TikTok scraping code can be found here.

1. Collect Data from Food Data Scrape Endpoints

Here we are using Python HTTP request comments, calling Food Data Scrape endpoints using a hashtag query needed. We have pre-defined a count of posts to get captured like 1000 posts(from maximum 2000 request or posts)

Here-we-are-using-Python

2. Parsing response data

From the given script, we would get responses to JSON data.

From-the-given-script.jpg

Then, we are parsing data in data frame format for columns that we need: user_name, video URL, caption, comments, plays, like counts, and shares.

Then-we-are-parsing-1 Then-we-are-parsing-2

3. Scrape hashtags and mentions from captions

Here, the code is given to extract data from food recipe with mentions and hashtags from the string.

Scrape-hashtags-and-mentions-1 Scrape-hashtags-and-mentions-2

And that’s it! You have some datasets to play with!

Data Backbiting Time!

Data Backbiting Time!

  • Timeseries trends of posts
  • Plays, shares, and likes distribution across different accounts
  • Content of common recipes

Beginning from a few time-series analysis, a trend is here of posts over time. Just look at the timeseries charts given below to get a few insights:

Video posts are in uptrends since March 2020, topping in May 2020 (Indonesia Ramadhan season). In the last 2 months, total videos getting posted are stable of ~10 posts per day.

The length of posted videos also has an uptrend. This was ~40 seconds during April 2020 and reached ~60 seconds during August 2020.

Afternoon time: 3 to 7 pm looks to be peak hours when people post cooking tutorials. Looking for afternoon snacks or dinner, maybe?

Data-Backbiting-Time-1 Data-Backbiting-Time-2 Data-Backbiting-Time-3

How about posting trends across different accounts? Stimulatingly, for top 15 users having maximum posts, we observe a different spreading of shares and likes. Accounts including ‘fahmimiasmr’, ‘2beha10ribu’, and ‘venithyacalistaa’ have higher likes distribution, getting more than 1mio likes. Instead, ‘cookingwithhel’ is a winner for circulation of shares. One of the posts has even reached 70k shares.

How-about-posting-1 How-about-posting-2

The largest challenge here is to scrape dish names from given posts’ captions because in the TikTok posts you can just type anything without any organized fields. Similarly, the videos could be edited to exhibit the dish names rather than using captions. Here, we used many data cleansing procedures like removing special characters and numbers, filtering word noise (common words and stop words on posts), and scraping dish names from well-known trigrams and bigrams in a dataset.

A few word clouds of food are in bigrams, trigrams, and unigram. You might need to translate that as it’s within Bahasa Indonesia, however the components are mostly associated to snacks and desserts— oreo, martabak, cake, chocolate, milo, cheese stick, pie, pudding, etc. It’s easily understandable that the peak hours of the posts are during the afternoon as all these are ideal afternoon snacks!

And the most popular dishes include:

And-the-most-popular-dishes-include-1 And-the-most-popular-dishes-include-2 And-the-most-popular-dishes-include-3

There are different recipes about the dishes here and some posts referring the similar dishes. Summarizing rapidly, here are all viral food recipes of TikTok Indonesia:

Desserts : dessert box, brownies, cake, milk pie, smoothies bowl

Snacks : potato hotdog, rolled egg, fried tofu, coffee bread, mochi

Savory dishes : Korean fried rice, meatballs, chicken katsu, grilled chicken,

Many of them look to be snacks and desserts opposed to other side dishes to get consumed with rice.

Some additional viz for making a more extravagant wordcloud — We are using pylab and PIL to get the image color as a background of a word cloud.

Some-additional-viz

Conclusion

This concludes our discovery for important food recipes from TikTok Indonesia. Though there are boundless possibilities to extract data online, we still have to be aware of the proper stands about it. Just remember that you extract data from food recipe from only publicly accessible data and not in the destructive manner of the server accounts.

For more information about TikTok Indonesia Food Data Scraping , contact Food Data Scrape!

Get in touch

Get in touchWe will Catch You as early as we recevie the massage

Trusted by the best of the food industry
assets/img/clients/deliveroo-logo.png
assets/img/clients/doordash-logo-02.png
assets/img/clients/grubhub-logo-02.png
assets/img/clients/i-food-logo-02.png
assets/img/clients/swiggy-logo-02.png
assets/img/clients/deliveroo-logo.png