-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.py
More file actions
44 lines (40 loc) · 1.6 KB
/
Copy pathstart.py
File metadata and controls
44 lines (40 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import requests
import time
api_key = "YOUR_API_KEY" # Api key
reklam_tipi = 1
# 5 -> Film/Dizi
# 4 -> Spor/Futbol
# 3 -> Oyun/İndirme
# 2 -> Diğer
# 1 -> Yetişkin içerik +18
def log(log_text):
log_text = str(time.strftime("%Y.%m.%d %H:%M:%S")) + " ➾ " + log_text
print(log_text)
log_file = open("log.txt", "a", encoding='utf-8')
log_file.write(log_text + "\n")
log_file.close()
log('Program başladı.')
log('Yapımcı: Can')
log('GitHub: https://github.com/fastuptime')
with open('links.txt', 'r', encoding='utf-8') as f:
links = f.read()
links = links.split('\n')
for link in links:
try:
r = requests.get('https://ay.live/api/?api=' + api_key + '&url=' + link + '&alias&ct=' + str(reklam_tipi))
if r.status_code == 200:
json_data = r.json()
if json_data['status'] == 'success':
log(link + ' başarılı bir şekilde kısaltıldı. Kısa link; ' + json_data['shortenedUrl'])
#file = 'Normal URL: ' + link + ' Short URL: ' + json_data['shortenedUrl']
file = json_data['shortenedUrl'] + '|' + link
with open('shortened_links.txt', 'a', encoding='utf-8') as f:
f.write(file + '\n')
else:
log(link + ' kısaltılırken hata oluştu. ' + json_data)
else:
log(link + ' kısaltılamadı')
time.sleep(3)
except:
log(link + ' kısaltılamadı')
time.sleep(3)