python采集《狂飙》评论

632次阅读
57 条评论

共计 2114 个字符,预计需要花费 6 分钟才能阅读完成。

前言

昨晚,2023 年首部爆款剧集《狂飙》迎来大结局,一度冲上热搜第一

python 采集《狂飙》评论

“是非面前稍不留神,就会步入万丈深渊,唯有坚守信仰,才能守得初心”

python 采集《狂飙》评论

面对这么多广大网友的讨论,我也来凑上一个热闹

用 python 采集一下《狂飙》评论数据

代码展示

(源码、教程、文档 点击此处跳转 跳转文末名片加入君羊,找管理员小姐姐领取呀~ )

导入模块

import requests
import parsel
  • 1
  • 2

伪装

headers = {
    'Cookie': 'll="118267"; bid=vmTru_a25m8; __utma=30149280.50068328.1675317520.1675317520.1675317520.1; __utmc=30149280; __utmz=30149280.1675317520.1.1.utmcsr=baidu|utmccn=(organic)|utmcmd=organic; ap_v=0,6.0; _pk_ref.100001.4cf6=%5B%22%22%2C%22%22%2C1675317540%2C%22https%3A%2F%2Fwww.douban.com%2F%22%5D; _pk_ses.100001.4cf6=*; __utma=223695111.62892083.1675317540.1675317540.1675317540.1; __utmb=223695111.0.10.1675317540; __utmc=223695111; __utmz=223695111.1675317540.1.1.utmcsr=douban.com|utmccn=(referral)|utmcmd=referral|utmcct=/; __gads=ID=fb33508fbeefffdc-22b1618a7fd900c1:T=1675317540:RT=1675317540:S=ALNI_Ma0hUcCRHqTpc0wmcM01k3qpX3big; __gpi=UID=0000099c3e5d1190:T=1675317540:RT=1675317540:S=ALNI_MYqY1aqMuFbXYpmO6sFDn6zMnHB9g; __yadk_uid=KpA5hjYEmww6Sf2qskRgZamuj7aaecAC; ct=y; __utmb=30149280.3.10.1675317520; _vwo_uuid_v2=D091DE0AFC99F8C5AFC3169D9CB1E30F3|b218e266efb05a6a7a8652ac6ceecfe9; _pk_id.100001.4cf6=a8eb1a0fc7d89e94.1675317540.1.1675318206.1675317540.',
    'Host': 'movie.*****.com',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36',
}
  • 1
  • 2
  • 3
  • 4
  • 5
for page in range(0, 4000):
    print(page)
  • 1
  • 2

发送请求

    url = f'https://movie.***.com/subject/35465232/comments?start={page*20}&limit=20&status=P&sort=new_score'
  • 1
    response = requests.get(url=url, headers=headers)
    select = parsel.Selector(response.text)
    comments = select.css('.comment-item .comment')
    for comment in comments:
        name = comment.css('.comment-info a::text').get()
        try:
            score_str = comment.css('.comment-info .rating::attr(class)').get()
            score = score_str.replace('0 rating', '').replace('allstar', '')
        except:
            score = 0
        comment_time = comment.css('.comment-info .comment-time::text').get().strip()
        vote_count = comment.css('.comment-vote .votes.vote-count::text').get()
        comment_content = comment.css('.comment-content span::text').get()
        print(name, score, comment_time, vote_count, comment_content)

 

效果展示

python 采集《狂飙》评论

贴出来的代码可以采集前十页的数据

后面的评论就需要登录才可以看到采集拉

你们可以登录后改一下’Cookie’然后就可以全部采集拉~

python 采集《狂飙》评论

 

本文转载自 CDSN

正文完
 
lucky
版权声明:本站原创文章,由 lucky 2023-02-04发表,共计2114字。
转载说明:转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(57 条评论)
2024-05-09 18:36:56 回复

Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.

 Windows  Edge  美国加利福尼亚旧金山

Thanks for sharing. I read many of your blog posts, cool, your blog is very good.

 Windows  Edge  拉脱维亚Riga
2024-08-05 22:37:11 回复

lasuna cheap – buy diarex for sale purchase himcolin pills

 Windows  Chrome  罗马尼亚布加勒斯特
2024-08-18 02:30:16 回复

buy besivance eye drops – order sildamax pills order sildamax generic

 Windows  Chrome  美国佛罗里达迈阿密
2024-08-21 23:29:15 回复

neurontin 100mg pills – cost neurontin 100mg azulfidine 500mg us

 Windows  Chrome  美国加利福尼亚旧金山
2024-08-23 01:06:02 回复

benemid 500mg cost – order probenecid 500mg pills order tegretol generic

 Windows  Chrome  美国密歇根
2024-08-27 11:36:40 回复

buy colospa pills – buy colospa 135mg online pletal 100mg generic

 Windows  Chrome  俄罗斯莫斯科莫斯科
2024-08-27 14:41:12 回复

celecoxib 200mg without prescription – order generic indomethacin 50mg purchase indocin without prescription

 Windows  Chrome  巴西圣保罗圣保罗
