Esempio n. 1
0
    def lulzimg_post(self, response):
	basedir = settings['IMAGES_STORE']
	params={}
	params['uploadtype']='image'
	params['submit']=''
	self.tt['publish']['imgs']=[]
	for img in self.tt['images']:
		key=img[1]
		path_comps= key.split('/')
		filename=os.path.join(basedir, *path_comps)
		self.log( filename);
		#inspect_response(response)
		params['image']=open(filename,'rb')
		datagen, headers = multipart_encode(params)
		upload_url = "http://lulzimg.com/upload.php"
		req = urllib2.Request(upload_url, datagen, headers)
		result = urllib2.urlopen(req)
		content=result.read()
		#print content
		p = re.compile(r'imagecode1(.)+value="(http://\S+)"')
       		match=p.search(content);
 	        self.log( match.group(2))
        	if match:
                	self.tt['publish']['imgs'].append(match.group(2))
                	saveItem(self.tt)
        	else:
                	self.log("ERROR: failed to upload image")
        return;
Esempio n. 2
0
    def shareimage_post(self, response):
	#register_openers()
	params={};
	basedir = settings['IMAGES_STORE']
	key=response.meta['key']
	path_comps= key.split('/')
	filename=os.path.join(basedir, *path_comps)
	print filename;
	inspect_response(response)
	params["userfile[]"]=open(filename,"rb")
	params["private_upload"]=0
	datagen, headers = multipart_encode(params)
	upload_url = "http://shareimage.org/upload.php"
	req = urllib2.Request(upload_url, datagen, headers)
	print response.meta['cookie']
	req.add_header('Cookie',response.meta['cookie'])
	result = urllib2.urlopen(req)
	content=result.read()
	print content
	response["meta"]['tttt']=content
	inspect_response(response)
	p = re.compile(r'value="(http://\S+)"')
	match=p.search(content);
	print match.group(1)
	if match:		
		self.tt['publish']['imgs'].append(match.group(1))
		saveItem(self.tt)	
	else:
		self.log("ERROR: failed to upload image")
#	inspect_response(response)
	return;
Esempio n. 3
0
    def get_short(self, response):
	self.tt["publish"]["url"]=response.body;
#	inspect_response(response)
	saveItem(self.tt)
	img_share_link = "http://www.imageporter.com/login.html"
	#return Request(img_share_link,callback=self.imgShare_login)
	#img_share_link = "http://shareimage.org/"
	'''shareimge worked, but now cant upload because of multi-files name'''
	#img_share_link = "http://shareimage.org/users.php?act=login&return=aHR0cDovL3NoYXJlaW1hZ2Uub3JnL3VzZXJzLnBocD9hY3Q9bG9nb3V0&lb_div=login_lightbox"
	#return Request(img_share_link,callback=self.shareimage_login)
	lulzimg_link = "http://lulzimg.com"
	return Request(lulzimg_link, callback = self.lulzimg_post,dont_filter=True)
Esempio n. 4
0
    def parse(self, response):
	hxs = HtmlXPathSelector(response)
	inputs=hxs.select("//form[normalize-space(@name)='form1']//input")
	params={};
	#conn = Connection()
	#db = conn.autobt
	#threads_db = db.threads
	#tt=threads_db.find_one();
	self.tt=selectToPub();
	if not self.tt or self.tt=="":
		print "pub: 400k no item to publish"
		return
	for input in inputs:
		type=input.select("./@type").extract()[0]
		if type.find("hidden") > -1:
			name=input.select("./@name").extract()[0]
			val =input.select("./@value").extract()[0]
			params[name]=val;
		elif type.find("file") > -1:
			name=input.select("./@name").extract()[0]
			basedir = settings['BTFILES_STORE']
			key=self.tt['btfile']
			path_comps= key.split('/')
			filename=os.path.join(basedir, *path_comps)		
			val = open(filename,"rb")
			params[name]=val;
		

	register_openers()
	datagen, headers = multipart_encode(params)
	req = urllib2.Request(self.upload_url, datagen, headers)
	result = urllib2.urlopen(req)
	content=result.read()
	p = re.compile(r'http://www.400kb.com/go.php\?ref=(\w)+');
	content = content.encode('utf-8')
	match = p.search(content)
	if not "publish" in self.tt:
		self.tt["publish"]={}
	self.tt["publish"]["btfile"]=match.group(0);
	self.tt["pub_progress"]="1"
	self.tt["pub_time"]=int(time())
		
	#threads_db.save(tt)
	saveItem(self.tt)
	#inspect_response(response)
	return self.adv_request();