瀏覽代碼

Initial commit

pull/1/head
root 3 年之前
當前提交
b698570ff9
共有 5 個文件被更改,包括 45 次插入0 次删除
  1. +28
    -0
      GOOGLE.pyw
  2. +2
    -0
      dependencies.sh
  3. +8
    -0
      readme.md
  4. +7
    -0
      sozdik.sh
  5. +0
    -0
      theMostPoupularInNews

+ 28
- 0
GOOGLE.pyw 查看文件

@@ -0,0 +1,28 @@
from bs4 import BeautifulSoup
import requests
import sys, getopt
import urllib.parse
def main(argv):
inputfile = ''
inputfile = urllib.parse.quote(inputfile.encode('utf8'), ':/')
numberfile = ''
try:
opts, args = getopt.getopt(argv,"hi:o:",["ifile=","ofile="])
except getopt.GetoptError:
print ('spotitube.py -i <Search Keyword> -o <Index>')
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print ('spotitube.py -i <Search Keyword> -o <Index>')
sys.exit()
elif opt in ("-i", "--ifile"):
inputfile = arg
elif opt in ("-o", "--ifile"):
numberfile = arg
html_content = requests.get(inputfile).text
soup = BeautifulSoup(html_content, "lxml")
print(soup.findAll("p",{"id":"dictionary_translate_article_translation"}))
if __name__ == "__main__":
main(sys.argv[1:])

+ 2
- 0
dependencies.sh 查看文件

@@ -0,0 +1,2 @@
pip3 install tkinter
pip3 install bs4

+ 8
- 0
readme.md 查看文件

@@ -0,0 +1,8 @@
# Sozdikscraper
Sozdikscraper is a tool that allows you to scrape sozdik.kz for translations. For now, it only works from
Russian to Kazakh.
# Installation
Just run **./dependencies.sh** or install python, pip, bs4 and html2text
# Usage
Step 1: Launch the program ``` ./sozdik.sh ```
Step 2: Translate!

+ 7
- 0
sozdik.sh 查看文件

@@ -0,0 +1,7 @@
#! /bin/bash
agent="Mozilla/5.0 (Windows NT 10.0; x86_64; rv:67.0) Gecko/20100101 Firefox/67.0"
while true
do
read -p "Translate what word: " word
python3 GOOGLE.pyw -i "$(echo "https://sozdik.kz/ru/dictionary/translate/ru/kk/"$word"/")" | html2text
done

+ 0
- 0
theMostPoupularInNews 查看文件


Loading…
取消
儲存