This repository has been archived by the owner on Nov 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathspearKEYWORD.py
208 lines (189 loc) · 8.22 KB
/
spearKEYWORD.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
import json
import requests
import datetime
import csv
import time
from datetime import datetime
import pandas as pd
#THIS TOOL MADED BY Mangetsuuuuuuu
#CONTACT Mangetsuuuuuuu
keyword =""
tag=""
#you can change api = "YOUR API" to save time
#delete from line 16 to 26
#and in new line type api=YOURAPI
api=str(input('''
___________________ __
/ ____/_ __/ ___/\ \/ /
/ __/ / / \__ \ \ /
/ /___ / / ___/ / / /
/_____/ /_/ /____/ /_/
By Mangetsuuuuuuu
Get You Api From https://www.etsy.com/developers/register
NOTE : SHOULD BE ACTIVE
Enter Your Api : '''))
method_search=str(input('''
1 - Search By keyword
2 - Search By Tag
3 - Search By Keyword + Tag
Enter Number :'''))
all_or_no = str(input('''
1 - all
2 - only digital
Enter Number :'''))
cool = ['vw','fav','Date','Qnt','price','title','url']
with open(f'Done.csv' , 'a', encoding='utf8') as done:
writer = csv.writer(done)
writer.writerow(cool)
ok = slice(0,-13)
def keyword_digital(keyword,api):
for page in range(1,501):
r = requests.get(f'https://openapi.etsy.com/v2/listings/active?keywords={keyword}&limit=100&page={page}&is_digital=1&api_key={api}').text
time.sleep(0.5)
data = json.loads(r)
for i in data['results']:
title = i['title']
creation = i.get('original_creation_tsz')
date = str(pd.to_datetime(datetime.today()).date() - pd.to_datetime(datetime.fromtimestamp(creation)).date())
days=date[ok]
price = i.get('price')
quantity = i.get('quantity')
views = i.get('views')
num_favorers = i.get('num_favorers')
url = i.get('url')
cool = [views,num_favorers,days,quantity,price,title,url]
with open(f'Done.csv' , 'a', encoding='utf8') as done:
writer = csv.writer(done)
writer.writerow(cool)
r=""
def keywordall(keyword,api):
for page in range(1,501):
r = requests.get(f'https://openapi.etsy.com/v2/listings/active?keywords={keyword}&limit=100&page={page}&api_key={api}').text
time.sleep(0.5)
data = json.loads(r)
for i in data['results']:
title = i['title']
creation = i.get('original_creation_tsz')
date = str(pd.to_datetime(datetime.today()).date() - pd.to_datetime(datetime.fromtimestamp(creation)).date())
days=date[ok]
price = i.get('price')
quantity = i.get('quantity')
views = i.get('views')
num_favorers = i.get('num_favorers')
url = i.get('url')
cool = [views,num_favorers,days,quantity,price,title,url]
with open(f'Done.csv' , 'a', encoding='utf8') as done:
writer = csv.writer(done)
writer.writerow(cool)
r=""
def tagdigital(tag,api):
for page in range(1,501):
r = requests.get(f'https://openapi.etsy.com/v2/listings/active?tags={tag}&limit=100&page={page}&is_digital=1&api_key={api}').text
time.sleep(0.5)
data = json.loads(r)
for i in data['results']:
title = i['title']
creation = i.get('original_creation_tsz')
date = str(pd.to_datetime(datetime.today()).date() - pd.to_datetime(datetime.fromtimestamp(creation)).date())
days=date[ok]
price = i.get('price')
quantity = i.get('quantity')
views = i.get('views')
num_favorers = i.get('num_favorers')
url = i.get('url')
cool = [views,num_favorers,days,quantity,price,title,url]
with open(f'Done.csv' , 'a', encoding='utf8') as done:
writer = csv.writer(done)
writer.writerow(cool)
r=""
def tagall(tag,api):
for page in range(1,501):
r = requests.get(f'https://openapi.etsy.com/v2/listings/active?tags={tag}&limit=100&page={page}&api_key={api}').text
time.sleep(0.5)
data = json.loads(r)
for i in data['results']:
title = i['title']
creation = i.get('original_creation_tsz')
date = str(pd.to_datetime(datetime.today()).date() - pd.to_datetime(datetime.fromtimestamp(creation)).date())
days=date[ok]
price = i.get('price')
quantity = i.get('quantity')
views = i.get('views')
num_favorers = i.get('num_favorers')
url = i.get('url')
cool = [views,num_favorers,days,quantity,price,title,url]
with open(f'Done.csv' , 'a', encoding='utf8') as done:
writer = csv.writer(done)
writer.writerow(cool)
r=""
def keywordTagdigital(keyword,tag,api):
for page in range(1,501):
r = requests.get(f'https://openapi.etsy.com/v2/listings/active?keywords={keyword}&tags={tag}&is_digital=1&limit=100&page={page}&api_key={api}').text
time.sleep(0.5)
data = json.loads(r)
for i in data['results']:
title = i['title']
creation = i.get('original_creation_tsz')
date = str(pd.to_datetime(datetime.today()).date() - pd.to_datetime(datetime.fromtimestamp(creation)).date())
days=date[ok]
price = i.get('price')
quantity = i.get('quantity')
views = i.get('views')
num_favorers = i.get('num_favorers')
url = i.get('url')
cool = [views,num_favorers,days,quantity,price,title,url]
with open(f'Done.csv' , 'a', encoding='utf8') as done:
writer = csv.writer(done)
writer.writerow(cool)
r=""
def keywordTagall(keyword,tag,api):
for page in range(1,501):
r = requests.get(f'https://openapi.etsy.com/v2/listings/active?keywords={keyword}&tags={tag}&limit=100&page={page}&api_key={api}').text
time.sleep(0.5)
data = json.loads(r)
for i in data['results']:
title = i['title']
creation = i.get('original_creation_tsz')
date = str(pd.to_datetime(datetime.today()).date() - pd.to_datetime(datetime.fromtimestamp(creation)).date())
days=date[ok]
price = i.get('price')
quantity = i.get('quantity')
views = i.get('views')
num_favorers = i.get('num_favorers')
url = i.get('url')
cool = [views,num_favorers,days,quantity,price,title,url]
with open(f'Done.csv' , 'a', encoding='utf8') as done:
writer = csv.writer(done)
writer.writerow(cool)
r=""
if method_search == "1":
if all_or_no == "1":
keyword=input("Enter Keyword : ")
keywordall(keyword,api)
print("Wait until script finish...")
elif all_or_no == "2":
keyword=input("Enter Keyword : ")
keyword_digital(keyword,api)
print("Wait until script finish...")
elif method_search == "2":
if all_or_no == "1":
tag=input("Enter Tag : ")
tagall(tag,api)
print("Wait until script finish...")
elif all_or_no == "2":
tag=input("Enter Tag : ")
tagdigital(tag,api)
print("Wait until script finish...")
elif method_search == "3":
if all_or_no == "1":
keyword=input("Enter Keyword : ")
tag=input("Enter Tag : ")
keywordTagall(keyword,tag,api)
print("Wait until script finish...")
elif all_or_no == "2":
keyword=input("Enter Keyword : ")
tag=input("Enter Tag : ")
keywordTagdigital(keyword,tag,api)
print("Wait until script finish...")
print("DONE!!")
print("Don't Forget To Join 5AFAYA Server : https://discord.gg/tVvVPctNcj ")