Skip to content

Instantly share code, notes, and snippets.

View KebabLord's full-sized avatar

Junicchi KebabLord

View GitHub Profile
@KebabLord
KebabLord / tureng-cli.py
Last active January 9, 2023 15:54
turengo, npm tureng ve tarayıcı eklentileri olsun yazılmış hiçbir tureng scripti an itibariyle çalışmadığından şu 16 satırlık zımbırtıyı yazmak zorunda kaldım.
#!/usr/bin/env python3
# Kullanım: ./tureng.py kelime [-f -s]
import requests,re,html,sys
useragent="Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0"
res = requests.get(f"https://tureng.com/en/turkish-english/{sys.argv[1]}",headers={"User-Agent":useragent}).text
words = re.findall(r'"hidden\-xs">(.*?)<.*?lang="(.*?)">.*?>(.*?)<.*?lang="(.*?)">.*?>(.*?)<',res,flags=re.S|re.M)
prettify = lambda x: html.unescape(x).replace("\n","").replace("\r","").replace("Turkish","TR").replace("English","EN")
for word in words:
usage = prettify(word[0])
w1 = prettify(word[2])