add get_id.py
This commit is contained in:
parent
1bd8ee4a9b
commit
53eebd8987
@ -10,7 +10,7 @@ total_count = 0
|
||||
my_catch_count = 0
|
||||
|
||||
flarum_remember = "izvHQwoKddgwYWC9e1dFLfcADCOjMnhl2xIEk2BP"
|
||||
flarum_session = "cgU39wNNAsVd6JbmaIpHZk7AyetKlOrk17ESRe4x"
|
||||
flarum_session = "c8zulxRXQjrOMFYNQOUv0ze2H9Lg57OLWtFLYCow"
|
||||
|
||||
cookies = {
|
||||
# "flarum_remember": "izvHQwoKddgwYWC9e1dFLfcADCOjMnhl2xIEk2BP",
|
||||
@ -52,7 +52,7 @@ headers1 = {
|
||||
"Sec-Fetch-Mode": "cors",
|
||||
"Sec-Fetch-Site": "same-origin",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36",
|
||||
"X-Csrf-Token": "OPR3t2ceXu0C24RtYGYEa6LUdkYwYRI0dMgHpE3g"
|
||||
"X-Csrf-Token": "ymGMXtNP0LQ371ogq2Du3exUiWX1JU4B8BWtG15i"
|
||||
}
|
||||
|
||||
|
||||
|
||||
46
get_id.py
Normal file
46
get_id.py
Normal file
@ -0,0 +1,46 @@
|
||||
import requests
|
||||
import time
|
||||
|
||||
base_url = "https://invites.fun/api/users?include&sort&page%5Boffset%5D="
|
||||
|
||||
keyword = "catchthefish-fishes"
|
||||
total_count = 0
|
||||
usernames = []
|
||||
|
||||
cookies = {
|
||||
"flarum_remember": "izvHQwoKddgwYWC9e1dFLfcADCOjMnhl2xIEk2BP",
|
||||
"flarum_session": "sGfH8SLqRdmVU4b9p9IIcIu2LEmL6vt0BtkR4GS9"
|
||||
}
|
||||
|
||||
headers = {
|
||||
"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36'
|
||||
}
|
||||
|
||||
for offset in range(0, 2001, 20):
|
||||
url = base_url + str(offset)
|
||||
response = requests.get(url, cookies=cookies, headers=headers)
|
||||
|
||||
if response.status_code == 200:
|
||||
count = response.text.count(keyword)
|
||||
total_count += count
|
||||
|
||||
if count > 0:
|
||||
index = response.text.find(keyword)
|
||||
start_index = response.text.rfind('"username"', 0, index) + 12
|
||||
end_index = response.text.find('"', start_index)
|
||||
username = response.text[start_index:end_index]
|
||||
usernames.append(username)
|
||||
print("第一个出现的用户名(username):", username)
|
||||
|
||||
print("当前 offset 值:", offset)
|
||||
print("关键词“catchthefish-fishes”出现的次数:", count)
|
||||
|
||||
count = 0 # 清零关键词出现的次数
|
||||
|
||||
time.sleep(1) # 延时1秒
|
||||
|
||||
print("最终关键词“catchthefish-fishes”出现的次数:", total_count)
|
||||
|
||||
print("所有获取到的用户名(username):")
|
||||
for username in usernames:
|
||||
print(username)
|
||||
Loading…
x
Reference in New Issue
Block a user