Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coding: utf8
- # image must be 920 x 780
- import time
- import sys
- import re
- import StringIO
- import requests
- import Image
- coords = (
- ((0, 0, 200, 200),
- (240, 0, 440, 200),
- (480, 0, 680, 200),
- (720, 0, 920, 200)),
- ((0, 290, 200, 490),
- (240, 290, 440, 490),
- (480, 290, 680, 490),
- (720, 290, 920, 490)),
- ((0, 580, 200, 780),
- (240, 580, 440, 780),
- (480, 580, 680, 780),
- (720, 580, 920, 780))
- )
- _, threadlink, imgpath = sys.argv
- board, thread = re.findall("/(\w+)/res/(\d+).html", threadlink)[0]
- im = Image.open(imgpath)
- data = {
- 'task': 'post',
- 'board': board,
- 'thread': thread,
- }
- for i in range(3):
- files = {}
- for x in range(4):
- im.crop(coords[i][x]).save('D:\\1.jpg')
- files['image{}'.format(x + 1)] = open('D:\\1.jpg', 'rb').read()
- response = requests.post('https://2ch.hk/makaba/posting.fcgi', data=data, files=files)
- print response.status_code
- time.sleep(20)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement