mirror of
https://github.com/WMK965/965-Python-Learning-Repo.git
synced 2025-04-27 20:13:21 +00:00
Compare commits
No commits in common. "8fde2750e2d37b082e0a8f98d8f89e969f622e88" and "967a8d104686c1c5ab74270c48b4406613d0dca9" have entirely different histories.
8fde2750e2
...
967a8d1046
@ -1,33 +0,0 @@
|
|||||||
# Script made by 965
|
|
||||||
import requests
|
|
||||||
import json
|
|
||||||
import ast
|
|
||||||
import time
|
|
||||||
import os
|
|
||||||
|
|
||||||
#Bing_24-09-07_23
|
|
||||||
console_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
|
|
||||||
json_url = 'https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1'
|
|
||||||
url_suffix = '_UHD.jpg&rf=LaDigue_UHD.jpg&pid=hp&w=3840&h=2160&rs=1&c=4'
|
|
||||||
folder_name = 'image'
|
|
||||||
filename = 'Bing_' + time.strftime("%Y-%m-%d_%H", time.localtime())[2:] + '.jpg'
|
|
||||||
filename_reg = str(filename)
|
|
||||||
|
|
||||||
if os.path.exists(f'./{folder_name}') is False:
|
|
||||||
os.popen('mkdir image')
|
|
||||||
print(f'[{console_time}]Making directory <image>')
|
|
||||||
else:
|
|
||||||
print(f'[{console_time}]Directory exist, Downloading image...')
|
|
||||||
try:
|
|
||||||
response = requests.get(json_url)
|
|
||||||
response = json.loads(response.text)
|
|
||||||
response = str(response['images'])[1:-1]
|
|
||||||
response = ast.literal_eval(response)
|
|
||||||
url = json_url[:20] + response['urlbase'] + url_suffix
|
|
||||||
except:
|
|
||||||
print(f'[{console_time}]Url processing failure')
|
|
||||||
try:
|
|
||||||
open(f'./{folder_name}/{filename_reg}', 'wb').write(requests.get(url).content)
|
|
||||||
print(f'[{console_time}]Image download successful')
|
|
||||||
except:
|
|
||||||
print(f'[{console_time}]Image download failure')
|
|
@ -1,26 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
domesticlist = 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/ChinaMax/ChinaMax_Domain.txt'
|
|
||||||
oversealist = 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Global/Global_Domain.txt'
|
|
||||||
|
|
||||||
os.system(f'curl -o -k --ssl-no-revoke ./domestic-ori.txt {domesticlist}')
|
|
||||||
os.system(f'curl -o -k --ssl-no-revoke ./oversea-ori.txt {oversealist}')
|
|
||||||
|
|
||||||
|
|
||||||
def modifyconf(ori, out):
|
|
||||||
with open(ori, 'r') as f:
|
|
||||||
lines = f.readlines()
|
|
||||||
f2 = open(out, 'w')
|
|
||||||
for line in lines:
|
|
||||||
if line[0] == '#':
|
|
||||||
continue
|
|
||||||
elif line[0] == '.':
|
|
||||||
f2.write(line[1:])
|
|
||||||
else:
|
|
||||||
f2.write(line)
|
|
||||||
f2.close()
|
|
||||||
|
|
||||||
|
|
||||||
modifyconf('domestic-ori.txt', 'domestic_domainlist.conf')
|
|
||||||
modifyconf('oversea-ori.txt', 'oversea_domainlist.conf')
|
|
@ -1,5 +1,5 @@
|
|||||||
# encoding utf-8
|
# encoding utf-8
|
||||||
import linecache2 as linecache
|
import linecache
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user