2024-08-29 07:02:37 回复

buy priligy 30mg She went to various doctors who suggested the headaches were likely sinus related and not serious

 Windows  Chrome  美国加利福尼亚旧金山
2024-08-31 21:11:59 回复

Ovarian cancer is the deadliest gynecologic malignancy, with a 5 year survival rate of approximately 47, a number that has remained constant over the past two decades donde comprar priligy mexico ocuflox atorvastatina ingles Luckily, the truly frightening and annoying TMI announcement of these two having sex on tape was followed by the equally important, earth shattering announcement that said tape had been mercifully destroyed

 Windows  Chrome  罗马尼亚布加勒斯特
2024-09-01 13:49:19 回复

buy generic cambia – cheap aspirin 75 mg cheap aspirin 75 mg

 Windows  Chrome  美国加利福尼亚旧金山
2024-09-04 15:10:43 回复

cheap rumalaya without prescription – cheap shallaki online endep pills

 Windows  Chrome  俄罗斯列宁格勒圣彼得堡
2024-09-09 12:37:07 回复

purchase pyridostigmine online cheap – pyridostigmine online buy order imuran 25mg without prescription

 Windows  Chrome  美国加利福尼亚旧金山
2024-09-11 14:53:43 回复

voveran tablets – imdur 40mg drug buy nimodipine

 Windows  Chrome  美国加利福尼亚旧金山
2024-09-15 08:52:51 回复

lioresal oral – lioresal canada brand feldene 20 mg

 Windows  Chrome  美国加利福尼亚旧金山
2024-09-17 14:25:44 回复

order meloxicam generic – mobic medication order toradol 10mg online cheap

 Windows  Chrome  巴西圣保罗圣保罗
2024-09-18 16:01:53 回复

casibom: casibom – casibom giris
casibom guncel giris

 Windows  Chrome  美国加利福尼亚旧金山
2024-09-20 18:06:41 回复

periactin order – order periactin 4 mg generic tizanidine 2mg generic

 Windows  Chrome  美国加利福尼亚旧金山
NormanERAKS
2024-09-21 21:27:33 回复

comprar viagra en espaГ±a envio urgente: comprar viagra contrareembolso 48 horas – п»їViagra online cerca de Madrid

 Windows  Chrome  巴基斯坦Punjab
NormanERAKS
2024-09-22 11:58:24 回复

farmacias online baratas: farmacias baratas online envio gratis – farmacia online barcelona

 Windows  Chrome  意大利米兰米兰
NormanERAKS
2024-09-23 02:46:50 回复

farmacia online barata y fiable: farmacia online barata y fiable – farmacias online baratas

 Windows  Chrome  荷兰阿姆斯特丹阿姆斯特丹
2024-09-23 11:21:52 回复

artane online order – where to buy trihexyphenidyl without a prescription where can i order voltaren gel

 Windows  Chrome  巴西圣保罗圣保罗
Edisonnus
2024-09-23 23:15:22 回复

viagra online in 2 giorni: viagra – esiste il viagra generico in farmacia

 Windows  Chrome  美国加利福尼亚旧金山
Edisonnus
2024-09-24 06:18:44 回复

acquistare farmaci senza ricetta: Farmacie online sicure – acquisto farmaci con ricetta

 Windows  Chrome  意大利米兰米兰
Edisonnus
2024-09-24 13:24:35 回复

farmacia online: Farmacie online sicure – farmaci senza ricetta elenco

 Windows  Chrome  意大利米兰米兰
Edisonnus
2024-09-24 21:35:32 回复

acquisto farmaci con ricetta: Cialis generico controindicazioni – acquisto farmaci con ricetta

 Windows  Chrome  美国加利福尼亚旧金山
PatrickGroms
2024-09-25 05:46:11 回复

farmacia online: Farmacia online migliore – acquisto farmaci con ricetta

 Windows  Chrome  埃及
PatrickGroms
2024-09-26 04:57:14 回复

viagra consegna in 24 ore pagamento alla consegna: viagra senza ricetta – viagra subito

 Windows  Chrome  美国加利福尼亚旧金山
2024-09-26 21:17:41 回复

cefdinir 300 mg usa – cefdinir for sale online cleocin over the counter

 Windows  Chrome  美国加利福尼亚旧金山
PatrickGroms
2024-09-26 22:11:09 回复

comprare farmaci online all’estero: Brufen 600 senza ricetta – farmacia online piГ№ conveniente

 Windows  Chrome  荷兰阿姆斯特丹阿姆斯特丹
ArnoldnaH
2024-09-28 09:03:33 回复

lasix uses: lasix dosage – buy furosemide online

 Windows  Chrome  意大利米兰米兰
2024-09-29 02:51:05 回复

purchase absorica pill – deltasone order brand deltasone 10mg

 Windows  Chrome  俄罗斯列宁格勒圣彼得堡
Josephtiz
2024-09-29 04:48:46 回复

