-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview.py
More file actions
36 lines (31 loc) · 1.28 KB
/
view.py
File metadata and controls
36 lines (31 loc) · 1.28 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
import time
import random as rand
import scratchattach as sa
from datetime import datetime
# Get project ID and view amount from user
projectID = 1160692241 # EDIT THESE TO YOUR OWN PROGECT
viewAmount = 50000
# Estimate time to complete
timeEstimate = ((viewAmount * 80) / 60)
print(timeEstimate)
# Initialize session and project
waitTime = 0
session = sa.get_user("griffpatch") # Set this to a user that is NOT the owner of the project you are view boting
project = sa.get_project(projectID)
# Loop to post views
for i in range(viewAmount):
try:
project.post_view()
print("Posted view #" + str(i + 1) + ".\n" + str(((i + 1) / viewAmount) * 100) + "% done with views.")
if not (i == (viewAmount - 1)):
waitTime = rand.randint(60, 90)
print("Waiting " + str(waitTime) + " seconds until next view to prevent being blocked/rate limited by Scratch.")
print("Estimated time left: " + str(timeEstimate - ((80 * (i + 1)) / 60)) + " minutes")
time.sleep(waitTime)
except Exception as e:
print(f"Error posting view #{i + 1}: {e}")
break
# Print completion time
current_time = datetime.now().time()
print("Done at " + str(current_time))
Print("h"+1) #Error to end the program