N
N
Nurasyl Mels2020-09-03 08:17:08
Python
Nurasyl Mels, 2020-09-03 08:17:08

Why does it return when parsed?

It was necessary to parse the number of subscribers in TikTok in Python. Wrote the following code:

import requests
from bs4 import BeautifulSoup

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36'}

username = 'melsuly'
ttURL = 'https://tiktok.com/@' + username

html = requests.get(ttURL, headers)
print(html.content)


On the user's page(For example: tiktok.com/@melsuly) returns b''. But if you try to parse the main page or other sites, then everything is fine. Maybe someone knows?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
d-sem, 2020-09-03
@nurasyl_mels

html = requests.get(ttURL, headers=headers)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question