import urllib.request
import json
import pyttsx3
import time
import requests
import re
import pyttsx3
m_last = ''
count = 1
url = '
https://btc.com/'headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36",
"Accept-Encoding":"gzip, deflate, br"}
proxies = {
"https": "https://117.22.42.43:8118",
"http": "http://119.139.197.247:3128",
"http": "http://121.69.37.6:9797",
}
if __name__ == '__main__':
engine=pyttsx3.init()
while True:
time.sleep(1)
count = count + 1
response = requests.get(url,headers=headers,proxies = proxies)
print(response.text)
print(type(response.text))
pattern = re.compile(r'"hash":".{64}","prev_block_ha')
m = pattern.findall(response.text)
m = m[0][8:72]
if (m_last != m):
m_last = m
voice=engine.getProperty('voice')
voices=engine.getProperty('voices')
for item in voices:
print(
item.id,item.languages)
engine.setProperty('voice','zh')
engine.say(m)
engine.runAndWait()
if (count >10):
count = 0
voice=engine.getProperty('voice')
voices=engine.getProperty('voices')
for item in voices:
print(
item.id,item.languages)
engine.setProperty('voice','zh')
engine.say(m)
engine.runAndWait()
print(m)
这是代码,能帮我看看哪里出错了吗?谢谢