-
Notifications
You must be signed in to change notification settings - Fork 6
/
0w1.py
executable file
·148 lines (122 loc) · 3.63 KB
/
0w1.py
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import requests
import json
import sys
from gi.repository import Gtk, Gdk
def getSite(url):
headers = {
'Host': '0w1.xyz',
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0',
'Accept': '*/*',
'Accept-Language': 'tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'X-Requested-With': 'XMLHttpRequest',
'Referer': 'http://0w1.xyz/',
'Connection': 'keep-alive',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache',
}
"site = input('Site Adresi: ')"
if not (url.startswith('http://') or url.startswith('https://')):
return('Site adresi http:// ya da https:// ile başlamalıdır')
data = 'url={0}'.format(url)
r = requests.post('http://0w1.xyz/ajax.php', headers=headers, data=data)
jsonDecode = json.loads(r.text)
return jsonDecode['url']
class DoSortUrl:
def enter_callback(self, widget, entry):
entry_text = entry.get_text()
def __init__(self):
# create a new window
window = Gtk.Window()
window.set_size_request(600, 100)
window.set_resizable(False)
window.set_title("URL Shortener")
window.connect("delete_event", Gtk.main_quit)
vbox = Gtk.VBox(False, 0)
window.add(vbox)
vbox.show()
site_adres = Gtk.Label("Site Adresi:")
vbox.pack_start(site_adres, True, True, 0)
site_adres.show()
entry = Gtk.Entry()
entry.connect("activate", self.enter_callback, entry)
vbox.pack_start(entry, True, True, 0)
entry.show()
hbox = Gtk.HBox(False, 0)
vbox.add(hbox)
hbox.show()
button = Gtk.Button(label="URL Kısalt")
button.connect("clicked", lambda w: entry_ret.set_text(getSite(entry.get_text())))
vbox.pack_start(button, True, True, 0)
button.grab_default()
button.show()
kisa_url = Gtk.Label("Kısa URL:")
vbox.pack_start(kisa_url, True, True, 0)
kisa_url.show()
entry_ret = Gtk.Entry()
entry_ret.connect("activate", self.enter_callback, entry)
entry_ret.set_editable(False)
vbox.pack_start(entry_ret, True, True, 0)
entry_ret.show()
window.show()
def main():
Gtk.main()
def gtk_style():
css = b"""
* {
transition-property: color, background-color, border-color, background-image, padding, border-width;
transition-duration: 1s;
font: Cantarell 20px;
}
GtkWindow {
background: linear-gradient(to left, #2c3e50 , #3498db);
}
.entry {
color: #6B6B6B;
background: linear-gradient(to left, #485563 , #29323c); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}
*:selected {
color: black;
background: gray;
}
.button {
color: black;
background-color: #bbb;
padding:10px;
border-style: solid;
border-width: 3px 3px 3px 3px;
border-color: #333;
padding: 12px 4px;
}
.button:first-child {
border-radius: 5px 0 0 5px;
}
.button:last-child {
border-radius: 0 5px 5px 0;
border-width: 2px;
}
.button:hover {
padding: 12px 48px;
background-color: #6B6B6B;
}
.button *:hover {
color: white;
}
.button:hover:active,
.button:active {
background-color: #6B6B6B;
}
"""
style_provider = Gtk.CssProvider()
style_provider.load_from_data(css)
Gtk.StyleContext.add_provider_for_screen(
Gdk.Screen.get_default(),
style_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
)
if __name__ == "__main__":
gtk_style()
DoSortUrl()
main()