def tweet_screenshot_estados(auth): dt = datetime.datetime.today() year = dt.year month = traducir_mes(dt.month) day = dt.day global hashtags hashtags = hashtags.copy() first_hashtag = random.choice(hashtags) hashtags.pop(hashtags.index(first_hashtag)) second_hashtag = random.choice(hashtags) hashtags.pop(hashtags.index(second_hashtag)) third_hashtag = random.choice(hashtags) hashtags.pop(hashtags.index(third_hashtag)) capture( 'https://e.infogram.com/ebc14900-0984-47df-8c99-3d0aabc01d17?src=embed', '/html/body/div[2]/div/div[2]') api = tweepy.API(auth) api.update_with_media( 'cifras_por_estado.png', status=f"Reporte - {day} de {month} del {year}\n" + "Cifras COVID de hoy, clasificadas por estado (Fuente: Verificovid @covidmx)\n" + f"#{first_hashtag} #{second_hashtag} #{third_hashtag}") print("[+] Tweeted cifras por estado.")
def screenshot_module(p): global host #print host print 'exec screenshot_module' #take screenshot & send to server over new connection screenshot.capture() sf = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sf.connect((host, p)) f = open('scr.jpg','rb') data = f.read(1024) while data: sf.send(data) data = f.read(1024) #print "Sending Completed" sf.close()
def main(): inputfile = input("请输入您要提取的文档路径\n") outputfile = input("请输入您要输出的文档路径\n") words = readword(inputfile) print(words) document = Document() document.styles["Normal"].font.name=u"Times New Roman" document.styles["Normal"].font.element.rPr.rFonts.set(qn('w:eastAsia'),u'宋体') title = document.add_heading('There are words in {}'.format(inputfile.split('.')[0]),level = 0) title.paragraph_format.alignment = WD_ALIGN_PARAGRAPH.CENTER pool = Pool(processes = 8) words_resultlist = [] for word in words: words_resultlist.append(pool.apply_async(getdictforword,args=(word,))) pool.close() pool.join() word_dicts = [] for word_dict in words_resultlist: word_dicts.append(word_dict.get()) print('开始截屏!') i=0 for word in words: capture(word) i=i+1 print('已完成{}%'.format(format((i/len(words))*100,'.2f'))) i=0 print('截屏结束!') for word in words: title_word = document.add_heading(word,level = 1) fayin_heading = document.add_heading('发音',level=2) fayin_paragraph = document.add_paragraph(word_dicts[i]['发音']) mean_heading = document.add_heading('释义',level=2) mean_paragraph = document.add_paragraph(word_dicts[i]['释义']) try: sentence1_heading = document.add_heading('例句1',level=2) sentence1_paragraph = document.add_paragraph( word_dicts[i]['例句1']) sentence2_heading = document.add_heading('例句2',level=2) sentence2_paragraph = document.add_paragraph( word_dicts[i]['例句2']) except: pass document.add_picture('images\\{}.png'.format(word),width = Inches(6.0)) document.add_page_break() i+=1 document.save(outputfile) print('finished')
def capture(path=''): #from HS.Utility import ScreenShot #ScreenShot.PerformCapture() import screenshot screenshot.capture(path)
and not unum == mate_unum: action_cycle.append(wm.time().cycle()) action.append(2) #パス finish = 1 add_cycle = cycle - wm.time().cycle() break # プレーモードを更新 wm.gameMode().UpdatePlayMode() # サイクルを1進める wm.time().addTime() if goal == 1: for i in range(10): wm.gameMode().UpdatePlayMode() wm.time().addTime() if finish == 1: for i in range(1, add_cycle + 1): wm.gameMode().UpdatePlayMode() wm.time().addTime() #action_cycle = [31, 421, 91] action_storage.append(action_cycle) action_storage.append(action) ''' if action_storage[0,0] == 0: action_storage = np.delete(action_storage, 0, 1) action_storage = np.delete(action_storage, 0, 1) ''' screenshot.capture(action_storage)
# click thread py_click(129, y_message_delta) time.sleep(2) # type message py_click(70, 778) time.sleep(1) py_click(70, 778) message = [l for l in message] for l in message: pyautogui.press(l) print('pressed {}'.format(l)) time.sleep(.25) time.sleep(.5) # send py_click(412, 780) time.sleep(2) # go back py_click(14, 82) # pixel interval for messages y_message_delta += 25 # 70, 778 y_message_delta = 240 screenshot.capture() py_click(x, y) time.sleep(.5) interval += 1 print(interval)
def materia(update, context): try: # Filtering and replacing data materia = " ".join(context.args) materia = materia.replace('1', 'I') materia = materia.replace('2', 'II') materia = materia.replace('3', 'III') materia = materia.replace('4', 'IV') materia = materia.replace('5', 'V') materia = materia.lower() except IndexError as e: context.bot.send_message(chat_id=update.effective_chat.id, text=f"¡Dime el nombre de una materia!\nEjemplo: /materia mate 2") return # URLs url_horarios = 'https://horarios.fime.me' url_dependencia_fime = f'{url_horarios}/dependencia/2316' url_periodo = None # Parse info from HTML response = requests.get(url_dependencia_fime) data = response.text soup = BeautifulSoup(data, features='html.parser') # Get last term last_term = soup.find_all('li', {'class': 'feature sombra-blanca'})[0] last_term_link = last_term.a['href'] url_last_term = url_horarios + last_term_link # First letter of materia try: first_letter_materia = "/materias/" + materia[0] current_url = url_last_term + first_letter_materia + "/" except IndexError: context.bot.send_message(chat_id=update.effective_chat.id, text=f"¡Dime el nombre de una materia!\nEjemplo: /materia mate 2") return # Fetch all materias response = requests.get(current_url) data = response.text soup = BeautifulSoup(data, features='html.parser') materias = soup.findAll('li', { 'class': 'feature sombra-blanca' }) materias_dict = {} for m in materias: materias_dict.update({m.text: m.a['href']}) materias_nombres = [] materias_links = [] for k,v in materias_dict.items(): materias_nombres.append(k) materias_links.append(v) matches = [] for nombre in materias_nombres: nombre = nombre.lower() nombre = nombre.replace('á', 'a') nombre = nombre.replace('é', 'e') nombre = nombre.replace('í', 'i') nombre = nombre.replace('ó', 'o') nombre = nombre.replace('ú', 'u') matches.append(fuzz.ratio(nombre, materia)) try: maxIndex = matches.index(max(matches)) materia_elegida = materias_nombres[maxIndex] url_final = url_horarios + materias_links[maxIndex] except: context.bot.send_message(chat_id=update.effective_chat.id, text=f"No se encontraron resultados de '{materia}'.") return context.bot.send_message(chat_id=update.effective_chat.id, text=f"Buscando {materia}...") capture(url_final) context.bot.send_message(chat_id=update.effective_chat.id, text=f"Mostrando la materia: <a href='{url_final}'><b>{materia_elegida}</b></a>", parse_mode="HTML") context.bot.send_photo(chat_id=update.effective_chat.id, text=" ".join(context.args), photo=open('listado.png', 'rb'))