furosemide 100 mg: lasix 40mg – lasix furosemide

 Windows  Chrome  瑞士Zurich
Josephtiz
2024-09-29 16:29:44 回复

brand name neurontin price: neurontin 600 mg tablet – neurontin 400

 Windows  Chrome  意大利米兰米兰
Josephtiz
2024-09-30 09:19:34 回复

ventolin in usa: buy ventolin no prescription – ventolin over the counter

 Windows  Chrome  美国加利福尼亚旧金山
TimothyTrode
2024-10-01 02:27:59 回复

canadian world pharmacy: Canadian Pharmacy – best canadian pharmacy to order from

 Windows  Chrome  美国加利福尼亚旧金山
2024-10-03 03:42:32 回复

order prednisone 20mg generic – buy generic prednisolone 20mg order elimite online cheap

 Windows  Chrome  美国加利福尼亚旧金山
2024-10-04 09:58:18 回复

acticin online – acticin for sale online buy retin online

 Windows  Chrome  俄罗斯列宁格勒圣彼得堡
2024-10-08 16:46:32 回复

generic betnovate 20 gm – cheap betamethasone order monobenzone without prescription

 Windows  Chrome  美国加利福尼亚旧金山
2024-10-09 06:55:48 回复

purchase metronidazole online cheap – metronidazole 400mg ca cenforce 50mg uk

 Windows  Chrome  美国加利福尼亚旧金山
2024-10-14 09:09:57 回复

purchase amoxiclav sale – buy augmentin 375mg sale order levothyroxine for sale

 Windows  Chrome  美国加利福尼亚旧金山
2024-10-16 11:11:50 回复

cleocin 300mg drug – buy cleocin pills for sale indomethacin 50mg brand

 Windows  Chrome  俄罗斯列宁格勒圣彼得堡
2024-10-20 06:07:49 回复

buy generic hyzaar over the counter – generic cephalexin 250mg purchase keflex online

 Windows  Chrome  美国加利福尼亚旧金山
2024-10-21 08:04:31 回复

eurax order online – mupirocin for sale aczone online

 Windows  Chrome  美国加利福尼亚旧金山
2024-10-24 20:14:11 回复

buy provigil sale – promethazine for sale online melatonin 3mg without prescription

 Windows  Chrome  美国加利福尼亚旧金山
2024-10-25 11:36:56 回复

order generic bupropion – order shuddha guggulu for sale buy generic shuddha guggulu

 Windows  Chrome  巴西圣保罗圣保罗
2024-10-30 14:05:25 回复

buy prometrium 100mg sale – order progesterone for sale purchase fertomid without prescription

 Windows  Chrome  巴西圣保罗圣保罗
2024-10-30 21:09:00 回复

order xeloda 500mg – how to buy xeloda order danazol generic

 Windows  Chrome  俄罗斯列宁格勒圣彼得堡
2024-11-04 16:04:27 回复

aygestin 5 mg cheap – buy generic lumigan order yasmin sale

 Windows  Chrome  美国新泽西
2024-11-05 11:17:52 回复

fosamax 35mg drug – buy provera 5mg generic order medroxyprogesterone 5mg online cheap

 Windows  Chrome  英国伦敦伦敦
2024-11-10 17:18:22 回复

order dostinex 0.25mg for sale – buy cabgolin sale purchase alesse for sale

 Windows  Chrome  英国伦敦伦敦
2024-11-11 00:04:40 回复

Article Breast cancer risk for transgender men with inherited mutations how to buy priligy as a child IFNОі induces IRF1 expression and increases antiestrogen responsiveness

 Windows  Chrome  美国加利福尼亚旧金山
2024-11-12 16:33:31 回复

purchase yasmin sale – buy estrace paypal anastrozole 1 mg cheap

 Windows  Chrome  美国新泽西
2024-11-17 00:36:46 回复

г‚·гѓ«гѓ‡гѓЉгѓ•г‚Јгѓ« гЃЉгЃ™гЃ™г‚Ѓ – г‚їгѓЂгѓ©гѓ•г‚Јгѓ«йЂљиІ© г‚їгѓЂгѓ©гѓ•г‚Јгѓ« гЃ©гЃ“гЃ§иІ·гЃ€г‚‹

 Windows  Chrome  英国伦敦伦敦
2024-11-17 03:08:06 回复

These practices are common to the athletic community and not for the medicinal purposes of anabolic steroid therapy medicamento priligy estudios clinicos

 Windows  Chrome  美国加利福尼亚旧金山
2024-11-19 08:06:11 回复

Your article helped me a lot, is there any more related content? Thanks!

 Windows  Edge  拉脱维亚Riga
2024-11-19 12:48:27 回复

гѓ—гѓ¬гѓ‰гѓ‹гѓійЂљиІ©гЃ§иІ·гЃ€гЃѕгЃ™гЃ‹ – г‚ўгѓўг‚­г‚·г‚·гѓЄгѓійЂљиІ© 安全 アジスロマイシンの飲み方と効果

 Windows  Chrome  美国加利福尼亚旧金山