Exemplo n.º 1
0
 def freeproxyseventh():
     """
     快代理 https://www.kuaidaili.com
     """
     url_list = [
         'https://www.kuaidaili.com/free/inha/',
         'https://www.kuaidaili.com/free/intr/'
     ]
     for url in url_list:
         tree = getHtmlTree(url)
         proxy_list = tree.xpath('.//table//tr')
         for tr in proxy_list[1:]:
             yield ':'.join(tr.xpath('./td/text()')[0:2])
Exemplo n.º 2
0
 def freeproxythird(days=1):
     """
     ip181 http://www.ip181.com/  不能用了
     :param days:
     :return:
     """
     url = 'http://www.ip181.com/'
     html_tree = getHtmlTree(url)
     try:
         tr_list = html_tree.xpath('//tr')[1:]
         for tr in tr_list:
             yield ':'.join(tr.xpath('./td/text()')[0:2])
     except Exception as e:
         pass
Exemplo n.º 3
0
 def freeproxytwelve(page_count=2):
     """
     http://ip.jiangxianli.com/?page=
     免费代理库
     超多量
     :return:
     """
     for i in range(1, page_count + 1):
         url = 'http://ip.jiangxianli.com/?page={}'.format(i)
         html_tree = getHtmlTree(url)
         tr_list = html_tree.xpath(
             "/html/body/div[1]/div/div[1]/div[2]/table/tbody/tr")
         if len(tr_list) == 0:
             continue
         for tr in tr_list:
             yield tr.xpath("./td[2]/text()")[0] + ":" + tr.xpath(
                 "./td[3]/text()")[0]
Exemplo n.º 4
0
 def freeproxyfourth(page_count=1):
     """
     西刺代理 http://www.xicidaili.com
     :return:
     """
     url_list = [
         'http://www.xicidaili.com/nn/',  # 高匿
         'http://www.xicidaili.com/nt/',  # 透明
     ]
     for each_url in url_list:
         for i in range(1, page_count + 1):
             page_url = each_url + str(i)
             tree = getHtmlTree(page_url)
             proxy_list = tree.xpath(
                 './/table[@id="ip_list"]//tr[position()>1]')
             for proxy in proxy_list:
                 try:
                     yield ':'.join(proxy.xpath('./td/text()')[0:2])
                 except Exception as e:
                     pass
Exemplo n.º 5
0
 def freeproxyfirst(page=10):
     """
     无忧代理 http://www.data5u.com/
     几乎没有能用的
     :param page: 页数
     :return:
     """
     url_list = [
         'http://www.data5u.com/',
         'http://www.data5u.com/free/gngn/index.shtml',
         'http://www.data5u.com/free/gnpt/index.shtml'
     ]
     for url in url_list:
         html_tree = getHtmlTree(url)
         ul_list = html_tree.xpath('//ul[@class="l2"]')
         for ul in ul_list:
             try:
                 yield ':'.join(ul.xpath('.//li/text()')[0:2])
             except Exception as e:
                 print(e)
Exemplo n.º 6
0
 def freeproxyfifth():
     """
     guobanjia http://www.goubanjia.com/
     :return:
     """
     url = "http://www.goubanjia.com/"
     tree = getHtmlTree(url)
     proxy_list = tree.xpath('//td[@class="ip"]')
     # 此网站有隐藏的数字干扰,或抓取到多余的数字或.符号
     # 需要过滤掉<p style="display:none;">的内容
     xpath_str = """.//*[not(contains(@style, 'display: none'))
                                     and not(contains(@style, 'display:none'))
                                     and not(contains(@class, 'port'))
                                     ]/text()
                             """
     for each_proxy in proxy_list:
         try:
             # :符号裸放在td下,其他放在div span p中,先分割找出ip,再找port
             ip_addr = ''.join(each_proxy.xpath(xpath_str))
             port = each_proxy.xpath(
                 ".//span[contains(@class, 'port')]/text()")[0]
             yield '{}:{}'.format(ip_addr, port)
         except Exception as e:
             pass