How To Scrape TikTok Indonesia Food Recipe Data For Using Data Extraction, Exploration And Data Visualization?
Tags: webdev, datascience, scrapefoodrecipedata, scrapetiktokindonesiafooddata
Published: 2022-12-06 12:22:29


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qss6zsiog0w7vv6vg4w1.jpg)

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!

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)


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

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.

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!

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?

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.

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:

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.

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 data scraping, contact Food Data Scrape!

Know more : [https://www.fooddatascrape.com/how-to-scrape-tiktok-indonesia-food-recipe-data-for-using-data-extraction-exploration-and-data-visualization.php](https://www.fooddatascrape.com/how-to-scrape-tiktok-indonesia-food-recipe-data-for-using-data-extraction-exploration-and-data-visualization.php)