def __init__(self):
     self.tiebaName = input("请需要访问的贴吧:")
     self.beginPage = int(input("请输入起始页:"))
     self.endPage = int(input("请输入终止页:"))
     self.num =1
     self.url = 'http://tieba.baidu.com/f?'
     self.headers =User_Agt()
    def run(self):
        '''逻辑处理'''
        self.get_data()
        # 获取页码列表
        page = self.get_url_list()
        print(page)

        # 遍历每页数据
        for num in page:
            # 设置页码
            self.pamans['pn'] = num
            print(self.pn)
            # 获取当前页数据
            # data = self.get_data()
            # 调用发送函数,发送请求相应
            resp = self.pares_url()
            # 随机产生一个用户代理
            self.header = User_Agt()
            # 调用保存数据方法,进行数据保存
            self.save_data(resp)
        print(BaiduZhaopin.count)
        # 当把所有页码遍历结束后,将数据保存成csv
        data1 = pandas.DataFrame(BaiduZhaopin.list1)
        data1.to_csv('最新招聘信息.csv', encoding='gb18030')
Exemple #3
0
 def __init__(self):
     self.url = None
     self.user_agt = User_Agt()
 def __init__(self):
     self.get_url = 'http://zhaopin.baidu.com/api/quanzhiasync?'
     self.headers = User_Agt()
     self.city = '西安'
     self.name = 'python'
     self.pn = 0
Exemple #5
0
# -*- coding:utf-8 -*-
import requests
from User_agent import User_Agt
user_url = 'http://www.renren.com/327550029/profile'
post_url = 'http://www.renren.com/PLogin.do'
post_data = {"email": "*****@*****.**", "password": "******"}
headers = User_Agt()

# 实例化session
session = requests.session()

res = session.post(post_url, data=post_data, headers=headers)

# 请求个人主页
session.get(user_url, headers=headers)

res2 = session.post(user_url, data=post_data, headers=headers)

print(res2.status_code)
 def __init__(self, tiba_name):
     self.url_temp = 'https://tieba.baidu.com/f?kw=' + tiba_name + '&pn={}'
     self.headers = User_Agt()
     self.name = tiba_name
Exemple #7
0
    def __init__(self):

        self.url = 'https://www.qiushibaike.com/imgrank/page/{}/'
        self.user_agt = User_Agt()