Get preview or response values with Python crawling

Asked 2 years ago, Updated 2 years ago, 48 views

http://vod.afreecatv.com/TVCLIP From the Chrome developer tool network on that page

You can see it's called get_smr_list.php. Click on it and go to preview or response

Various values came out, so I tried to run the code below to get them.

import requests
from bs4 import BeautifulSoup as bs
header = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko'
    }
crawlUrl = 'http://stbbs.afreecatv.com/api/get_smr_list.php'
crawl = requests.get(crawlUrl,headers=header)
print(crawl.text)

Give the value that comes out when you double-click get_smr_list.php as shown below.

{"result":-3,"error":"\uc8c4\uc1a1\ud569\ub2c8\ub2e4. \uc7a0\uc2dc \ud6c4 \ub2e4\uc2dc \uc2dc\ub3c4\ud574 \uc8fc\uc2dc\uace0 \ubb38\uc81c\uac00 \ud574\uacb0\ub418\uc9c0 \uc54a\uc740 \uacbd\uc6b0 \uace0\uac1d\uc13c\ud130\ub85c \ubb38\uc758\ud574 \uc8fc\uc138\uc694."}

Ask for help on how to get the values in the picture

python crawling

2022-09-21 13:50

1 Answers

You must call post, not get.

import requests
from bs4 import BeautifulSoup as bs

header = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko'
    }
crawlUrl = 'http://stbbs.afreecatv.com/api/get_smr_list.php'
crawl = requests.post(crawlUrl, data={'command':'mainList+', 'device':'PC'}, headers=header)
print(crawl.json())
{'result': 1, 'data': {'cpid': 'CC', 'corporator code': 'tvchosun', 'corporator name': 'TV Chosun', {'cpid': 'CF', 'corporator code': 'mbn', 'corporator name': 'CD', 'corporator code': {'corporator code: 'Cpid': 'CC', 'coder code': 'coder code': 'coder code: 'coder code: 'coder': 'coder': 'coder''', 'corporatorname': 'CJ ENM'}, {'cpid': 'C3', 'corporatorcode': 'kbs', 'corporatorname': 'KBS'}, {'cpid': 'C2', 'corporatorcode': 'mbc', 'corporatorname': 'MBC'}, {'cpid': 'C1', 'corporatorcode': 'sbs', 'corporatorname': 'SBS'},...


2022-09-21 13:50

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.