File tree Expand file tree Collapse file tree 1 file changed +16
-21
lines changed Expand file tree Collapse file tree 1 file changed +16
-21
lines changed Original file line number Diff line number Diff line change 1
- import subprocess
2
1
import os
3
2
import requests
4
3
from git import Repo
5
4
import time
6
5
7
- repo_path = '/root/grasspr/' # Path to the Git repository
8
6
9
- while True :
10
- # Download the file from the URL
11
- url = 'https://raw.githubusercontent.com/monosans/proxy-list/main/proxies/all.txt'
12
- response = requests .get (url )
13
- with open ('all.txt' , 'wb' ) as f :
14
- f .write (response .content )
7
+ # Download the file from the URL
8
+ url = 'https://raw.githubusercontent.com/monosans/proxy-list/main/proxies/all.txt'
9
+ response = requests .get (url )
10
+ with open ('all.txt' , 'wb' ) as f :
11
+ f .write (response .content )
15
12
16
- # Rename the file
17
- os .rename ('all.txt' , 'proxy.txt' )
13
+ # Rename the file
14
+ os .rename ('all.txt' , 'proxy.txt' )
18
15
19
- # Add all files to the Git repository
20
- repo = Repo (repo_path )
21
- repo .index .add ('*' )
16
+ # Initialize the Git repository in the current directory
17
+ repo = Repo ('.' )
18
+ repo .index .add ([ 'proxy.txt' ] )
22
19
23
- # Commit changes
24
- repo .index .commit ('Automatic commit' )
20
+ # Commit changes
21
+ repo .index .commit ('Automatic commit' )
25
22
26
- # Push changes to the 'main' branch of the remote repository
27
- origin = repo .remote (name = 'origin' )
28
- origin .push ('main' )
29
-
30
- # Wait for 5 minutes before running the loop again
31
- time .sleep (5 * 60 )
23
+ # Push changes to the 'main' branch of the remote repository
24
+ origin = repo .remote (name = 'origin' )
25
+ origin .push ('main' )
32
26
27
+
You can’t perform that action at this time.
0 commit comments