예제 #1
0
    def load_mid_without_limit(self):
        '''

        :param limit: limit是要查询的是哪个有效的url种类
        :return: 返回的是dict
        '''
        db = MySql()
        sql = f"select mid from baida_up"
        res = db.fetch_all(sql)
        return res
예제 #2
0
    def load_mid(self, limit):
        '''

        :param limit: limit是要查询的是哪个有效的url种类
        :return: 返回的是dict
        '''
        db = MySql()
        sql = f"select mid from baida_up where {limit} = 1"
        res = db.fetch_all(sql)
        return res
예제 #3
0
 def load_url_3(self):
     sql = "select mid,url from getbvlist where valid=1"
     db = MySql()
     res = db.fetch_all(sql)
     info = []
     for i in res:
         pair = []
         pair.append(i[0])
         pair.append(i[1])
         info.append(pair)
     return info
예제 #4
0
 def load_url_5(self):
     sql = "select av,url_2 from video_url where valid_2 =1"
     db = MySql()
     res = db.fetch_all(sql)
     info = []
     for i in res:
         pair = []
         pair.append(i[0])
         pair.append(i[1])
         info.append(pair)
     return info
예제 #5
0
 def load_url_2(self):
     sql = "select mid,url_2 from baida_up where url_2_valid=1"
     db = MySql()
     res = db.fetch_all(sql)
     info = []
     for i in res:
         pair = []
         pair.append(i[0])
         pair.append(i[1])
         info.append(pair)
     print(info)
     return info
예제 #6
0
    def load_url_1(self):
        '''

        :return: mid,url_1
        '''
        sql = "select mid,url_1 from baida_up where url_1_valid=1 "
        db = MySql()
        res = db.fetch_all(sql)
        info = []
        for i in res:
            pair = []
            pair.append(i[0])
            pair.append(i[1])
            info.append(pair)
        return info
예제 #7
0
 def add_ip(self):#将ip添入ip_pool
     '''
     将代理ip添加入ip_pool
     :return:如果成功,返回true,否则,False
     '''
     print("正在添加~~~~~~")
     today = datetime.date.today()
     sql = f'''select ip from ip_pool where  valid=1  and date = "{today}"'''
     db = MySql()
     res = db.fetch_all(sql)
     print(type(res))
     if res != tuple():
         for i in res:
             self.ip_pool.append(i[0])
         print("添加成功")
         return True
     print("添加失败,数据库中没有合适的值")
     return False
예제 #8
0
 def load_url_1(self):
     db = MySql()
     sql = "select url_1 from baida_up where url_1_valid=1"
     res = db.fetch_all(sql)
     for i in res:
         self.url_item.append(i[0])
예제 #9
0
 def load_av(self):
     db = MySql()
     sql = f'''select av from bvlist'''
     res = db.fetch_all(sql)
     return res