<listing id="fdftx"></listing>

        <address id="fdftx"></address>
        <address id="fdftx"><address id="fdftx"><nobr id="fdftx"></nobr></address></address>
        <address id="fdftx"><listing id="fdftx"><nobr id="fdftx"></nobr></listing></address>

        <address id="fdftx"><nobr id="fdftx"><meter id="fdftx"></meter></nobr></address><address id="fdftx"><th id="fdftx"><progress id="fdftx"></progress></th></address>

          教你如何抓取免費ip代理的方式

          發布時間:2020-07-10 關注熱度:°C

            在網上看到我們可以通過抓取一些提供免費ip代理的網站,來使用ip代理,可以怎么樣來抓取呢?下面IP海來教大家一個方法,大家可以參考看看,以下是操作代碼:

            #coding=utf-8

            import re

            import urllib.request

            import urllib.parse

            import os

            from urllib.error import URLError,HTTPError

            url='http://www.kuaidaili.com/ops/' #http://www.xicidaili.com/ http://www.proxy#/default.aspx http://www.kuaidaili.com/ops/

            headers={'Accept':'text/html,application/xhtml+xm…plication/xml;q=0.9,*/*;q=0.8',

            'Accept-Encoding':'gzip,deflate',

            'Accept-Language':'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',

            'Host':'fs.xicidaili.com',

            'Cookie':'Hm_lvt_0cf76c77469e965d2957f0553e6ecf59=1511441689,1511784134,1511785760; Hm_lpvt_0cf76c77469e965d2957f0553e6ecf59=1511785760',

            'Connection':'keep-alive',

            'User-Agent':'Mozilla/5.0 (Windows NT 6.1; W…) Gecko/20100101 Firefox/57.0'

            }

            headers=urllib.parse.urlencode(headers).encode('utf8')

            rep=urllib.request.Request(url,headers)

            reponse=urllib.request.urlopen(rep)

            html=reponse.read().decode(encoding='UTF-8')

            reg=r'(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'

            ip_list=re.findall(reg,html)

            print(ip_list)

            f=open('ip.txt','a')

            f.write(str(ip_list)+' ')

            f.close()

            

          抓取免費ip代理使用的方式

            

          抓取免費ip代理使用的方式

            這樣我們就能夠把網站上面提供的免費IP抓取來使用了,但是要注意免費IP的質量比較不穩定,需要經過檢測才可以使用。

           

          版權聲明:本文為IP海(iphai.cn)原創作品,未經許可,禁止轉載!

          Copyright © www.skldkt.com. All Rights Reserved. IP海 版權所有.
          IP海僅提供中國內IP加速服務,無法跨境聯網,用戶應遵守《服務條款》內容,嚴禁用戶使用IP海從事任何違法犯罪行為。
          ICP備案鄂ICP備19030659號-3 公安備案鄂公網安備42100302000141號 計算機軟件著作權證計算機軟件著作權證 ICP/EDI許可證ICP/EDI許可證:鄂B2-20200106

          微信掃一掃咨詢
          国产福利第一页