吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 941|回复: 0
收起左侧

[其他原创] 爬虫

[复制链接]
72727272 发表于 2020-9-12 19:47
爬取某某共享游戏排行榜
import requests
import re

for i in range(1,50):
    url="http://www.yx7088.com/gamelist/index.html?&p={0}".format(i)
    headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36'}
    a = requests.get(url, headers=headers)
    a.encoding = 'utf-8'
    bb = re.compile('<em>.*?<a.*?>(.*?)</a>', re.S)
    position=re.findall(bb,a.text)
    print(position)
    with open("Steam.txt", "a", encoding="utf-8") as f:
        for positions in position:
            f.write(positions + "\n")
psc.jpg
psc.gif

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-5-12 20:32

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表