rch_words}&count=200&offset={200*i}&v=5.103").json()["response"] for i in range(5)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ilya-\Downloads\Telegram Desktop\search_anime.py", line 34, in <listcomp>
response = [requests.get(f"https://api.vk.com/method/newsfeed.search?access_token={token}&q=https://vk.me/join/ {search_words}&count=200&offset={200*i}&v=5.103").json()["response"] for i in range(5)]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'response'
import requests
import re
token = "vk1.a.X-1R32G2V87mZDKQavOrHMCdreIp34JuBZkTvHzfXI4rJOpUbxs4LDsufQNbK2aqSOwWwOtGaB2JkUdaqZ6HbYO01GZSTh62yjgVFlevflC6PBl6nZzw5IGHyzfXUnGFHP8Ep9zaU75aTvQyzqANBNEzt6die64WQ83-C4Dy1jg" #токен
member = 5
sprint = 1000
while member < sprint:
member += 50
member_count = member #кол-во челов в конфе
search_words = "подслушано" #поисковое слово(-а)
def search_links(text):
a = text.split("https://")
b = []
for i in a[1:]:
link = "https://" + i
try:
b.append(re.search("(?P<url>https?://[^\s]+)", link).group("url"))
except:
pass
links = []
for i in b:
if "vk.me/join" in i:
links.append(i)
return links
LINKS = []
response = [requests.get(f"https://api.vk.com/method/newsfeed.search?access_token={token}&q=https://vk.me/join/ {search_words}&count=200&offset={200*i}&v=5.103").json()["response"] for i in range(5)]
for k in response:
chats = k["items"]
for i in chats:
links = search_links(i["text"])
for j in links:
if j not in LINKS:
LINKS.append(j)
for link in LINKS:
try:
response = requests.get(f"https://api.vk.com/method/messages.getChatPreview?access_token={token}&link={link}&v=5.103").json()["response"]["preview"]
members = response["members_count"]
if int(members) >= member_count:
print(response["title"])
print(link)
except:
pass
Я новичок и не понимаю суть ошибки. Помогите, пожалуйста.